virtualenv/res/lib/lib_create_env.py
changeset 19 55fecd7b4ba7
parent 18 bc8e23448f4d
child 20 7fe7c089c1f2
equal deleted inserted replaced
18:bc8e23448f4d 19:55fecd7b4ba7
    14 join = os.path.join
    14 join = os.path.join
    15 system_str = platform.system()
    15 system_str = platform.system()
    16 
    16 
    17 URLS = {
    17 URLS = {
    18     #'': {'setup': '', 'url':'', 'local':''},
    18     #'': {'setup': '', 'url':'', 'local':''},
    19     'EDCSA': {'setup': 'edcsa', 'url':'https://github.com/warner/python-ecdsa/archive/python-ecdsa-0.11.tar.gz', 'local':'ecdsa-0.10.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    19     'EDCSA': {'setup': 'edcsa', 'url':'https://github.com/warner/python-ecdsa/archive/python-ecdsa-0.11.tar.gz', 'local':'ecdsa-0.11.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    20     'WSGIREF': {'setup': 'wsgiref', 'url':'https://pypi.python.org/packages/source/w/wsgiref/wsgiref-0.1.2.zip', 'local':'wsgiref-0.1.2.zip', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    20     'WSGIREF': {'setup': 'wsgiref', 'url':'https://pypi.python.org/packages/source/w/wsgiref/wsgiref-0.1.2.zip', 'local':'wsgiref-0.1.2.zip', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    21     'PYCRYPTO': {'setup': 'pycrypto', 'url':'http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz', 'local':'pycrypto-2.6.1.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    21     'PYCRYPTO': {'setup': 'pycrypto', 'url':'http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz', 'local':'pycrypto-2.6.1.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    22     'PARAMIKO' : {'setup': 'paramiko', 'url':'https://github.com/paramiko/paramiko/archive/v1.13.0.tar.gz', 'local':'paramiko-1.13.0.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    22     'PARAMIKO' : {'setup': 'paramiko', 'url':'https://github.com/paramiko/paramiko/archive/v1.12.3.tar.gz', 'local':'paramiko-1.12.3.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    23     'FABRIC': {'setup': 'fabric', 'url':'https://github.com/fabric/fabric/archive/1.8.3.tar.gz', 'local':'fabric-1.8.3.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    23     'FABRIC': {'setup': 'fabric', 'url':'https://github.com/fabric/fabric/archive/1.8.3.tar.gz', 'local':'fabric-1.8.3.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    24     'MERCURIAL': {'setup': 'mercurial', 'url':'http://mercurial.selenic.com/release/mercurial-2.9.1.tar.gz', 'local':'mercurial-2.9.1.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    24     'MERCURIAL': {'setup': 'mercurial', 'url':'http://mercurial.selenic.com/release/mercurial-2.9.1.tar.gz', 'local':'mercurial-2.9.1.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    25 }
    25 }
    26 
    26 
    27 class ResourcesEnv(object):
    27 class ResourcesEnv(object):
    46         for key, url_dict in urls.items():
    46         for key, url_dict in urls.items():
    47             url_dict_copy = url_dict.copy()
    47             url_dict_copy = url_dict.copy()
    48             if url_dict.get('install', {}).get('method','pip') == 'pip-req':
    48             if url_dict.get('install', {}).get('method','pip') == 'pip-req':
    49                 get_base_path = self.get_run_res_base_path
    49                 get_base_path = self.get_run_res_base_path
    50             else:
    50             else:
    51                 get_base_path = self.get_src_base_path                                
    51                 get_base_path = self.get_src_base_path
    52             if not url_dict['url'].startswith("http://"):
    52             if not url_dict['url'].startswith("http://"):
    53                 url_dict_copy['url'] = get_base_path(url_dict['url'])
    53                 url_dict_copy['url'] = get_base_path(url_dict['url'])
    54             url_dict_copy['local'] = get_base_path(url_dict['local'])
    54             url_dict_copy['local'] = get_base_path(url_dict['local'])
    55 
    55 
    56             self.__add_package_def(key, url_dict_copy )
    56             self.__add_package_def(key, url_dict_copy )
   304                 extra_env = install_options.get('dict_extra_env', default_install_options['dict_extra_env'])
   304                 extra_env = install_options.get('dict_extra_env', default_install_options['dict_extra_env'])
   305                 if not extra_env:
   305                 if not extra_env:
   306                     extra_env = {}
   306                     extra_env = {}
   307                     
   307                     
   308                 if 'TMPDIR' not in extra_env:
   308                 if 'TMPDIR' not in extra_env:
   309                     extra_env['TMPDIR'] = os.path.abspath(tmp_dir)          
   309                     extra_env['TMPDIR'] = os.path.abspath(tmp_dir)
       
   310                 if system_str == 'Darwin':
       
   311                     archflags = extra_env.get('ARCHFLAGS', '')
       
   312                     if '-Wno-error=unused-command-line-argument-hard-error-in-future' not in archflags:
       
   313                         archflags += " -Wno-error=unused-command-line-argument-hard-error-in-future"
       
   314                         extra_env['ARCHFLAGS'] = archflags.strip()
   310                 #isinstance(lst, (list, tuple))
   315                 #isinstance(lst, (list, tuple))
   311                 if key not in ignore_packages:
   316                 if key not in ignore_packages:
   312                     logger.notify("install %s with method %s" % (key, repr(method)))
   317                     logger.notify("install %s with method %s" % (key, repr(method)))
   313                     if callable(method):
   318                     if callable(method):
   314                         method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop)
   319                         method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop)