134 |
135 |
135 def gen_install_comp_lib(lib_name, lib_key, configure_options=[]): |
136 def gen_install_comp_lib(lib_name, lib_key, configure_options=[]): |
136 |
137 |
137 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): |
138 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): |
138 lib_src = os.path.join(src_dir,lib_name+".tar.gz") |
139 lib_src = os.path.join(src_dir,lib_name+".tar.gz") |
|
140 logger.notify("Copy %s to %s " % (res_env.URLS[lib_key][res_source_key],lib_src)) |
139 shutil.copy(res_env.URLS[lib_key][res_source_key], lib_src) |
141 shutil.copy(res_env.URLS[lib_key][res_source_key], lib_src) |
140 tf = tarfile.open(lib_src,'r:gz') |
142 tf = tarfile.open(lib_src,'r:gz') |
141 lib_base_path = os.path.join(src_dir, lib_name) |
143 lib_base_path = os.path.join(src_dir, lib_name) |
142 logger.notify("Extract %s to %s " % (lib_name,lib_base_path)) |
144 logger.notify("Extract %s to %s " % (lib_name,lib_base_path)) |
143 tf.extractall(lib_base_path) |
145 tf.extractall(lib_base_path) |
144 tf.close() |
146 tf.close() |
145 |
147 |
146 lib_src_path = os.path.join(lib_base_path, os.listdir(lib_base_path)[0]) |
148 lib_src_path = os.path.join(lib_base_path, os.listdir(lib_base_path)[0]) |
147 |
149 |
148 logger.notify(libname + " configure") |
150 logger.notify(lib_name + " configure in " + lib_src_path) |
149 call_subprocess(['configure', '--prefix='+os.path.abspath(home_dir)] + configure_options, |
151 call_subprocess(['./configure', '--prefix='+os.path.abspath(home_dir)] + configure_options, |
150 cwd=os.path.abspath(lib_src_path), |
152 cwd=os.path.abspath(lib_src_path), |
151 filter_stdout=filter_python_develop, |
153 filter_stdout=filter_python_develop, |
152 show_stdout=True) |
154 show_stdout=True) |
153 |
155 |
154 logger.notify(libname + " make") |
156 logger.notify(lib_name + " make in " + lib_src_path) |
155 call_subprocess(['make'], |
157 call_subprocess(['make'], |
156 cwd=os.path.abspath(lib_src_path), |
158 cwd=os.path.abspath(lib_src_path), |
157 filter_stdout=filter_python_develop, |
159 filter_stdout=filter_python_develop, |
158 show_stdout=True) |
160 show_stdout=True) |
159 |
161 |
160 logger.notify(libname + "make install") |
162 logger.notify(lib_name + "make install in " + lib_src_path) |
161 call_subprocess(['make', 'install'], |
163 call_subprocess(['make', 'install'], |
162 cwd=os.path.abspath(lib_src_path), |
164 cwd=os.path.abspath(lib_src_path), |
163 filter_stdout=filter_python_develop, |
165 filter_stdout=filter_python_develop, |
164 show_stdout=True) |
166 show_stdout=True) |
165 return install_lib |
167 return install_lib |
166 |
168 |
167 install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared']) |
169 install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared']) |
168 install_zlib = gen_install_comp_lib("zlib", "ZLIB", []) |
170 install_zlib = gen_install_comp_lib("zlib", "ZLIB", []) |
169 |
|
170 |
|
171 |
|
172 |
171 |
173 |
172 |
174 def lib_generate_install_methods(path_locations, src_base, Logger, call_subprocess, normal_installs, options_to_add=None, urls= None): |
173 def lib_generate_install_methods(path_locations, src_base, Logger, call_subprocess, normal_installs, options_to_add=None, urls= None): |
175 |
174 |
176 all_urls = URLS.copy() |
175 all_urls = URLS.copy() |
257 if install_options is None: |
256 if install_options is None: |
258 install_options = default_install_options |
257 install_options = default_install_options |
259 method = install_options.get('method', default_install_options['method']) |
258 method = install_options.get('method', default_install_options['method']) |
260 option_str = install_options.get('option_str', default_install_options['option_str']) |
259 option_str = install_options.get('option_str', default_install_options['option_str']) |
261 extra_env = install_options.get('dict_extra_env', default_install_options['dict_extra_env']) |
260 extra_env = install_options.get('dict_extra_env', default_install_options['dict_extra_env']) |
|
261 if not extra_env: |
|
262 extra_env = {} |
|
263 |
|
264 if 'TMPDIR' not in extra_env: |
|
265 extra_env['TMPDIR'] = os.path.abspath(tmp_dir) |
262 #isinstance(lst, (list, tuple)) |
266 #isinstance(lst, (list, tuple)) |
263 if key not in ignore_packages: |
267 if key not in ignore_packages: |
|
268 logger.notify("install %s with method %s" % (key, repr(method))) |
264 if callable(method): |
269 if callable(method): |
265 method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop) |
270 method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop) |
266 elif method in globals() and callable(globals()[method]) and method not in ['pip', 'easy_install']: |
271 elif method in globals() and callable(globals()[method]) and method not in ['pip', 'easy_install']: |
267 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) |
272 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) |
268 else: |
273 else: |