From a579f77446801ae69a1275bc609e6a942c1d4b53 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sun, 16 Aug 2015 19:00:00 +0200 Subject: 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. --- base/common/python/pki/upgrade.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'base/common/python') 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]() -- cgit