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.11.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.12.3.tar.gz', 'local':'paramiko-1.12.3.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, |
22 'PARAMIKO' : {'setup': 'paramiko', 'url':'https://github.com/paramiko/paramiko/archive/v1.15.1.tar.gz', 'local':'paramiko-1.15.1.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.10.0.tar.gz', 'local':'fabric-1.10.0.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-3.2.tar.gz', 'local':'mercurial-3.2.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, |
25 } |
25 } |
26 |
26 |
27 class ResourcesEnv(object): |
27 class ResourcesEnv(object): |
28 |
28 |
29 def __init__(self, src_base, run_base, urls, normal_installs): |
29 def __init__(self, src_base, run_base, urls, normal_installs): |
92 psycopg2_src_path = os.path.join(psycopg2_base_path, os.listdir(psycopg2_base_path)[0]) |
92 psycopg2_src_path = os.path.join(psycopg2_base_path, os.listdir(psycopg2_base_path)[0]) |
93 shutil.copytree(os.path.join(psycopg2_src_path, 'psycopg2'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'psycopg2'))) |
93 shutil.copytree(os.path.join(psycopg2_src_path, 'psycopg2'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'psycopg2'))) |
94 shutil.copy(os.path.join(psycopg2_src_path, 'psycopg2-2.4.5-py2.7.egg-info'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'site-packages'))) |
94 shutil.copy(os.path.join(psycopg2_src_path, 'psycopg2-2.4.5-py2.7.egg-info'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'site-packages'))) |
95 |
95 |
96 |
96 |
97 def install_mysql(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop): |
|
98 |
|
99 args = [os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', res_env.URLS['MYSQL'][res_source_key]] |
|
100 if option_str : |
|
101 args.insert(4,option_str) |
|
102 call_subprocess(args, |
|
103 cwd=os.path.abspath(tmp_dir), |
|
104 filter_stdout=filter_python_develop, |
|
105 show_stdout=True, |
|
106 extra_env=extra_env) |
|
107 |
|
108 mysqlconfig_output = [] |
|
109 |
|
110 call_subprocess(['mysql_config', '--libmysqld-libs'], |
|
111 cwd=os.path.abspath(tmp_dir), |
|
112 filter_stdout=lambda line: mysqlconfig_output.append(line), |
|
113 show_stdout=True) |
|
114 |
|
115 mysqlconfig_output = "".join(mysqlconfig_output) |
|
116 m = re.search("\-L[\'\"]?([\w\/]+)[\'\"]?", mysqlconfig_output) |
|
117 if m: |
|
118 repdylibpath = m.group(1) |
|
119 else: |
|
120 repdylibpath = '/usr/local/mysql/lib' |
|
121 |
|
122 dyliblist = glob.glob(repdylibpath+"/libmysqlclient.*.dylib") |
|
123 def key_func(s): |
|
124 m = re.match(repdylibpath+"/libmysqlclient\.([\d]+)\.dylib", s) |
|
125 if m: |
|
126 return int(m.group(1)) |
|
127 else: |
|
128 return sys.maxint |
|
129 dyliblist.sort(key=key_func) |
|
130 |
|
131 if dyliblist: |
|
132 dylibpath = dyliblist[0] |
|
133 else: |
|
134 dylibpath = '/usr/local/mysql/lib/libmysqlclient.18.dylib' |
|
135 |
|
136 dylibname = os.path.basename(dylibpath) |
|
137 sopath = os.path.join(os.path.abspath(lib_dir), 'site-packages', '_mysql.so') |
|
138 |
|
139 call_subprocess(['install_name_tool', '-change', dylibname, dylibpath, sopath], |
|
140 cwd=os.path.abspath(tmp_dir), |
|
141 filter_stdout=filter_python_develop, |
|
142 show_stdout=True) |
|
143 |
|
144 |
97 |
145 def gen_install_comp_lib(lib_name, lib_key, configure_options=[]): |
98 def gen_install_comp_lib(lib_name, lib_key, configure_options=[]): |
146 |
99 |
147 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): |
100 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): |
148 lib_src = os.path.join(src_dir,lib_name+".tar.gz") |
101 lib_src = os.path.join(src_dir,lib_name+".tar.gz") |
175 show_stdout=True) |
128 show_stdout=True) |
176 return install_lib |
129 return install_lib |
177 |
130 |
178 install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared']) |
131 install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared']) |
179 install_zlib = gen_install_comp_lib("zlib", "ZLIB", []) |
132 install_zlib = gen_install_comp_lib("zlib", "ZLIB", []) |
180 |
133 |
|
134 #osx_extra_env = {'ARCHFLAGS': '-Wno-error=unused-command-line-argument-hard-error-in-future', 'CFLAGS': '-Qunused-arguments', 'CPPFLAGS': '-Qunused-arguments'} |
|
135 osx_extra_env = {} |
181 |
136 |
182 def lib_generate_install_methods(path_locations, src_base, run_base, Logger, call_subprocess, normal_installs, options_to_add=None, urls= None): |
137 def lib_generate_install_methods(path_locations, src_base, run_base, Logger, call_subprocess, normal_installs, options_to_add=None, urls= None): |
183 |
138 |
184 all_urls = URLS.copy() |
139 all_urls = URLS.copy() |
185 if urls is not None: |
140 if urls is not None: |
306 extra_env = {} |
261 extra_env = {} |
307 |
262 |
308 if 'TMPDIR' not in extra_env: |
263 if 'TMPDIR' not in extra_env: |
309 extra_env['TMPDIR'] = os.path.abspath(tmp_dir) |
264 extra_env['TMPDIR'] = os.path.abspath(tmp_dir) |
310 if system_str == 'Darwin': |
265 if system_str == 'Darwin': |
311 archflags = extra_env.get('ARCHFLAGS', '') |
266 for flag_key, flag_value in iter(osx_extra_env.items()): |
312 if '-Wno-error=unused-command-line-argument-hard-error-in-future' not in archflags: |
267 flags = extra_env.get(flag_key, '') |
313 archflags += " -Wno-error=unused-command-line-argument-hard-error-in-future" |
268 if flag_value not in flags: |
314 extra_env['ARCHFLAGS'] = archflags.strip() |
269 #flags += " -Wno-error=unused-command-line-argument-hard-error-in-future" |
|
270 flags += " "+flag_value |
|
271 extra_env[flag_key] = flags.strip() |
|
272 |
315 #isinstance(lst, (list, tuple)) |
273 #isinstance(lst, (list, tuple)) |
316 if key not in ignore_packages: |
274 if key not in ignore_packages: |
317 logger.notify("install %s with method %s" % (key, repr(method))) |
275 logger.notify("install %s with method %s" % (key, repr(method))) |
318 if callable(method): |
276 if callable(method): |
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) |
277 method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop) |