virtualenv/res/lib/lib_create_env.py
changeset 165 64aae3fee9d5
parent 113 c05567404888
child 170 3c73250693b9
equal deleted inserted replaced
164:4f77196ffde1 165:64aae3fee9d5
    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     'DISTRIBUTE': {'setup': 'distribute', 'url':'http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz', 'local':"distribute-0.6.34.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    19     'DISTRIBUTE': {'setup': 'distribute', 'url':'http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz', 'local':"distribute-0.6.34.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    20     'DJANGO': {'setup': 'django', 'url': 'https://github.com/IRI-Research/django/archive/1.5.4+IRI.tar.gz', 'local':"django-1.5.4-IRI.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    20     'DJANGO': {'setup': 'django', 'url': 'https://github.com/django/django/archive/1.6.2.tar.gz', 'local':"django-1.6.2.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    21     'SIX' : {'setup':'six', 'url':'https://pypi.python.org/packages/source/s/six/six-1.3.0.tar.gz', 'local': 'six-1.3.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    21     'SIX' : {'setup':'six', 'url':'https://pypi.python.org/packages/source/s/six/six-1.6.1.tar.gz', 'local': 'six-1.6.1.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    22     'DJANGO-EXTENSIONS': { 'setup': 'django-extensions', 'url':'https://github.com/django-extensions/django-extensions/archive/1.1.1.tar.gz', 'local':"django-extensions-1.1.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    22     'DJANGO-EXTENSIONS': { 'setup': 'django-extensions', 'url':'https://github.com/django-extensions/django-extensions/archive/1.3.3.tar.gz', 'local':"django-extensions-1.3.3.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    23     'SOUTH': { 'setup': 'South', 'url':'http://www.aeracode.org/releases/south/south-0.7.6.tar.gz', 'local':"south-0.7.6.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    23     'SOUTH': { 'setup': 'South', 'url':'http://www.aeracode.org/releases/south/south-0.8.4.tar.gz', 'local':"south-0.8.4.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    24     'RDFLIB' : {'setup':'rdflib', 'url':'https://github.com/RDFLib/rdflib/archive/4.0.1.tar.gz', 'local': 'rdflib-4.0.1.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    24     'RDFLIB' : {'setup':'rdflib', 'url':'https://github.com/RDFLib/rdflib/archive/4.1.1.tar.gz', 'local': 'rdflib-4.1.1.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    25     'REQUESTS': {'setup': 'requests', 'url':'https://github.com/kennethreitz/requests/archive/v1.2.3.tar.gz', 'local':'requests-1.2.3.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    25     'REQUESTS': {'setup': 'requests', 'url':'https://github.com/kennethreitz/requests/archive/v2.2.1.tar.gz', 'local':'requests-2.2.1.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    26     'SIMPLEJSON': {'setup': 'simplejson','url':'https://github.com/simplejson/simplejson/archive/v3.3.0.tar.gz', 'local': 'simplejson-3.3.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    26     'SIMPLEJSON': {'setup': 'simplejson','url':'https://github.com/simplejson/simplejson/archive/v3.4.0.tar.gz', 'local': 'simplejson-3.4.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    27     'ISODATE': {'setup': 'isodate','url':'https://pypi.python.org/packages/source/i/isodate/isodate-0.4.9.tar.gz', 'local': 'isodate-0.4.9.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    27     'ISODATE': {'setup': 'isodate','url':'https://pypi.python.org/packages/source/i/isodate/isodate-0.5.0.tar.gz', 'local': 'isodate-0.5.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    28     'PYPARSING': {'setup': 'pyparsing','url':'http://downloads.sourceforge.net/project/pyparsing/pyparsing/pyparsing-1.5.7/pyparsing-1.5.7.tar.gz', 'local': 'pyparsing-1.5.7.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    28     'PYPARSING': {'setup': 'pyparsing','url':'https://pypi.python.org/packages/source/p/pyparsing/pyparsing-2.0.1.tar.gz', 'local': 'pyparsing-2.0.1.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    29     'SPARQLWRAPPER': {'setup': 'sparqlwrapper','url':'http://downloads.sourceforge.net/project/sparql-wrapper/sparql-wrapper-python/1.5.2/SPARQLWrapper-1.5.2.tar.gz', 'local': 'SPARQLWrapper-1.5.2.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    29     'SPARQLWRAPPER': {'setup': 'sparqlwrapper','url':'http://downloads.sourceforge.net/project/sparql-wrapper/sparql-wrapper-python/1.5.2/SPARQLWrapper-1.5.2.tar.gz', 'local': 'SPARQLWrapper-1.5.2.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    30     'HTML5LIB': {'setup': 'html5lib','url':'https://github.com/html5lib/html5lib-python/archive/1.0b3.tar.gz', 'local': 'html5lib-1.0b3.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    30     'HTML5LIB': {'setup': 'html5lib','url':'https://github.com/html5lib/html5lib-python/archive/0.999.tar.gz', 'local': 'html5lib-0.999.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    31     'PSYCOPG2': {'setup': 'psycopg2','url': 'http://initd.org/psycopg/tarballs/PSYCOPG-2-5/psycopg2-2.5.tar.gz', 'local':"psycopg2-2.5.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    31     'PSYCOPG2': {'setup': 'psycopg2','url': 'http://initd.org/psycopg/tarballs/PSYCOPG-2-5/psycopg2-2.5.2.tar.gz', 'local':"psycopg2-2.5.2.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    32     'DEFUSEDXML': {'setup': 'defusedxml','url': 'https://pypi.python.org/packages/source/d/defusedxml/defusedxml-0.4.1.tar.gz', 'local':"defusedxml-0.4.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    32     'DEFUSEDXML': {'setup': 'defusedxml','url': 'https://pypi.python.org/packages/source/d/defusedxml/defusedxml-0.4.1.tar.gz', 'local':"defusedxml-0.4.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    33     'DJANGO-CORS-HEADERS': {'setup': 'django-cors-headers','url': 'https://pypi.python.org/packages/source/d/django-cors-headers/django-cors-headers-0.11.tar.gz', 'local':"django-cors-headers-0.11.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    33     'DJANGO-CORS-HEADERS': {'setup': 'django-cors-headers','url': 'https://pypi.python.org/packages/source/d/django-cors-headers/django-cors-headers-0.12.tar.gz', 'local':"django-cors-headers-0.12.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    34     'DJANGO-FILTER': {'setup': 'django-filter','url': 'https://github.com/alex/django-filter/archive/v0.7.tar.gz', 'local':"django-filter-0.7.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    34     'DJANGO-FILTER': {'setup': 'django-filter','url': 'https://github.com/alex/django-filter/archive/v0.7.tar.gz', 'local':"django-filter-0.7.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    35     'DJANGO-REST-FRAMEWORK': {'setup': 'djangorestframework','url': 'https://pypi.python.org/packages/source/d/djangorestframework/djangorestframework-2.3.7.tar.gz', 'local':"djangorestframework-2.3.7.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    35     'DJANGO-REST-FRAMEWORK': {'setup': 'djangorestframework','url': 'https://pypi.python.org/packages/source/d/djangorestframework/djangorestframework-2.3.13.tar.gz', 'local':"djangorestframework-2.3.13.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    36     'MARKDOWN': {'setup': 'markdown','url': 'https://pypi.python.org/packages/source/M/Markdown/Markdown-2.3.1.tar.gz', 'local':"Markdown-2.3.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    36     'MARKDOWN': {'setup': 'markdown','url': 'http://pypi.python.org/packages/source/M/Markdown/Markdown-2.4.tar.gz', 'local':"Markdown-2.4.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    37     '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}},
    37     '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}},
    38     'HAYSTACK': {'setup': 'django-haystack','url': 'https://github.com/toastdriven/django-haystack/archive/v2.1.0.tar.gz', 'local':"django-haystack-2.1.0.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    38     'HAYSTACK': {'setup': 'django-haystack','url': 'https://github.com/toastdriven/django-haystack/archive/v2.1.0.tar.gz', 'local':"django-haystack-2.1.0.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    39     'PYELASTICSEARCH': {'setup': 'pyelasticsearch','url': 'https://pypi.python.org/packages/source/p/pyelasticsearch/pyelasticsearch-0.6.tar.gz', 'local':"pyelasticsearch-0.6.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    39     'PYELASTICSEARCH': {'setup': 'pyelasticsearch','url': 'https://pypi.python.org/packages/source/p/pyelasticsearch/pyelasticsearch-0.6.1.tar.gz', 'local':"pyelasticsearch-0.6.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    40     'WHOOSH': {'setup': 'whoosh','url': 'https://pypi.python.org/packages/source/W/Whoosh/Whoosh-2.5.3.tar.gz', 'local':"Whoosh-2.5.3.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    40     'WHOOSH': {'setup': 'whoosh','url': 'https://pypi.python.org/packages/source/W/Whoosh/Whoosh-2.5.7.tar.gz', 'local':"Whoosh-2.5.7.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    41 }
    41 }
    42 
    42 
    43 class ResourcesEnv(object):
    43 class ResourcesEnv(object):
    44 
    44 
    45     def __init__(self, src_base, run_base, urls, normal_installs):
    45     def __init__(self, src_base, run_base, urls, normal_installs):
    62         for key, url_dict in urls.items():
    62         for key, url_dict in urls.items():
    63             url_dict_copy = url_dict.copy()
    63             url_dict_copy = url_dict.copy()
    64             if url_dict.get('install', {}).get('method','pip') == 'pip-req':
    64             if url_dict.get('install', {}).get('method','pip') == 'pip-req':
    65                 get_base_path = self.get_run_res_base_path
    65                 get_base_path = self.get_run_res_base_path
    66             else:
    66             else:
    67                 get_base_path = self.get_src_base_path                                
    67                 get_base_path = self.get_src_base_path
    68             if not url_dict['url'].startswith("http://"):
    68             if not url_dict['url'].startswith("http://"):
    69                 url_dict_copy['url'] = get_base_path(url_dict['url'])
    69                 url_dict_copy['url'] = get_base_path(url_dict['url'])
    70             url_dict_copy['local'] = get_base_path(url_dict['local'])
    70             url_dict_copy['local'] = get_base_path(url_dict['local'])
    71 
    71 
    72             self.__add_package_def(key, url_dict_copy )
    72             self.__add_package_def(key, url_dict_copy )
   191                         show_stdout=True)
   191                         show_stdout=True)
   192     return install_lib
   192     return install_lib
   193 
   193 
   194 install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared'])
   194 install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared'])
   195 install_zlib = gen_install_comp_lib("zlib", "ZLIB", [])
   195 install_zlib = gen_install_comp_lib("zlib", "ZLIB", [])
   196     
   196 
       
   197 osx_extra_env = {'ARCHFLAGS': '-Wno-error=unused-command-line-argument-hard-error-in-future', 'CFLAGS': '-Qunused-arguments', 'CPPFLAGS': '-Qunused-arguments'}
       
   198 
   197 
   199 
   198 def lib_generate_install_methods(path_locations, src_base, run_base, Logger, call_subprocess, normal_installs, options_to_add=None, urls= None):
   200 def lib_generate_install_methods(path_locations, src_base, run_base, Logger, call_subprocess, normal_installs, options_to_add=None, urls= None):
   199     
   201     
   200     all_urls = URLS.copy()
   202     all_urls = URLS.copy()
   201     if urls is not None:
   203     if urls is not None:
   320                 extra_env = install_options.get('dict_extra_env', default_install_options['dict_extra_env'])
   322                 extra_env = install_options.get('dict_extra_env', default_install_options['dict_extra_env'])
   321                 if not extra_env:
   323                 if not extra_env:
   322                     extra_env = {}
   324                     extra_env = {}
   323                     
   325                     
   324                 if 'TMPDIR' not in extra_env:
   326                 if 'TMPDIR' not in extra_env:
   325                     extra_env['TMPDIR'] = os.path.abspath(tmp_dir)          
   327                     extra_env['TMPDIR'] = os.path.abspath(tmp_dir)
       
   328                 if system_str == 'Darwin':
       
   329                     for flag_key, flag_value in iter(osx_extra_env.items()):
       
   330                         flags = extra_env.get(flag_key, '')
       
   331                         if flag_value not in flags:
       
   332                             flags += " -Wno-error=unused-command-line-argument-hard-error-in-future"
       
   333                             extra_env[flag_key] = flags.strip()
       
   334                     
   326                 #isinstance(lst, (list, tuple))
   335                 #isinstance(lst, (list, tuple))
   327                 if key not in ignore_packages:
   336                 if key not in ignore_packages:
   328                     logger.notify("install %s with method %s" % (key, repr(method)))
   337                     logger.notify("install %s with method %s" % (key, repr(method)))
   329                     if callable(method):
   338                     if callable(method):
   330                         method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop)
   339                         method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop)
   342         logger.notify('Run "%s Package" to install new packages that provide builds'
   351         logger.notify('Run "%s Package" to install new packages that provide builds'
   343                       % join(script_dir, 'easy_install'))
   352                       % join(script_dir, 'easy_install'))
   344     
   353     
   345     def adjust_options(options, args):
   354     def adjust_options(options, args):
   346         if not options_to_add:
   355         if not options_to_add:
   347             pass
   356             return
   348         for opt in options_to_add:
   357         for opt in options_to_add:
   349             test_opt = opt.split('=',1)[0]
   358             test_opt = opt.split('=',1)[0]
   350             #if not hasattr(options,test_opt) or getattr(options, test_opt) is None:
   359             #if not hasattr(options,test_opt) or getattr(options, test_opt) is None:
   351             setattr(options, test_opt,opt.split('=',1)[1] if "=" in opt else True)
   360             setattr(options, test_opt,opt.split('=',1)[1] if "=" in opt else True)
   352 
   361 
   353     return adjust_options, extend_parser, after_install
   362     return adjust_options, extend_parser, after_install
       
   363