correct virtualenv creation
authorymh <ymh.work@gmail.com>
Tue, 03 May 2011 17:17:17 +0200
changeset 83 b7aef101c7d1
parent 82 f8d77e53f7c2
child 84 91a4dafd5904
correct virtualenv creation
virtualenv/res/lib/lib_create_env.py
virtualenv/web/res/res_create_env.py
--- a/virtualenv/res/lib/lib_create_env.py	Tue May 03 00:01:49 2011 +0200
+++ b/virtualenv/res/lib/lib_create_env.py	Tue May 03 17:17:17 2011 +0200
@@ -121,14 +121,18 @@
     #patch for linux
     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")
+        setuptools_path = os.path.join(lib_dir, 'site-packages', 'setuptools')
+        if os.path.exists(setuptools_path) and os.path.isdir(setuptools_path):
+            patch_dest_path = os.path.join(lib_dir, 'site-packages')
+        else:
+            patch_dest_path = os.path.join(lib_dir,'site-packages','setuptools-0.6c11-py%s.%s.egg' % (sys.version_info[0], sys.version_info[1]))
+            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"))
--- a/virtualenv/web/res/res_create_env.py	Tue May 03 00:01:49 2011 +0200
+++ b/virtualenv/web/res/res_create_env.py	Tue May 03 17:17:17 2011 +0200
@@ -4,14 +4,22 @@
 
 system_str = platform.system()
 
+if system_str == 'Windows':
+    INSTALLS = [
+    ('JCC','easy_install',None,None),
+    ('PSYCOPG2',install_psycopg2,None,None),
+    ('PYLUCENE','easy_install',None,None),
+    ]
+else:
+    INSTALLS = [
+    ('PYLUCENE',install_pylucene,None,None),
+    ('PSYCOPG2', 'pip', None, None),
+    ]
 
 if system_str == 'Linux':
-    INSTALLS = [
+    INSTALLS.extend([
     ('DISTRIBUTE', 'pip', None, None),
-    ]
-else:
-    INSTALLS = []
-    
+    ])
 
 INSTALLS.extend([ #(key,method, option_str, dict_extra_env)
     ('SETUPTOOLS-HG', 'pip', None, None), 
@@ -30,30 +38,14 @@
     ('SOCIAL_AUTH', 'easy_install', None, None),
 ])
 
-if system_str == 'Windows':
-    INSTALLS.extend([
-    ('JCC','easy_install',None,None),
-    ('PSYCOPG2',install_psycopg2,None,None),
-    ('PYLUCENE','easy_install',None,None),
-    ])
-else:
-    INSTALLS.extend([
-    ('PYLUCENE',install_pylucene,None,None),
-    ('PSYCOPG2', 'pip', None, None),
-    ])
-
 if system_str == "Darwin":
     INSTALLS.extend([
     ('LXML', 'easy_install', None, {'STATIC_DEPS': 'true', 'LIBXML2_VERSION': '2.7.8', 'LIBXSLT_VERSION': '1.1.26', 'LIBICONV_VERSION': '1.13.1'}),
     ])
-elif system_str == "Windows":
+else:
     INSTALLS.extend([
     ('LXML', 'easy_install', None, None),
     ])
-else:
-    INSTALLS.extend([
-    ('LXML', 'pip', None, None),
-    ])
 
 
 def generate_install_methods(path_locations, src_base, Logger, call_subprocess):