virtualenv script correction
authorymh <ymh.work@gmail.com>
Fri, 22 Feb 2013 17:48:33 +0100
changeset 5 8fb31c5f27d5
parent 4 7b847fe17284
child 6 db873f49afcb
virtualenv script correction
virtualenv/res/lib/lib_create_env.py
--- a/virtualenv/res/lib/lib_create_env.py	Fri Feb 22 17:32:50 2013 +0100
+++ b/virtualenv/res/lib/lib_create_env.py	Fri Feb 22 17:48:33 2013 +0100
@@ -47,6 +47,7 @@
             self.__add_package_def(key, url_dict_copy )
 
 def ensure_dir(dir, logger):
+    logger.notify('Check directory %s' % dir)
     if not os.path.exists(dir):
         logger.notify('Creating directory %s' % dir)
         os.makedirs(dir)
@@ -136,6 +137,7 @@
     
     def install_lib(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop):
         lib_src = os.path.join(src_dir,lib_name+".tar.gz")
+        logger.notify("Copy %s to %s " % (res_env.URLS[lib_key][res_source_key],lib_src))
         shutil.copy(res_env.URLS[lib_key][res_source_key], lib_src)
         tf = tarfile.open(lib_src,'r:gz')
         lib_base_path = os.path.join(src_dir, lib_name) 
@@ -145,30 +147,27 @@
         
         lib_src_path = os.path.join(lib_base_path, os.listdir(lib_base_path)[0])
     
-        logger.notify(libname + " configure")
-        call_subprocess(['configure', '--prefix='+os.path.abspath(home_dir)] + configure_options,
+        logger.notify(lib_name + " configure in " + lib_src_path)
+        call_subprocess(['./configure', '--prefix='+os.path.abspath(home_dir)] + configure_options,
                         cwd=os.path.abspath(lib_src_path),
                         filter_stdout=filter_python_develop,
                         show_stdout=True)
         
-        logger.notify(libname + " make")
+        logger.notify(lib_name + " make in " + lib_src_path)
         call_subprocess(['make'],
                         cwd=os.path.abspath(lib_src_path),
                         filter_stdout=filter_python_develop,
                         show_stdout=True)
     
-        logger.notify(libname + "make install")
+        logger.notify(lib_name + "make install in " + lib_src_path)
         call_subprocess(['make', 'install'],
                         cwd=os.path.abspath(lib_src_path),
                         filter_stdout=filter_python_develop,
                         show_stdout=True)
-        return install_lib
+    return install_lib
 
 install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared'])
 install_zlib = gen_install_comp_lib("zlib", "ZLIB", [])
-
-
-    
     
 
 def lib_generate_install_methods(path_locations, src_base, Logger, call_subprocess, normal_installs, options_to_add=None, urls= None):
@@ -241,9 +240,9 @@
         ignore_packages = []
         
         if system_str == 'Windows':
-            default_install_options = {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}
+            default_install_options = {'method': 'easy_install', 'option_str': None, 'dict_extra_env': {}}
         else:
-            default_install_options = {'method': 'pip', 'option_str': None, 'dict_extra_env': None}
+            default_install_options = {'method': 'pip', 'option_str': None, 'dict_extra_env': {}}
             
         if options.ignore_packages :
             ignore_packages = options.ignore_packages.split(",")
@@ -259,8 +258,14 @@
                 method = install_options.get('method', default_install_options['method'])
                 option_str = install_options.get('option_str', default_install_options['option_str'])
                 extra_env = install_options.get('dict_extra_env', default_install_options['dict_extra_env'])
+                if not extra_env:
+                    extra_env = {}
+                    
+                if 'TMPDIR' not in extra_env:
+                    extra_env['TMPDIR'] = os.path.abspath(tmp_dir)          
                 #isinstance(lst, (list, tuple))
                 if key not in ignore_packages:
+                    logger.notify("install %s with method %s" % (key, repr(method)))
                     if callable(method):
                         method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop)
                     elif method in globals() and callable(globals()[method]) and method not in ['pip', 'easy_install']: