diff options
author | Christian Heimes <cheimes@redhat.com> | 2015-08-16 19:00:00 +0200 |
---|---|---|
committer | Christian Heimes <cheimes@redhat.com> | 2015-08-17 21:14:11 +0200 |
commit | a579f77446801ae69a1275bc609e6a942c1d4b53 (patch) | |
tree | f0de5b8d5f48b7df1c80b6a48f7241cc919d5401 /base/common/python/pki | |
parent | 5967532e2a04b158f6b962255c464aa9f546792b (diff) | |
download | pki-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/python/pki')
-rw-r--r-- | base/common/python/pki/upgrade.py | 5 |
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]() |