diff -r 8ee36aa9a5f6 -r d6bc9a2cc131 virtualenv/res/lib/lib_create_env.py --- a/virtualenv/res/lib/lib_create_env.py Fri Mar 28 15:39:10 2014 +0100 +++ b/virtualenv/res/lib/lib_create_env.py Tue Apr 01 14:39:26 2014 +0200 @@ -20,58 +20,58 @@ 'DJANGO': {'setup': 'django', 'url': 'https://www.djangoproject.com/download/1.6.2/tarball/', 'local':"Django-1.6.2.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, '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}}, 'DJANGO-REGISTRATION': { 'setup': 'django-registration', 'url':'https://bitbucket.org/ubernostrum/django-registration/downloads/django-registration-1.0.tar.gz', 'local':"django-registration-1.0.tar.gz", 'install': {'method': 'easy_install', 'option_str': '-Z', 'dict_extra_env': None}}, - 'SOUTH': { 'setup': 'South', 'url':'http://www.aeracode.org/releases/south/south-0.7.5.tar.gz', 'local':"south-0.7.5.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, - 'SORL_THUMBNAIL' : { 'setup': 'sorl-thumbnail', 'url':'https://github.com/sorl/sorl-thumbnail/archive/master.tar.gz', 'local':"sorl-thumbnail-v11.12.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, - 'LIBJPEG': {'setup': None, 'url':'jpegsrc.v9.tar.gz', 'local':'jpegsrc.v9.tar.gz', 'install': {'method': 'install_libjpeg', 'option_str': None, 'dict_extra_env': None}}, - 'ZLIB': {'setup': None, 'url':'zlib-1.2.7.tar.gz', 'local':'zlib-1.2.7.tar.gz', 'install': {'method': 'install_zlib', 'option_str': None, 'dict_extra_env': None}}, - 'PYCRYPTO': {'setup': 'pycrypto', 'url':'https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.tar.gz', 'local':'pycrypto-2.6.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, - 'PARAMIKO': {'setup': 'paramiko', 'url':'https://github.com/paramiko/paramiko/archive/v1.9.0.tar.gz', 'local':'paramiko-1.9.0.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, - 'FABRIC': {'setup': 'fabric', 'url':'https://github.com/fabric/fabric/tarball/1.5.1', 'local':'fabric-1.5.1.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, - 'MERCURIAL': {'setup': 'mercurial', 'url':'http://mercurial.selenic.com/release/mercurial-2.2.3.tar.gz', 'local':'mercurial-2.2.3.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, - 'HAYSTACK': {'setup': 'django-haystack', 'url': 'https://github.com/toastdriven/django-haystack/tarball/master', 'local': 'django-haystack-V2.0.0-beta.tar.gz', 'install':{'method':'pip', 'option_str': None, 'dict_extra_env': None}}, - 'REQUESTS': {'setup': 'requests', 'url':'https://github.com/kennethreitz/requests/archive/v1.1.0.tar.gz', 'local':'requests-1.1.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, - 'PYELASTICSEARCH': {'setup': 'pyelasticsearch', 'url':'https://github.com/rhec/pyelasticsearch/archive/0.3.tar.gz', 'local':'pyelasticsearch-0.3.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, - 'WHOOSH': {'setup': 'whoosh', 'url':'https://bitbucket.org/mchaput/whoosh/get/tip.tar.gz', 'local':'whoosh-2.5.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, - 'SETUPTOOLS_HG' : {'setup':'setuptools_hg', 'url':'http://pypi.python.org/packages/source/s/setuptools_hg/setuptools_hg-0.4.tar.gz', 'local': 'setuptools_hg-0.4.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, + 'SOUTH': { 'setup': 'South', 'url':'https://bitbucket.org/andrewgodwin/south/get/0.8.4.tar.gz', 'local':"south-0.8.4.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, + 'SORL_THUMBNAIL' : { 'setup': 'sorl-thumbnail', 'url':'https://github.com/mariocesar/sorl-thumbnail/archive/v11.12.1b.tar.gz', 'local':"sorl-thumbnail-11.12.1b.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, + 'LIBJPEG': {'setup': None, 'url':'jpegsrc.v9a.tar.gz', 'local':'jpegsrc.v9a.tar.gz', 'install': {'method': 'install_libjpeg', 'option_str': None, 'dict_extra_env': None}}, + 'ZLIB': {'setup': None, 'url':'zlib-1.2.8.tar.gz', 'local':'zlib-1.2.8.tar.gz', 'install': {'method': 'install_zlib', 'option_str': None, 'dict_extra_env': None}}, + '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}}, + '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}}, + 'PYELASTICSEARCH': {'setup': 'pyelasticsearch', 'url':'https://github.com/rhec/pyelasticsearch/archive/0.6.1.tar.gz', 'local':'pyelasticsearch-0.6.1.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, + 'WHOOSH': {'setup': 'whoosh', 'url':'https://bitbucket.org/mchaput/whoosh/get/2.5.7.tar.gz', 'local':'whoosh-2.5.7.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, 'WSGIREF' : {'setup':'wsgiref', 'url':'http://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}}, - 'SIMPLEJSON': {'setup': 'simplejson', 'url':'https://github.com/simplejson/simplejson/archive/v3.0.7.tar.gz', 'local':"simplejson-3.0.7.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, - 'PYTZ' : {'setup': 'pytz', 'url':'http://pypi.python.org/packages/source/p/pytz/pytz-2012j.tar.gz', 'local' : 'pytz-2012j.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, + 'SIMPLEJSON': {'setup': 'simplejson', 'url':'https://github.com/simplejson/simplejson/archive/v3.3.3.tar.gz', 'local':"simplejson-3.3.3.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, + 'PYTZ' : {'setup': 'pytz', 'url':'https://pypi.python.org/packages/source/p/pytz/pytz-2014.2.tar.gz', 'local' : 'pytz-2014.2.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, # dependencies for Tastypie : mimeparse>=0.1.3, python-dateutil>=2.1, lxml, PyYAML (not necessary but we never know), python-digest - 'MIMEPARSE' : {'setup':'mimeparse', 'url':'http://pypi.python.org/packages/source/m/mimeparse/mimeparse-0.1.3.tar.gz', 'local': 'mimeparse-0.1.3.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, + 'MIMEPARSE' : {'setup':'mimeparse', 'url':'https://pypi.python.org/packages/source/p/python-mimeparse/python-mimeparse-0.1.4.tar.gz', 'local': 'python-mimeparse-0.1.4.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, '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}}, - 'PYTHON-DATEUTIL' : {'setup':'python-dateutil', 'url':'http://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.1.tar.gz', 'local': 'python-dateutil-2.1.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, - 'PYYAML' : {'setup':'pyyaml', 'url':'http://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz', 'local': 'PyYAML-3.10.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, + 'PYTHON-DATEUTIL' : {'setup':'python-dateutil', 'url':'https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.2.tar.gz', 'local': 'python-dateutil-2.2.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, + 'PYYAML' : {'setup':'pyyaml', 'url':'http://pyyaml.org/download/pyyaml/PyYAML-3.11.tar.gz', 'local': 'PyYAML-3.11.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, 'PYTHON-DIGEST' : {'setup':'python-digest', 'url':'http://pypi.python.org/packages/source/p/python-digest/python-digest-1.7.tar.gz', 'local': 'python-digest-1.7.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, - 'DJANGO-TASTYPIE' : {'setup':'django-tastypie', 'url':'https://github.com/toastdriven/django-tastypie/archive/v0.10.0.tar.gz', 'local': 'django-tastypie-0.10.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, - 'ISODATE' : {'setup': 'isodate', 'url': 'https://github.com/gweis/isodate/archive/0.4.9.tar.gz', 'local': 'isodate-0.4.9.tar.gz', 'install': {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, - 'HTML5LIB' : {'setup': 'html5lib', 'url': 'https://html5lib.googlecode.com/files/html5lib-0.95.tar.gz', 'local': 'html5lib-0.95.tar.gz', 'install': {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, - 'RDFLIB' : {'setup': 'rdflib', 'url': 'https://nodeload.github.com/RDFLib/rdflib/tar.gz/master', 'local': 'rdflib-2.4.0.tar.gz', 'install': {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, + 'DJANGO-TASTYPIE' : {'setup':'django-tastypie', 'url':'https://github.com/toastdriven/django-tastypie/archive/v0.11.0.tar.gz', 'local': 'django-tastypie-0.11.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, + 'ISODATE' : {'setup': 'isodate', 'url': 'https://github.com/gweis/isodate/archive/0.5.0.tar.gz', 'local': 'isodate-0.5.0.tar.gz', 'install': {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, + '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}}, + '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}}, + #SPARQLWRAPPER : the file SPARQLWrapper-1.5.2.tar.gz is needed in the folder to soleve RDFLIB dependencies. It will be installed when resolving the dependencies.graph. + '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}}, '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}}, } if system_str == 'Windows': - URLS.update({ 'PSYCOPG2': {'setup': 'psycopg2','url': 'psycopg2-2.4.6.win32-py2.7-pg9.2.2-release.exe', 'local':"psycopg2-2.4.6.win32-py2.7-pg9.2.2-release.exe", 'install': {'method': 'install_psycopg2', 'option_str': None, 'dict_extra_env': None}}, 'PIL': {'setup': 'pil', 'url': 'http://effbot.org/media/downloads/PIL-1.1.7.win32-py2.7.exe', 'local':"PIL-1.1.7.win32-py2.7.exe", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}}, }) else: URLS.update({ - 'PSYCOPG2': {'setup': 'psycopg2','url': 'http://www.psycopg.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.6.tar.gz', 'local':"psycopg2-2.4.6.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, - 'PIL': {'setup': 'pil', 'url': 'https://github.com/python-imaging/Pillow/archive/1.7.8.tar.gz', 'local':"Pillow-1.7.8.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, + '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}}, + 'PIL': {'setup': 'pil', 'url': 'https://github.com/python-imaging/Pillow/archive/2.3.1.tar.gz', 'local':"Pillow-2.3.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, }) class ResourcesEnv(object): - def __init__(self, src_base, urls, normal_installs): + def __init__(self, src_base, run_base, urls, normal_installs): self.src_base = src_base + self.run_base = run_base self.URLS = {} self.__init_url(urls) self.NORMAL_INSTALL = normal_installs def get_src_base_path(self, fpath): return os.path.abspath(os.path.join(self.src_base, fpath)).replace("\\","/") + + def get_run_res_base_path(self, fpath): + return os.path.abspath(os.path.join(self.run_base, 'res', fpath)).replace("\\","/") def __add_package_def(self, key, dict): self.URLS[key] = dict @@ -79,10 +79,14 @@ def __init_url(self, urls): for key, url_dict in urls.items(): url_dict_copy = url_dict.copy() + if url_dict.get('install', {}).get('method','pip') == 'pip-req': + get_base_path = self.get_run_res_base_path + else: + get_base_path = self.get_src_base_path if not url_dict['url'].startswith("http://"): - url_dict_copy['url'] = self.get_src_base_path(url_dict['url']) - url_dict_copy['local'] = self.get_src_base_path(url_dict['local']) - + url_dict_copy['url'] = get_base_path(url_dict['url']) + url_dict_copy['local'] = get_base_path(url_dict['local']) + self.__add_package_def(key, url_dict_copy ) def ensure_dir(dir, logger): @@ -207,15 +211,17 @@ install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared']) install_zlib = gen_install_comp_lib("zlib", "ZLIB", []) - + +osx_extra_env = {'ARCHFLAGS': '-Wno-error=unused-command-line-argument-hard-error-in-future', 'CFLAGS': '-Qunused-arguments', 'CPPFLAGS': '-Qunused-arguments'} -def lib_generate_install_methods(path_locations, src_base, Logger, call_subprocess, normal_installs, options_to_add=None, urls= None): + +def lib_generate_install_methods(path_locations, src_base, run_base, Logger, call_subprocess, normal_installs, options_to_add=None, urls= None): all_urls = URLS.copy() if urls is not None: all_urls.update(urls) - res_env = ResourcesEnv(src_base, all_urls, normal_installs) + res_env = ResourcesEnv(src_base, run_base, all_urls, normal_installs) def filter_python_develop(line): if not line.strip(): @@ -228,15 +234,43 @@ 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)) + def normal_install(key, res_path, 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_path,method)) if method == 'pip': if sys.platform == 'win32': - args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'pip')), 'install', res_env.URLS[key][res_source_key]] + args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'pip')), 'install', res_path] else: - args = [os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', res_env.URLS[key][res_source_key]] + args = [os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', res_path] if option_str : - args.insert(4,option_str) + args.append(option_str) + if res_source_key == 'local': + if extra_env is None: + extra_env = {} + extra_env["PIP_DOWNLOAD_CACHE"] = res_env.get_src_base_path("") + args.insert(2, '-f') + args.insert(3, res_env.get_src_base_path("")) + args.insert(4, '--no-index') + logger.notify("Install %s from %s with %s args %s " % (key,res_path,method, repr(args))) + call_subprocess(args, + cwd=os.path.abspath(tmp_dir), + filter_stdout=filter_python_develop, + show_stdout=True, + extra_env=extra_env) + if method == 'pip-req': + if sys.platform == 'win32': + args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'pip')), 'install', '-r', res_path] + else: + args = [os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-r', res_path] + if option_str : + args.append(option_str) + if res_source_key == 'local': + if extra_env is None: + extra_env = {} + extra_env["PIP_DOWNLOAD_CACHE"] = res_env.get_src_base_path("") + args.insert(2, '-f') + args.insert(3, res_env.get_src_base_path("")) + args.insert(4, '--no-index') + logger.notify("Install %s from %s with %s args %s " % (key,res_path,method, repr(args))) call_subprocess(args, cwd=os.path.abspath(tmp_dir), filter_stdout=filter_python_develop, @@ -244,9 +278,9 @@ extra_env=extra_env) else: if sys.platform == 'win32': - args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'easy_install')), res_env.URLS[key][res_source_key]] + args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'easy_install')), res_path] else: - args = [os.path.abspath(os.path.join(home_dir, 'bin', 'easy_install')), res_env.URLS[key][res_source_key]] + args = [os.path.abspath(os.path.join(home_dir, 'bin', 'easy_install')), res_path] if option_str : args.insert(1,option_str) call_subprocess(args, @@ -274,7 +308,7 @@ res_source_key = getattr(options, 'type_install') if hasattr(options, 'type_install') else 'local' #.get('type_install', 'local') if res_source_key is None: - res_source_key = local + res_source_key = 'local' ignore_packages = [] @@ -289,9 +323,16 @@ logger.indent += 2 try: for key in res_env.NORMAL_INSTALL: - if key not in res_env.URLS: - logger.notify("%s not found in def : passing" % (key,)) - install_options = res_env.URLS[key].get('install', None) + install_options = None + if isinstance(key, dict): + install_options = key.get('install', default_install_options) + install_options['method'] = 'pip-req' + res_path = res_env.get_run_res_base_path(key['requirement']) + else: + if key not in res_env.URLS: + logger.notify("%s not found in def : passing" % (key,)) + install_options = res_env.URLS[key].get('install', None) + res_path = res_env.URLS[key][res_source_key] if install_options is None: install_options = default_install_options method = install_options.get('method', default_install_options['method']) @@ -303,10 +344,12 @@ if 'TMPDIR' not in extra_env: extra_env['TMPDIR'] = os.path.abspath(tmp_dir) if system_str == 'Darwin': - archflags = extra_env.get('ARCHFLAGS', '') - if '-Wno-error=unused-command-line-argument-hard-error-in-future' not in archflags: - archflags += " -Wno-error=unused-command-line-argument-hard-error-in-future" - extra_env['ARCHFLAGS'] = archflags.strip() + for flag_key, flag_value in iter(osx_extra_env.items()): + flags = extra_env.get(flag_key, '') + if flag_value not in flags: + flags += " -Wno-error=unused-command-line-argument-hard-error-in-future" + extra_env[flag_key] = flags.strip() + #isinstance(lst, (list, tuple)) if key not in ignore_packages: logger.notify("install %s with method %s" % (key, repr(method))) @@ -315,7 +358,7 @@ elif method in globals() and callable(globals()[method]) and method not in ['pip', 'easy_install']: globals()[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) + normal_install(key, res_path, 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) @@ -328,10 +371,11 @@ def adjust_options(options, args): if not options_to_add: - pass + return for opt in options_to_add: test_opt = opt.split('=',1)[0] - if not hasattr(options,test_opt) or getattr(options, test_opt) is None: - setattr(options, test_opt,opt.split('=',1)[1] if "=" in opt else True) + #if not hasattr(options,test_opt) or getattr(options, test_opt) is None: + setattr(options, test_opt,opt.split('=',1)[1] if "=" in opt else True) return adjust_options, extend_parser, after_install +