execfile in python 3 and 2, again
authorymh <ymh.work@gmail.com>
Mon, 08 Jun 2015 00:45:09 +0200
changeset 130 27c8c40d9e03
parent 129 509d7a4c0a2b
child 131 5a15dea4302a
execfile in python 3 and 2, again
server/setup.py
--- a/server/setup.py	Mon Jun 08 00:37:30 2015 +0200
+++ b/server/setup.py	Mon Jun 08 00:45:09 2015 +0200
@@ -46,11 +46,12 @@
     source_dirs = ['src']
 
     version_variables = {}
-    local_variables = {}
+
     try:
-        with open("somefile.py") as f:
-            code = compile(f.read(), "somefile.py", 'exec')
-            exec(code, version_variables, local_variables)
+        version_file = os.path.join(source_dirs[0], "__init__.py")
+        with open(version_file) as f:
+            code = compile(f.read(), version_file, 'exec')
+            exec(code, version_variables)
     except:
         print("Exception in user code:")
         print("-"*60)