diff -r 7eee076e994e -r 3d54acec55d6 virtualenv/res/lib/lib_create_env.py --- a/virtualenv/res/lib/lib_create_env.py Wed Feb 11 11:14:40 2015 +0100 +++ b/virtualenv/res/lib/lib_create_env.py Wed Dec 10 10:05:38 2014 +0100 @@ -41,8 +41,17 @@ 'SIMPLEJSON' : { 'setup': 'simplejson', 'url': 'https://github.com/simplejson/simplejson/archive/v3.6.5.tar.gz', 'local' : 'simplejson-3.6.5.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}}, 'URLLIB3': { 'setup': 'urllib3', 'url':'https://github.com/shazow/urllib3/archive/1.9.1.tar.gz', 'local':"urllib3-1.9.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, + 'PKGCONFIG': { 'setup': 'pkg-config', 'url':'pkg-config-0.28.tar.gz', 'local':"pkg-config-0.28.tar.gz", 'install': {'method': 'install_pkgconfig', 'option_str': None, 'dict_extra_env': None}}, + 'SQLITE': { 'setup': 'SQLITE', 'url':'sqlite-autoconf-3080701.tar.gz', 'local':"sqlite-autoconf-3080701.tar.gz", 'install': {'method': 'install_sqlite', 'option_str': None, 'dict_extra_env': None}}, + 'UNIXODBC': { 'setup': 'unixODBC', 'url':'unixODBC-2.3.2.tar.gz', 'local':"unixODBC-2.3.2.tar.gz", 'install': {'method': 'install_unixODBC', 'option_str': None, 'dict_extra_env': None}}, + 'RAPTOR2': { 'setup': 'raptor2', 'url':'raptor2-2.0.15.tar.gz', 'local':"raptor2-2.0.15.tar.gz", 'install': {'method': 'install_raptor2', 'option_str': None, 'dict_extra_env': None}}, + 'RASQAL': { 'setup': 'rasqal', 'url':'rasqal-0.9.32.tar.gz', 'local':"rasqal-0.9.32.tar.gz", 'install': {'method': 'install_rasqal', 'option_str': None, 'dict_extra_env': None}}, + 'REDLAND': { 'setup': 'redland', 'url':'redland-1.0.17.tar.gz', 'local':"redland-1.0.17.tar.gz", 'install': {'method': 'install_redland', 'option_str': None, 'dict_extra_env': None}}, + 'REDLAND_BINDINGS': { 'setup': 'redland_bindings', 'url':'redland-bindings-1.0.17.1.tar.gz', 'local':"redland-bindings-1.0.17.1.tar.gz", 'install': {'method': 'install_redland_bindings', 'option_str': None, 'dict_extra_env': None}}, } + + if system_str == 'Windows': URLS.update({ @@ -120,7 +129,16 @@ metavar='ignore_packages', dest='ignore_packages', default=None, - help='list of comma separated keys for package to ignore') + help='list of comma separated keys for package to ignore') + parser.add_option( + '--no-clear', + metavar='do not clear env', + dest='clear', + default=True, + action='store_false', + help='do not clear env') + + 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") @@ -137,7 +155,7 @@ -def gen_install_comp_lib(lib_name, lib_key, configure_options=[]): +def gen_install_comp_lib(lib_name, lib_key, configure_options=[], configure_env={}): 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") @@ -150,12 +168,26 @@ tf.close() lib_src_path = os.path.join(lib_base_path, os.listdir(lib_base_path)[0]) + + + context_map = { + 'option_str' : option_str, + 'home_dir': os.path.abspath(home_dir), + 'lib_dir': os.path.abspath(lib_dir), + 'tmp_dir': os.path.abspath(tmp_dir), + 'src_dir': os.path.abspath(src_dir), + } + + configure_options_trans = map(lambda s: s % context_map, configure_options) + configure_env_trans = {k: s % context_map for k,s in configure_env.items()} logger.notify(lib_name + " configure in " + lib_src_path) - call_subprocess(['./configure', '--prefix='+os.path.abspath(home_dir)] + configure_options, + call_subprocess(['./configure', '--prefix='+os.path.abspath(home_dir)] + configure_options_trans, cwd=os.path.abspath(lib_src_path), filter_stdout=filter_python_develop, - show_stdout=True) + show_stdout=True, + extra_env=configure_env_trans + ) logger.notify(lib_name + " make in " + lib_src_path) call_subprocess(['make'], @@ -170,8 +202,19 @@ show_stdout=True) return install_lib -install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared']) -install_zlib = gen_install_comp_lib("zlib", "ZLIB", []) +install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared'], {}) +install_zlib = gen_install_comp_lib("zlib", "ZLIB", [], {}) +install_pkgconfig = gen_install_comp_lib("pkg-config", "PKGCONFIG", ['--with-internal-glib'], {}) +install_sqlite = gen_install_comp_lib("sqlite", "SQLITE", [], {}) +install_unixODBC = gen_install_comp_lib("unixODBC", "UNIXODBC", ['--enable-gui=no'], {}) +redland_base_env = { + 'PKG_CONFIG': "%(home_dir)s/bin/pkg-config", + 'PKG_CONFIG_LIBDIR': "%(home_dir)s/lib/pkgconfig", +} +install_raptor2 = gen_install_comp_lib('raptor2', 'RAPTOR2', [], redland_base_env) +install_rasqal = gen_install_comp_lib('rasqal', "RASQAL", [], redland_base_env) +install_redland = gen_install_comp_lib('redland', 'REDLAND', [], dict(redland_base_env.items() + {'CFLAGS':'-I%(home_dir)s/include'}.items())) +install_redland_bindings = gen_install_comp_lib('redland-bindings', "REDLAND_BINDINGS", ['--with-python=%(home_dir)s/bin/python', '--with-python-ldflags=-L'+os.path.abspath(os.path.join(os.path.dirname(os.__file__),'..'))+' -lpython'+".".join(map(str,sys.version_info[0:2]))+' -Wl,-dylib'], redland_base_env) def install_pystemmer(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop): print "install PYSTEMMER from " + res_env.URLS['PYSTEMMER'][res_source_key] @@ -261,7 +304,7 @@ 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): @@ -347,10 +390,9 @@ def adjust_options(options, args): if not options_to_add: return - for opt in options_to_add: - test_opt = opt.split('=',1)[0] + for opt,opt_val in options_to_add.items(): #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) + setattr(options, opt, opt_val) return adjust_options, extend_parser, after_install