scap-security-guide/backport-fix-python-imports-of-ElementTree.patch
HuaxinLu d87dee90e9 fix for python upgrade
Signed-off-by: HuaxinLu <luhuaxin1@huawei.com>
2022-01-29 04:40:42 +08:00

44 lines
1.5 KiB
Diff

From 27dc7ecafe8ab5c2e0bbbb2fcdc399bece5c250e Mon Sep 17 00:00:00 2001
From: Vojtech Polasek <vpolasek@redhat.com>
Date: Mon, 8 Jun 2020 12:02:16 +0200
Subject: [PATCH] fix python imports of ElementTree
Signed-off-by: HuaxinLu <luhuaxin1@huawei.com>
---
shared/transforms/pcidss/transform_benchmark_to_pcidss.py | 5 ++++-
ssg/xml.py | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/shared/transforms/pcidss/transform_benchmark_to_pcidss.py b/shared/transforms/pcidss/transform_benchmark_to_pcidss.py
index 3023e0435f..0ceaf727d3 100755
--- a/shared/transforms/pcidss/transform_benchmark_to_pcidss.py
+++ b/shared/transforms/pcidss/transform_benchmark_to_pcidss.py
@@ -20,7 +20,10 @@
# Martin Preisler <mpreisle@redhat.com>
import logging
-from xml.etree import cElementTree as ElementTree
+try:
+ from xml.etree import cElementTree as ElementTree
+except ImportError:
+ from xml.etree import ElementTree as ElementTree
import json
import sys
import os
diff --git a/ssg/xml.py b/ssg/xml.py
index 736875a9d2..71c1381c23 100644
--- a/ssg/xml.py
+++ b/ssg/xml.py
@@ -9,7 +9,7 @@ from .constants import xml_version, oval_header, timestamp, PREFIX_TO_NS
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
- import cElementTree as ElementTree
+ from xml.etree import ElementTree as ElementTree
def oval_generated_header(product_name, schema_version, ssg_version):
--
2.30.0