correct virtual env creation script for python 2.6
authorymh <ymh.work@gmail.com>
Sun, 25 Jul 2010 14:16:26 +0200
changeset 61 476d735e5804
parent 60 c0a7182455ce
child 62 f9f8ea6eac0e
correct virtual env creation script for python 2.6
sbin/virtualenv/create_python_env.py
--- a/sbin/virtualenv/create_python_env.py	Mon Jul 12 18:50:03 2010 +0200
+++ b/sbin/virtualenv/create_python_env.py	Sun Jul 25 14:16:26 2010 +0200
@@ -131,6 +131,14 @@
             if system_str == 'Linux' :
                 olddir = os.getcwd()
                 patch_dest_path = os.path.join(lib_dir,'site-packages','setuptools-0.6c11-py'+'%s.%s' % (sys.version_info[0], sys.version_info[1])+'.egg')
+                if os.path.isfile(patch_dest_path):
+                    # must unzip egg
+                    # rename file and etract all
+                    shutil.move(patch_dest_path, patch_dest_path + ".zip")
+                    zf = zipfile.ZipFile(patch_dest_path + ".zip",'r')
+                    zf.extractall(patch_dest_path)
+                    os.remove(patch_dest_path + ".zip")
+
                 logger.notify("Patch jcc : %s " % (patch_dest_path))
                 os.chdir(patch_dest_path)
                 p = patch.fromfile(os.path.join(jcc_src_path,"jcc","patches","patch.43.0.6c11"))
@@ -166,7 +174,10 @@
                 destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64 --arch i386\\n")
                 destination.write("NUM_FILES=2\\n")
             else:
-                destination.write("JCC=$(PYTHON) -m jcc --shared\\n")
+                if sys.version_info >= (2,6) and sys.version_info < (2,7):
+                    destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared\\n")
+                else:
+                    destination.write("JCC=$(PYTHON) -m jcc --shared\\n")
                 destination.write("NUM_FILES=2\\n")
             for line in source:
                 destination.write( line )