| author | ymh <ymh.work@gmail.com> |
| Sat, 25 Jan 2020 02:22:57 +0100 | |
| changeset 98 | a14feef87fd7 |
| parent 93 | 7b6bcc33783f |
| child 100 | 5fd5b4e7ae34 |
| permissions | -rw-r--r-- |
| 16 | 1 |
import sys |
2 |
import os |
|
3 |
import os.path |
|
4 |
import shutil |
|
5 |
import tarfile |
|
6 |
import zipfile |
|
7 |
import urllib |
|
8 |
import platform |
|
9 |
import patch |
|
10 |
||
11 |
join = os.path.join |
|
12 |
system_str = platform.system() |
|
13 |
||
14 |
||
15 |
URLS = { |
|
16 |
#'': {'setup': '', 'url':'', 'local':''}, |
|
17 |
'DISTRIBUTE': {'setup': 'distribute', 'url':'http://pypi.python.org/packages/source/d/distribute/distribute-0.6.14.tar.gz', 'local':"distribute-0.6.14.tar.gz"}, |
|
18 |
'DJANGO': {'setup': 'django', 'url': 'http://www.djangoproject.com/download/1.4/tarball/', 'local':"Django-1.4.tar.gz"}, |
|
19 |
'DJANGO-EXTENSIONS': { 'setup': 'django-extensions', 'url':'https://github.com/django-extensions/django-extensions/tarball/0.8', 'local':"django-extensions-0.8.tar.gz"}, |
|
20 |
'DJANGO-REGISTRATION': { 'setup': 'django-registration', 'url':'https://bitbucket.org/ubernostrum/django-registration/get/v0.8.tar.gz', 'local':"django-registration-0.8.tar.gz"}, |
|
21 |
'DJANGO-TAGGING': { 'setup': 'django-tagging', 'url':'http://django-tagging.googlecode.com/files/django-tagging-0.3.1.tar.gz', 'local':"django-tagging-0.3.1.tar.gz"}, |
|
| 23 | 22 |
'DJANGO-PISTON': { 'setup': 'django-piston', 'url':'django-piston-7c90898072ce-modifed.tar.gz', 'local':'django-piston-7c90898072ce-modifed.tar.gz'}, |
| 16 | 23 |
'OAUTH2': { 'setup': 'python-oauth2', 'url':"https://github.com/simplegeo/python-oauth2/tarball/hudson-python-oauth2-211", 'local':"oauth2-1.5.211.tar.gz"}, |
24 |
'HTTPLIB2': { 'setup': 'python-httplib2', 'url':'http://code.google.com/p/httplib2/downloads/detail?name=httplib2-0.7.4.tar.gz&can=2&q=', 'local':"httplib2-0.7.4.tar.gz"}, |
|
25 |
'DJANGO-OAUTH-PLUS': { 'setup': 'django-oauth-plus', 'url':'http://bitbucket.org/david/django-oauth-plus/get/f314f018e473.gz', 'local':"django-oauth-plus.tar.gz"}, |
|
26 |
'MYSQL': { 'setup': 'mysql-python', 'url': 'http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download', 'local':"MySQL-python-1.2.3.tar.gz"}, |
|
27 |
'OPENID': {'setup':'openid', 'url':'http://pypi.python.org/packages/source/p/python-openid/python-openid-2.2.5.tar.gz', 'local':"python-openid-2.2.5.tar.gz"}, |
|
28 |
'DJANGO_OPENID_CONSUMER': {'setup':'django_openid_consumer', 'url':'http://pypi.python.org/packages/source/d/django-openid-consumer/django-openid-consumer-0.1.1.tar.gz', 'local':"django-openid-consumer-0.1.1.tar.gz"}, |
|
| 93 | 29 |
'SETUPTOOLS-HG': {'setup':'setuptools_hg', 'url':'https://bitbucket.org/jezdez/setuptools_hg/get/v0.4.tar.gz', 'local':"setuptools_hg-0.4.tar.gz"}, |
| 16 | 30 |
'SOCIAL_AUTH': {'setup':'social_auth', 'url':'https://github.com/omab/django-social-auth/tarball/v0.3.10', 'local':"omab-django-social-auth-v0.3.10-modified.tar.gz"}, |
31 |
'SOUTH': { 'setup': 'South', 'url':'http://www.aeracode.org/releases/south/south-0.7.5.tar.gz', 'local':"south-0.7.5.tar.gz"}, |
|
32 |
'DJANGO_GUARDIAN' : { 'setup': 'django-guardian', 'url':'http://pypi.python.org/packages/source/d/django-guardian/django-guardian-1.0.3.tar.gz', 'local':"django-guardian-1.0.3.tar.gz"}, |
|
33 |
'SORL_THUMBNAIL' : { 'setup': 'sorl-thumbnail', 'url':'http://pypi.python.org/packages/source/s/sorl-thumbnail/sorl-thumbnail-11.12.tar.gz', 'local':"sorl-thumbnail-v10.12.1.tar.gz"}, |
|
34 |
'LIBJPEG': {'setup': None, 'url':'jpegsrc.v8d.tar.gz', 'local':'jpegsrc.v8d.tar.gz'}, |
|
35 |
'ZLIB': {'setup': None, 'url':'zlib-1.2.7.tar.gz', 'local':'zlib-1.2.7.tar.gz'}, |
|
36 |
'PYCRYPTO': {'setup': 'pycrypto', 'url':'https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.tar.gz', 'local':'pycrypto-2.6.tar.gz'}, |
|
37 |
'SSH': {'setup': 'ssh', 'url':'http://pypi.python.org/packages/source/s/ssh/ssh-1.7.14.tar.gz#md5=4cdd0549ef4699bd67b96264d3b21427', 'local':'ssh-1.7.14.tar.gz'}, |
|
38 |
'FABRIC': {'setup': 'fabric', 'url':'https://github.com/fabric/fabric/tarball/1.4.2', 'local':'fabric-1.4.2.tar.gz'}, |
|
39 |
'MERCURIAL': {'setup': 'mercurial', 'url':'http://mercurial.selenic.com/release/mercurial-2.2.2.tar.gz', 'local':'mercurial-2.2.2.tar.gz'}, |
|
|
76
b86783a14698
update platform, remove dep on pytz
ymh <ymh.work@gmail.com>
parents:
64
diff
changeset
|
40 |
'LDT': {'setup':None, 'url':'ldt-1.11.tar.gz', 'local':'ldt-1.11.tar.gz'}, |
| 16 | 41 |
} |
42 |
||
43 |
if system_str == 'Windows': |
|
44 |
URLS.update({ |
|
45 |
'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"}, |
|
46 |
'JCC': {'setup': 'jcc', 'url': 'http://pylucene-win32-binary.googlecode.com/files/JCC-2.6-py2.6-win32.egg', 'local':"JCC-2.6-py2.6-win32.egg"}, |
|
47 |
'PYLUCENE': {'setup': 'pylucene', 'url': 'http://pylucene-win32-binary.googlecode.com/files/lucene-3.0.2-py2.6-win32.egg', 'local':"lucene-3.0.2-py2.6-win32.egg"}, |
|
48 |
'PIL': {'setup': 'pil', 'url': 'http://effbot.org/media/downloads/PIL-1.1.7.win32-py2.6.exe', 'local':"PIL-1.1.7.win32-py2.6.exe"}, |
|
49 |
'LXML': {'setup': 'lxml', 'url': 'http://pypi.python.org/packages/2.6/l/lxml/lxml-2.2.2-py2.6-win32.egg', 'local':"lxml-2.2.2-py2.6-win32.egg"} |
|
50 |
}) |
|
51 |
else: |
|
52 |
URLS.update({ |
|
|
98
a14feef87fd7
increment version and upgrade librairies
ymh <ymh.work@gmail.com>
parents:
93
diff
changeset
|
53 |
'PSYCOPG2': {'setup': 'psycopg2','url': 'http://initd.org/psycopg/tarballs/PSYCOPG-2-8/psycopg2-2.8.4.tar.gz', 'local':"psycopg2-2.8.4.tar.gz"}, |
| 16 | 54 |
'PYLUCENE': {'setup': 'pylucene', 'url': 'http://mirrors.ircam.fr/pub/apache/lucene/pylucene/pylucene-3.6.0-2-src.tar.gz', 'local':"pylucene-3.6.0-2-src.tar.gz"}, |
55 |
'PIL': {'setup': 'pil', 'url': 'http://effbot.org/downloads/Imaging-1.1.7.tar.gz', 'local':"Imaging-1.1.7.tar.gz"}, |
|
|
98
a14feef87fd7
increment version and upgrade librairies
ymh <ymh.work@gmail.com>
parents:
93
diff
changeset
|
56 |
'LXML': {'setup': 'lxml', 'url':"lxml-4.4.2.tar.gz", 'local':"lxml-4.4.2.tar.gz"} |
| 16 | 57 |
}) |
58 |
||
59 |
||
60 |
||
61 |
class ResourcesEnv(object): |
|
62 |
||
63 |
def __init__(self, src_base, urls, normal_installs): |
|
64 |
self.src_base = src_base |
|
65 |
self.URLS = {} |
|
66 |
self.__init_url(urls) |
|
67 |
self.NORMAL_INSTALL = normal_installs |
|
68 |
||
69 |
def get_src_base_path(self, fpath): |
|
70 |
return os.path.abspath(os.path.join(self.src_base, fpath)).replace("\\","/") |
|
| 93 | 71 |
|
| 16 | 72 |
def __add_package_def(self, key, setup, url, local): |
73 |
self.URLS[key] = {'setup':setup, 'url':url, 'local':self.get_src_base_path(local)} |
|
74 |
||
75 |
def __init_url(self, urls): |
|
76 |
for key, url_dict in urls.items(): |
|
77 |
url = url_dict['url'] |
|
78 |
if not url.startswith("http://"): |
|
79 |
url = self.get_src_base_path(url) |
|
80 |
self.__add_package_def(key, url_dict["setup"], url, url_dict["local"]) |
|
81 |
||
82 |
def ensure_dir(dir, logger): |
|
83 |
if not os.path.exists(dir): |
|
84 |
logger.notify('Creating directory %s' % dir) |
|
85 |
os.makedirs(dir) |
|
86 |
||
| 93 | 87 |
def extend_parser(parser): |
| 16 | 88 |
parser.add_option( |
89 |
'--index-url', |
|
90 |
metavar='INDEX_URL', |
|
91 |
dest='index_url', |
|
92 |
default='http://pypi.python.org/simple/', |
|
93 |
help='base URL of Python Package Index') |
|
94 |
parser.add_option( |
|
95 |
'--type-install', |
|
96 |
metavar='type_install', |
|
97 |
dest='type_install', |
|
98 |
default='local', |
|
99 |
help='type install : local, url, setup') |
|
100 |
parser.add_option( |
|
101 |
'--ignore-packages', |
|
102 |
metavar='ignore_packages', |
|
103 |
dest='ignore_packages', |
|
104 |
default=None, |
|
105 |
help='list of comma separated keys for package to ignore') |
|
106 |
||
107 |
def adjust_options(options, args): |
|
108 |
pass |
|
109 |
||
110 |
||
111 |
def install_pylucene(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop): |
|
| 93 | 112 |
|
| 16 | 113 |
logger.notify("Get Pylucene from %s " % res_env.URLS['PYLUCENE'][res_source_key]) |
114 |
pylucene_src = os.path.join(src_dir,"pylucene.tar.gz") |
|
115 |
if res_source_key == 'local': |
|
116 |
shutil.copy(res_env.URLS['PYLUCENE'][res_source_key], pylucene_src) |
|
117 |
else: |
|
118 |
urllib.urlretrieve(res_env.URLS['PYLUCENE'][res_source_key], pylucene_src) |
|
119 |
tf = tarfile.open(pylucene_src,'r:gz') |
|
| 93 | 120 |
pylucene_base_path = os.path.join(src_dir,"pylucene") |
| 16 | 121 |
logger.notify("Extract Pylucene to %s " % pylucene_base_path) |
122 |
tf.extractall(pylucene_base_path) |
|
123 |
tf.close() |
|
| 93 | 124 |
|
| 16 | 125 |
pylucene_src_path = os.path.join(pylucene_base_path, os.listdir(pylucene_base_path)[0]) |
126 |
jcc_src_path = os.path.abspath(os.path.join(pylucene_src_path,"jcc")) |
|
| 93 | 127 |
|
| 16 | 128 |
#install jcc |
129 |
||
130 |
#patch for linux |
|
131 |
if system_str == 'Linux' : |
|
132 |
olddir = os.getcwd() |
|
133 |
setuptools_path = os.path.join(lib_dir, 'site-packages', 'setuptools') |
|
134 |
if os.path.exists(setuptools_path) and os.path.isdir(setuptools_path): |
|
135 |
patch_dest_path = os.path.join(lib_dir, 'site-packages') |
|
136 |
else: |
|
|
91
86694f53cf8c
quick and dirty hack to build pylucene
ymh <ymh.work@gmail.com>
parents:
87
diff
changeset
|
137 |
patch_dest_path = os.path.join(lib_dir,'site-packages','setuptools-0.6c11-py%s.%s.egg' % (sys.version_info[0], sys.version_info[1])) |
| 16 | 138 |
if os.path.isfile(patch_dest_path): |
139 |
# must unzip egg |
|
140 |
# rename file and etract all |
|
141 |
shutil.move(patch_dest_path, patch_dest_path + ".zip") |
|
142 |
zf = zipfile.ZipFile(patch_dest_path + ".zip",'r') |
|
143 |
zf.extractall(patch_dest_path) |
|
144 |
os.remove(patch_dest_path + ".zip") |
|
145 |
logger.notify("Patch jcc : %s " % (patch_dest_path)) |
|
146 |
os.chdir(patch_dest_path) |
|
|
91
86694f53cf8c
quick and dirty hack to build pylucene
ymh <ymh.work@gmail.com>
parents:
87
diff
changeset
|
147 |
p = patch.fromfile(os.path.join(jcc_src_path,"jcc","patches","patch.43.0.6c11")) |
| 16 | 148 |
p.apply() |
149 |
os.chdir(olddir) |
|
150 |
||
151 |
logger.notify("Install jcc") |
|
152 |
call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'python')), 'setup.py', 'install'], |
|
153 |
cwd=jcc_src_path, |
|
154 |
filter_stdout=filter_python_develop, |
|
|
91
86694f53cf8c
quick and dirty hack to build pylucene
ymh <ymh.work@gmail.com>
parents:
87
diff
changeset
|
155 |
show_stdout=True, |
|
86694f53cf8c
quick and dirty hack to build pylucene
ymh <ymh.work@gmail.com>
parents:
87
diff
changeset
|
156 |
extra_env={'JCC_JDK' : '/usr/lib/jvm/java-7-openjdk-i386/'}) |
| 16 | 157 |
#install pylucene |
| 93 | 158 |
|
| 16 | 159 |
logger.notify("Install pylucene") |
160 |
#modify makefile |
|
161 |
makefile_path = os.path.join(pylucene_src_path,"Makefile") |
|
162 |
logger.notify("Modify makefile %s " % makefile_path) |
|
163 |
shutil.move( makefile_path, makefile_path+"~" ) |
|
164 |
||
165 |
destination= open( makefile_path, "w" ) |
|
166 |
source= open( makefile_path+"~", "r" ) |
|
167 |
destination.write("PREFIX_PYTHON="+os.path.abspath(home_dir)+"\n") |
|
168 |
destination.write("ANT=ant\n") |
|
169 |
destination.write("PYTHON=$(PREFIX_PYTHON)/bin/python\n") |
|
| 93 | 170 |
|
| 16 | 171 |
if system_str == "Darwin": |
172 |
if sys.version_info >= (2,6): |
|
173 |
destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64 --arch i386\n") |
|
174 |
else: |
|
175 |
destination.write("JCC=$(PYTHON) -m jcc --shared --arch x86_64 --arch i386\n") |
|
176 |
destination.write("NUM_FILES=2\n") |
|
177 |
elif system_str == "Windows": |
|
178 |
destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64 --arch i386\n") |
|
179 |
destination.write("NUM_FILES=2\n") |
|
180 |
else: |
|
181 |
if sys.version_info >= (2,6) and sys.version_info <= (2,7): |
|
182 |
destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared\n") |
|
183 |
else: |
|
184 |
destination.write("JCC=$(PYTHON) -m jcc --shared\n") |
|
185 |
destination.write("NUM_FILES=2\n") |
|
186 |
for line in source: |
|
187 |
destination.write( line ) |
|
188 |
source.close() |
|
189 |
destination.close() |
|
190 |
os.remove(makefile_path+"~" ) |
|
191 |
||
192 |
logger.notify("pylucene make") |
|
193 |
call_subprocess(['make'], |
|
194 |
cwd=os.path.abspath(pylucene_src_path), |
|
195 |
filter_stdout=filter_python_develop, |
|
|
91
86694f53cf8c
quick and dirty hack to build pylucene
ymh <ymh.work@gmail.com>
parents:
87
diff
changeset
|
196 |
show_stdout=True, |
|
86694f53cf8c
quick and dirty hack to build pylucene
ymh <ymh.work@gmail.com>
parents:
87
diff
changeset
|
197 |
extra_env={'JCC_JDK' : '/usr/lib/jvm/java-7-openjdk-i386/'}) |
| 16 | 198 |
|
199 |
logger.notify("pylucene make install") |
|
200 |
call_subprocess(['make', 'install'], |
|
201 |
cwd=os.path.abspath(pylucene_src_path), |
|
202 |
filter_stdout=filter_python_develop, |
|
|
91
86694f53cf8c
quick and dirty hack to build pylucene
ymh <ymh.work@gmail.com>
parents:
87
diff
changeset
|
203 |
show_stdout=True, |
|
86694f53cf8c
quick and dirty hack to build pylucene
ymh <ymh.work@gmail.com>
parents:
87
diff
changeset
|
204 |
extra_env={'JCC_JDK' : '/usr/lib/jvm/java-7-openjdk-i386/'}) |
| 93 | 205 |
|
| 16 | 206 |
|
207 |
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): |
|
208 |
psycopg2_src = os.path.join(src_dir,"psycopg2.zip") |
|
209 |
shutil.copy(res_env.URLS['PSYCOPG2'][res_source_key], psycopg2_src) |
|
210 |
#extract psycopg2 |
|
211 |
zf = zipfile.ZipFile(psycopg2_src) |
|
212 |
psycopg2_base_path = os.path.join(src_dir,"psycopg2") |
|
213 |
zf.extractall(psycopg2_base_path) |
|
214 |
zf.close() |
|
| 93 | 215 |
|
| 16 | 216 |
psycopg2_src_path = os.path.join(psycopg2_base_path, os.listdir(psycopg2_base_path)[0]) |
217 |
shutil.copytree(os.path.join(psycopg2_src_path, 'psycopg2'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'psycopg2'))) |
|
218 |
shutil.copy(os.path.join(psycopg2_src_path, 'psycopg2-2.0.14-py2.6.egg-info'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'site-packages'))) |
|
219 |
||
220 |
def gen_install_comp_lib(lib_name, lib_key, configure_options=[]): |
|
| 93 | 221 |
|
| 16 | 222 |
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): |
223 |
lib_src = os.path.join(src_dir,lib_name+".tar.gz") |
|
224 |
shutil.copy(res_env.URLS[lib_key][res_source_key], lib_src) |
|
225 |
tf = tarfile.open(lib_src,'r:gz') |
|
| 93 | 226 |
lib_base_path = os.path.join(src_dir, lib_name) |
| 16 | 227 |
logger.notify("Extract %s to %s " % (lib_name,lib_base_path)) |
228 |
tf.extractall(lib_base_path) |
|
229 |
tf.close() |
|
| 93 | 230 |
|
| 16 | 231 |
lib_src_path = os.path.join(lib_base_path, os.listdir(lib_base_path)[0]) |
| 93 | 232 |
|
| 16 | 233 |
logger.notify("libjpeg configure") |
234 |
call_subprocess(['configure', '--prefix='+os.path.abspath(home_dir)] + configure_options, |
|
235 |
cwd=os.path.abspath(lib_src_path), |
|
236 |
filter_stdout=filter_python_develop, |
|
237 |
show_stdout=True) |
|
| 93 | 238 |
|
| 16 | 239 |
logger.notify("libjpeg make") |
240 |
call_subprocess(['make'], |
|
241 |
cwd=os.path.abspath(lib_src_path), |
|
242 |
filter_stdout=filter_python_develop, |
|
243 |
show_stdout=True) |
|
| 93 | 244 |
|
| 16 | 245 |
logger.notify("zlib make install") |
246 |
call_subprocess(['make', 'install'], |
|
247 |
cwd=os.path.abspath(lib_src_path), |
|
248 |
filter_stdout=filter_python_develop, |
|
249 |
show_stdout=True) |
|
250 |
return install_lib |
|
251 |
||
252 |
install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared']) |
|
253 |
install_zlib = gen_install_comp_lib("zlib", "ZLIB", []) |
|
254 |
||
255 |
||
| 93 | 256 |
|
257 |
||
| 16 | 258 |
|
259 |
def lib_generate_install_methods(path_locations, src_base, Logger, call_subprocess, normal_installs, urls=None): |
|
| 93 | 260 |
|
| 16 | 261 |
all_urls = URLS.copy() |
262 |
if urls is not None: |
|
263 |
all_urls.update(urls) |
|
| 93 | 264 |
|
| 16 | 265 |
res_env = ResourcesEnv(src_base, all_urls, normal_installs) |
266 |
||
267 |
def filter_python_develop(line): |
|
268 |
if not line.strip(): |
|
269 |
return Logger.DEBUG |
|
270 |
for prefix in ['Searching for', 'Reading ', 'Best match: ', 'Processing ', |
|
271 |
'Moving ', 'Adding ', 'running ', 'writing ', 'Creating ', |
|
272 |
'creating ', 'Copying ']: |
|
273 |
if line.startswith(prefix): |
|
274 |
return Logger.DEBUG |
|
275 |
return Logger.NOTIFY |
|
| 93 | 276 |
|
277 |
||
| 16 | 278 |
def normal_install(key, method, option_str, extra_env, res_source_key, home_dir, tmp_dir, res_env, logger, call_subprocess): |
279 |
logger.notify("Install %s from %s with %s" % (key,res_env.URLS[key][res_source_key],method)) |
|
280 |
if method == 'pip': |
|
281 |
if sys.platform == 'win32': |
|
282 |
args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'pip')), 'install', res_env.URLS[key][res_source_key]] |
|
283 |
else: |
|
284 |
args = [os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', res_env.URLS[key][res_source_key]] |
|
285 |
if option_str : |
|
286 |
args.insert(4,option_str) |
|
287 |
call_subprocess(args, |
|
288 |
cwd=os.path.abspath(tmp_dir), |
|
289 |
filter_stdout=filter_python_develop, |
|
290 |
show_stdout=True, |
|
291 |
extra_env=extra_env) |
|
292 |
else: |
|
293 |
if sys.platform == 'win32': |
|
294 |
args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'easy_install')), res_env.URLS[key][res_source_key]] |
|
295 |
else: |
|
296 |
args = [os.path.abspath(os.path.join(home_dir, 'bin', 'easy_install')), res_env.URLS[key][res_source_key]] |
|
297 |
if option_str : |
|
298 |
args.insert(1,option_str) |
|
299 |
call_subprocess(args, |
|
300 |
cwd=os.path.abspath(tmp_dir), |
|
301 |
filter_stdout=filter_python_develop, |
|
302 |
show_stdout=True, |
|
| 93 | 303 |
extra_env=extra_env) |
304 |
||
305 |
||
| 16 | 306 |
def after_install(options, home_dir): |
| 93 | 307 |
|
| 16 | 308 |
global logger |
| 93 | 309 |
|
| 16 | 310 |
verbosity = options.verbose - options.quiet |
311 |
logger = Logger([(Logger.level_for_integer(2-verbosity), sys.stdout)]) |
|
312 |
||
| 93 | 313 |
|
| 16 | 314 |
home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir) |
315 |
base_dir = os.path.dirname(home_dir) |
|
316 |
src_dir = os.path.join(home_dir, 'src') |
|
317 |
tmp_dir = os.path.join(home_dir, 'tmp') |
|
318 |
ensure_dir(src_dir, logger) |
|
319 |
ensure_dir(tmp_dir, logger) |
|
320 |
system_str = platform.system() |
|
| 93 | 321 |
|
| 16 | 322 |
res_source_key = options.type_install |
| 93 | 323 |
|
| 16 | 324 |
ignore_packages = [] |
| 93 | 325 |
|
| 16 | 326 |
if options.ignore_packages : |
327 |
ignore_packages = options.ignore_packages.split(",") |
|
| 93 | 328 |
|
| 16 | 329 |
logger.indent += 2 |
| 93 | 330 |
try: |
| 16 | 331 |
for key, method, option_str, extra_env in res_env.NORMAL_INSTALL: |
332 |
if key not in ignore_packages: |
|
333 |
if callable(method): |
|
334 |
method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop) |
|
335 |
else: |
|
336 |
normal_install(key, method, option_str, extra_env, res_source_key, home_dir, tmp_dir, res_env, logger, call_subprocess) |
|
| 93 | 337 |
|
| 16 | 338 |
logger.notify("Clear source dir") |
339 |
shutil.rmtree(src_dir) |
|
| 93 | 340 |
|
| 16 | 341 |
finally: |
342 |
logger.indent -= 2 |
|
343 |
script_dir = join(base_dir, bin_dir) |
|
344 |
logger.notify('Run "%s Package" to install new packages that provide builds' |
|
345 |
% join(script_dir, 'easy_install')) |
|
| 93 | 346 |
|
| 16 | 347 |
|
348 |
return adjust_options, extend_parser, after_install |