virtualenv/res/lib/lib_create_env.py
changeset 93 7b6bcc33783f
parent 91 86694f53cf8c
child 98 a14feef87fd7
--- a/virtualenv/res/lib/lib_create_env.py	Fri Aug 01 01:30:00 2014 +0200
+++ b/virtualenv/res/lib/lib_create_env.py	Tue Jan 21 18:11:36 2020 +0100
@@ -26,6 +26,7 @@
     'MYSQL': { 'setup': 'mysql-python', 'url': 'http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download', 'local':"MySQL-python-1.2.3.tar.gz"},
     'OPENID': {'setup':'openid', 'url':'http://pypi.python.org/packages/source/p/python-openid/python-openid-2.2.5.tar.gz', 'local':"python-openid-2.2.5.tar.gz"},
     'DJANGO_OPENID_CONSUMER': {'setup':'django_openid_consumer', 'url':'http://pypi.python.org/packages/source/d/django-openid-consumer/django-openid-consumer-0.1.1.tar.gz', 'local':"django-openid-consumer-0.1.1.tar.gz"},
+    'SETUPTOOLS-HG': {'setup':'setuptools_hg', 'url':'https://bitbucket.org/jezdez/setuptools_hg/get/v0.4.tar.gz', 'local':"setuptools_hg-0.4.tar.gz"},
     'SOCIAL_AUTH': {'setup':'social_auth', 'url':'https://github.com/omab/django-social-auth/tarball/v0.3.10', 'local':"omab-django-social-auth-v0.3.10-modified.tar.gz"},
     'SOUTH': { 'setup': 'South', 'url':'http://www.aeracode.org/releases/south/south-0.7.5.tar.gz', 'local':"south-0.7.5.tar.gz"},
     'DJANGO_GUARDIAN' : { 'setup': 'django-guardian', 'url':'http://pypi.python.org/packages/source/d/django-guardian/django-guardian-1.0.3.tar.gz', 'local':"django-guardian-1.0.3.tar.gz"},
@@ -67,7 +68,7 @@
 
     def get_src_base_path(self, fpath):
         return os.path.abspath(os.path.join(self.src_base, fpath)).replace("\\","/")
-    
+
     def __add_package_def(self, key, setup, url, local):
         self.URLS[key] = {'setup':setup, 'url':url, 'local':self.get_src_base_path(local)}
 
@@ -83,7 +84,7 @@
         logger.notify('Creating directory %s' % dir)
         os.makedirs(dir)
 
-def extend_parser(parser):    
+def extend_parser(parser):
     parser.add_option(
         '--index-url',
         metavar='INDEX_URL',
@@ -108,7 +109,7 @@
 
 
 def install_pylucene(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop):
-    
+
     logger.notify("Get Pylucene from %s " % res_env.URLS['PYLUCENE'][res_source_key])
     pylucene_src = os.path.join(src_dir,"pylucene.tar.gz")
     if res_source_key == 'local':
@@ -116,14 +117,14 @@
     else:
         urllib.urlretrieve(res_env.URLS['PYLUCENE'][res_source_key], pylucene_src)
     tf = tarfile.open(pylucene_src,'r:gz')
-    pylucene_base_path = os.path.join(src_dir,"pylucene") 
+    pylucene_base_path = os.path.join(src_dir,"pylucene")
     logger.notify("Extract Pylucene to %s " % pylucene_base_path)
     tf.extractall(pylucene_base_path)
     tf.close()
-    
+
     pylucene_src_path = os.path.join(pylucene_base_path, os.listdir(pylucene_base_path)[0])
     jcc_src_path = os.path.abspath(os.path.join(pylucene_src_path,"jcc"))
-    
+
     #install jcc
 
     #patch for linux
@@ -154,7 +155,7 @@
                     show_stdout=True,
                     extra_env={'JCC_JDK' : '/usr/lib/jvm/java-7-openjdk-i386/'})
     #install pylucene
-    
+
     logger.notify("Install pylucene")
     #modify makefile
     makefile_path = os.path.join(pylucene_src_path,"Makefile")
@@ -166,7 +167,7 @@
     destination.write("PREFIX_PYTHON="+os.path.abspath(home_dir)+"\n")
     destination.write("ANT=ant\n")
     destination.write("PYTHON=$(PREFIX_PYTHON)/bin/python\n")
-    
+
     if system_str == "Darwin":
         if sys.version_info >= (2,6):
             destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64 --arch i386\n")
