chiark / gitweb /
Replace execfile with open+compile+exec
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 4 Jan 2016 16:01:37 +0000 (17:01 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 10 Mar 2016 16:43:37 +0000 (16:43 +0000)
fdroidserver/common.py

index 94c36b7857e09a8f655c4ee4d2b329cfbd0ed20e..8f5350ffabb56742c6702e1138d766f346f4f93d 100644 (file)
@@ -20,6 +20,7 @@
 # common.py is imported by all modules, so do not import third-party
 # libraries here as they will become a requirement for all commands.
 
+import io
 import os
 import sys
 import re
@@ -206,7 +207,9 @@ def read_config(opts, config_file='config.py'):
     config = {}
 
     logging.debug("Reading %s" % config_file)
-    execfile(config_file, config)
+    with io.open(config_file, "rb") as f:
+        code = compile(f.read(), config_file, 'exec')
+        exec(code, None, config)
 
     # smartcardoptions must be a list since its command line args for Popen
     if 'smartcardoptions' in config: