加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-fix-python-imports-of-ElementTree.patch 1.47 KB
一键复制 编辑 原始数据 按行查看 历史
HuaxinLu 提交于 2022-01-29 04:40 . fix for python upgrade
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化