@@ -201,7 +202,7 @@
                     filter_stdout=filter_python_develop,
                     show_stdout=True,
                     extra_env={'JCC_JDK' : '/usr/lib/jvm/java-7-openjdk-i386/'})
-    
+
 
 def install_psycopg2(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop):
     psycopg2_src = os.path.join(src_dir,"psycopg2.zip")
@@ -211,36 +212,36 @@
     psycopg2_base_path = os.path.join(src_dir,"psycopg2")
     zf.extractall(psycopg2_base_path)
     zf.close()
-    
+
     psycopg2_src_path = os.path.join(psycopg2_base_path, os.listdir(psycopg2_base_path)[0])
     shutil.copytree(os.path.join(psycopg2_src_path, 'psycopg2'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'psycopg2')))
     shutil.copy(os.path.join(psycopg2_src_path, 'psycopg2-2.0.14-py2.6.egg-info'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'site-packages')))
 
 def gen_install_comp_lib(lib_name, lib_key, configure_options=[]):
-    
+
     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")
         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) 
+        lib_base_path = os.path.join(src_dir, lib_name)
         logger.notify("Extract %s to %s " % (lib_name,lib_base_path))
         tf.extractall(lib_base_path)
         tf.close()
-        
+
         lib_src_path = os.path.join(lib_base_path, os.listdir(lib_base_path)[0])
-    
+
         logger.notify("libjpeg configure")
         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("libjpeg make")
         call_subprocess(['make'],
                         cwd=os.path.abspath(lib_src_path),
                         filter_stdout=filter_python_develop,
                         show_stdout=True)
-    
+
         logger.notify("zlib make install")
         call_subprocess(['make', 'install'],
                         cwd=os.path.abspath(lib_src_path),
@@ -252,15 +253,15 @@
 install_zlib = gen_install_comp_lib("zlib", "ZLIB", [])
 
 
-    
-    
+
+
 
 def lib_generate_install_methods(path_locations, src_base, Logger, call_subprocess, normal_installs, urls=None):
-    
+
     all_urls = URLS.copy()
     if urls is not None:
         all_urls.update(urls)
-        
+
     res_env = ResourcesEnv(src_base, all_urls, normal_installs)
 
     def filter_python_develop(line):
@@ -272,8 +273,8 @@
             if line.startswith(prefix):
                 return Logger.DEBUG
         return Logger.NOTIFY
-    
-    
+
+
     def normal_install(key, method, option_str, extra_env, res_source_key, home_dir, tmp_dir, res_env, logger, call_subprocess):
         logger.notify("Install %s from %s with %s" % (key,res_env.URLS[key][res_source_key],method))
         if method == 'pip':
@@ -299,17 +300,17 @@
                     cwd=os.path.abspath(tmp_dir),
                     filter_stdout=filter_python_develop,
                     show_stdout=True,
-                    extra_env=extra_env)            
- 
-    
+                    extra_env=extra_env)
+
+
     def after_install(options, home_dir):
-        
+
         global logger
-        
+
         verbosity = options.verbose - options.quiet
         logger = Logger([(Logger.level_for_integer(2-verbosity), sys.stdout)])
 
-        
+
         home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
         base_dir = os.path.dirname(home_dir)
         src_dir = os.path.join(home_dir, 'src')
@@ -317,31 +318,31 @@
         ensure_dir(src_dir, logger)
         ensure_dir(tmp_dir, logger)
         system_str = platform.system()
-        
+
         res_source_key = options.type_install
-        
+
         ignore_packages = []
-        
+
         if options.ignore_packages :
             ignore_packages = options.ignore_packages.split(",")
-        
+
         logger.indent += 2
-        try:    
+        try:
             for key, method, option_str, extra_env in res_env.NORMAL_INSTALL:
                 if key not in ignore_packages:
                     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)
                     else:
                         normal_install(key, method, option_str, extra_env, res_source_key, home_dir, tmp_dir, res_env, logger, call_subprocess)
-                            
+
             logger.notify("Clear source dir")
             shutil.rmtree(src_dir)
-    
+
         finally:
             logger.indent -= 2
         script_dir = join(base_dir, bin_dir)
         logger.notify('Run "%s Package" to install new packages that provide builds'
                       % join(script_dir, 'easy_install'))
-    
+
 
     return adjust_options, extend_parser, after_install