summaryrefslogtreecommitdiffstats
path: root/base/common
diff options
context:
space:
mode:
authorChristian Heimes <cheimes@redhat.com>2015-08-16 19:00:00 +0200
committerChristian Heimes <cheimes@redhat.com>2015-08-17 21:14:11 +0200
commita579f77446801ae69a1275bc609e6a942c1d4b53 (patch)
treef0de5b8d5f48b7df1c80b6a48f7241cc919d5401 /base/common
parent5967532e2a04b158f6b962255c464aa9f546792b (diff)
downloadpki-a579f77446801ae69a1275bc609e6a942c1d4b53.tar.gz
pki-a579f77446801ae69a1275bc609e6a942c1d4b53.tar.xz
pki-a579f77446801ae69a1275bc609e6a942c1d4b53.zip
Py3 modernization: lib2to3.fixes.fix_execfile
execfile has been removed from Python 3. The upgrade importer now reads, compiles and executed the upgrade scripts manually.
Diffstat (limited to 'base/common')
-rw-r--r--base/common/python/pki/upgrade.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/base/common/python/pki/upgrade.py b/base/common/python/pki/upgrade.py
index 3e16723ed..2dfc0d2b9 100644
--- a/base/common/python/pki/upgrade.py
+++ b/base/common/python/pki/upgrade.py
@@ -539,7 +539,10 @@ class PKIUpgrader(object):
# load scriptlet class
variables = {}
- execfile(os.path.join(version_dir, filename), variables)
+ absname = os.path.join(version_dir, filename)
+ with open(absname, 'r') as f:
+ bytecode = compile(f.read(), absname, 'exec')
+ exec(bytecode, variables) # pylint: disable=W0122
# create scriptlet object
scriptlet = variables[classname]()