39 'EASYTHUMBNAIL' : { 'setup': 'easy-thumbnail', 'url': 'https://github.com/SmileyChris/easy-thumbnails/archive/2.2.tar.gz', 'local' : 'easy-thumbnails-2.2.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, |
39 'EASYTHUMBNAIL' : { 'setup': 'easy-thumbnail', 'url': 'https://github.com/SmileyChris/easy-thumbnails/archive/2.2.tar.gz', 'local' : 'easy-thumbnails-2.2.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, |
40 'SIX' : { 'setup': 'six', 'url': 'https://pypi.python.org/packages/source/s/six/six-1.8.0.tar.gz', 'local' : 'six-1.8.0.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, |
40 'SIX' : { 'setup': 'six', 'url': 'https://pypi.python.org/packages/source/s/six/six-1.8.0.tar.gz', 'local' : 'six-1.8.0.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, |
41 '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}}, |
41 '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}}, |
42 '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}}, |
42 '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}}, |
43 '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}}, |
43 '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}}, |
|
44 '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}}, |
|
45 '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}}, |
|
46 '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}}, |
|
47 '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}}, |
|
48 '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}}, |
|
49 '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}}, |
|
50 '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}}, |
44 } |
51 } |
|
52 |
|
53 |
45 |
54 |
46 if system_str == 'Windows': |
55 if system_str == 'Windows': |
47 |
56 |
48 URLS.update({ |
57 URLS.update({ |
49 'PSYCOPG2': {'setup': 'psycopg2','url': 'psycopg2-2.0.14.win32-py2.6-pg8.4.3-release.zip', 'local':"psycopg2-2.0.14.win32-py2.6-pg8.4.3-release.zip", 'install': {'method': 'install_psycopg2', 'option_str': None, 'dict_extra_env': None}}, |
58 'PSYCOPG2': {'setup': 'psycopg2','url': 'psycopg2-2.0.14.win32-py2.6-pg8.4.3-release.zip', 'local':"psycopg2-2.0.14.win32-py2.6-pg8.4.3-release.zip", 'install': {'method': 'install_psycopg2', 'option_str': None, 'dict_extra_env': None}}, |
118 parser.add_option( |
127 parser.add_option( |
119 '--ignore-packages', |
128 '--ignore-packages', |
120 metavar='ignore_packages', |
129 metavar='ignore_packages', |
121 dest='ignore_packages', |
130 dest='ignore_packages', |
122 default=None, |
131 default=None, |
123 help='list of comma separated keys for package to ignore') |
132 help='list of comma separated keys for package to ignore') |
|
133 parser.add_option( |
|
134 '--no-clear', |
|
135 metavar='do not clear env', |
|
136 dest='clear', |
|
137 default=True, |
|
138 action='store_false', |
|
139 help='do not clear env') |
|
140 |
|
141 |
124 |
142 |
125 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): |
143 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): |
126 psycopg2_src = os.path.join(src_dir,"psycopg2.zip") |
144 psycopg2_src = os.path.join(src_dir,"psycopg2.zip") |
127 shutil.copy(res_env.URLS['PSYCOPG2'][res_source_key], psycopg2_src) |
145 shutil.copy(res_env.URLS['PSYCOPG2'][res_source_key], psycopg2_src) |
128 #extract psycopg2 |
146 #extract psycopg2 |
135 shutil.copytree(os.path.join(psycopg2_src_path, 'psycopg2'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'psycopg2'))) |
153 shutil.copytree(os.path.join(psycopg2_src_path, 'psycopg2'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'psycopg2'))) |
136 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'))) |
154 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'))) |
137 |
155 |
138 |
156 |
139 |
157 |
140 def gen_install_comp_lib(lib_name, lib_key, configure_options=[]): |
158 def gen_install_comp_lib(lib_name, lib_key, configure_options=[], configure_env={}): |
141 |
159 |
142 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): |
160 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): |
143 lib_src = os.path.join(src_dir,lib_name+".tar.gz") |
161 lib_src = os.path.join(src_dir,lib_name+".tar.gz") |
144 logger.notify("Copy %s to %s " % (res_env.URLS[lib_key][res_source_key],lib_src)) |
162 logger.notify("Copy %s to %s " % (res_env.URLS[lib_key][res_source_key],lib_src)) |
145 shutil.copy(res_env.URLS[lib_key][res_source_key], lib_src) |
163 shutil.copy(res_env.URLS[lib_key][res_source_key], lib_src) |
148 logger.notify("Extract %s to %s " % (lib_name,lib_base_path)) |
166 logger.notify("Extract %s to %s " % (lib_name,lib_base_path)) |
149 tf.extractall(lib_base_path) |
167 tf.extractall(lib_base_path) |
150 tf.close() |
168 tf.close() |
151 |
169 |
152 lib_src_path = os.path.join(lib_base_path, os.listdir(lib_base_path)[0]) |
170 lib_src_path = os.path.join(lib_base_path, os.listdir(lib_base_path)[0]) |
|
171 |
|
172 |
|
173 context_map = { |
|
174 'option_str' : option_str, |
|
175 'home_dir': os.path.abspath(home_dir), |
|
176 'lib_dir': os.path.abspath(lib_dir), |
|
177 'tmp_dir': os.path.abspath(tmp_dir), |
|
178 'src_dir': os.path.abspath(src_dir), |
|
179 } |
|
180 |
|
181 configure_options_trans = map(lambda s: s % context_map, configure_options) |
|
182 configure_env_trans = {k: s % context_map for k,s in configure_env.items()} |
153 |
183 |
154 logger.notify(lib_name + " configure in " + lib_src_path) |
184 logger.notify(lib_name + " configure in " + lib_src_path) |
155 call_subprocess(['./configure', '--prefix='+os.path.abspath(home_dir)] + configure_options, |
185 call_subprocess(['./configure', '--prefix='+os.path.abspath(home_dir)] + configure_options_trans, |
156 cwd=os.path.abspath(lib_src_path), |
186 cwd=os.path.abspath(lib_src_path), |
157 filter_stdout=filter_python_develop, |
187 filter_stdout=filter_python_develop, |
158 show_stdout=True) |
188 show_stdout=True, |
|
189 extra_env=configure_env_trans |
|
190 ) |
159 |
191 |
160 logger.notify(lib_name + " make in " + lib_src_path) |
192 logger.notify(lib_name + " make in " + lib_src_path) |
161 call_subprocess(['make'], |
193 call_subprocess(['make'], |
162 cwd=os.path.abspath(lib_src_path), |
194 cwd=os.path.abspath(lib_src_path), |
163 filter_stdout=filter_python_develop, |
195 filter_stdout=filter_python_develop, |
168 cwd=os.path.abspath(lib_src_path), |
200 cwd=os.path.abspath(lib_src_path), |
169 filter_stdout=filter_python_develop, |
201 filter_stdout=filter_python_develop, |
170 show_stdout=True) |
202 show_stdout=True) |
171 return install_lib |
203 return install_lib |
172 |
204 |
173 install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared']) |
205 install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared'], {}) |
174 install_zlib = gen_install_comp_lib("zlib", "ZLIB", []) |
206 install_zlib = gen_install_comp_lib("zlib", "ZLIB", [], {}) |
|
207 install_pkgconfig = gen_install_comp_lib("pkg-config", "PKGCONFIG", ['--with-internal-glib'], {}) |
|
208 install_sqlite = gen_install_comp_lib("sqlite", "SQLITE", [], {}) |
|
209 install_unixODBC = gen_install_comp_lib("unixODBC", "UNIXODBC", ['--enable-gui=no'], {}) |
|
210 redland_base_env = { |
|
211 'PKG_CONFIG': "%(home_dir)s/bin/pkg-config", |
|
212 'PKG_CONFIG_LIBDIR': "%(home_dir)s/lib/pkgconfig", |
|
213 } |
|
214 install_raptor2 = gen_install_comp_lib('raptor2', 'RAPTOR2', [], redland_base_env) |
|
215 install_rasqal = gen_install_comp_lib('rasqal', "RASQAL", [], redland_base_env) |
|
216 install_redland = gen_install_comp_lib('redland', 'REDLAND', [], dict(redland_base_env.items() + {'CFLAGS':'-I%(home_dir)s/include'}.items())) |
|
217 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) |
175 |
218 |
176 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): |
219 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): |
177 print "install PYSTEMMER from " + res_env.URLS['PYSTEMMER'][res_source_key] |
220 print "install PYSTEMMER from " + res_env.URLS['PYSTEMMER'][res_source_key] |
178 pystemmer_src = os.path.join(src_dir,"pystemmer.zip") |
221 pystemmer_src = os.path.join(src_dir,"pystemmer.zip") |
179 shutil.copy(res_env.URLS['PYSTEMMER'][res_source_key], pystemmer_src) |
222 shutil.copy(res_env.URLS['PYSTEMMER'][res_source_key], pystemmer_src) |
345 % join(script_dir, 'easy_install')) |
388 % join(script_dir, 'easy_install')) |
346 |
389 |
347 def adjust_options(options, args): |
390 def adjust_options(options, args): |
348 if not options_to_add: |
391 if not options_to_add: |
349 return |
392 return |
350 for opt in options_to_add: |
393 for opt,opt_val in options_to_add.items(): |
351 test_opt = opt.split('=',1)[0] |
|
352 #if not hasattr(options,test_opt) or getattr(options, test_opt) is None: |
394 #if not hasattr(options,test_opt) or getattr(options, test_opt) is None: |
353 setattr(options, test_opt,opt.split('=',1)[1] if "=" in opt else True) |
395 setattr(options, opt, opt_val) |
354 |
396 |
355 return adjust_options, extend_parser, after_install |
397 return adjust_options, extend_parser, after_install |
356 |
398 |