equal
deleted
inserted
replaced
1 """ |
1 """ |
2 Call this like ``python create_python_env.py``; it will |
2 Call this like ``python create_python_env.py``; it will |
3 refresh the blinkster-boot.py script |
3 refresh the project-boot.py script |
4 |
4 |
5 -prerequisite: |
5 -prerequisite: |
6 |
6 |
7 - virtualenv |
7 - virtualenv |
8 - distribute |
8 - distribute |
9 - psycopg2 requires the PostgreSQL libpq libraries and the pg_config utility |
9 - psycopg2 requires the PostgreSQL libpq libraries and the pg_config utility |
10 |
10 |
11 - virtualenv --distribute --no-site-packages venv |
11 - virtualenv --distribute --no-site-packages venv |
12 - python blinkster-boot.py --distribute --no-site-packages --index-url=http://pypi.websushi.org/ --clear bvenv |
12 - python project-boot.py --distribute --no-site-packages --index-url=http://pypi.websushi.org/ --clear bvenv |
13 |
13 |
14 """ |
14 """ |
15 |
15 |
16 import os |
16 import os |
17 import subprocess |
17 import subprocess |
19 import sys |
19 import sys |
20 |
20 |
21 |
21 |
22 here = os.path.dirname(os.path.abspath(__file__)) |
22 here = os.path.dirname(os.path.abspath(__file__)) |
23 base_dir = here |
23 base_dir = here |
24 script_name = os.path.join(base_dir, 'blinkster-boot.py') |
24 script_name = os.path.join(base_dir, 'project-boot.py') |
25 |
25 |
26 import virtualenv |
26 import virtualenv |
27 |
27 |
28 # things to install |
28 # things to install |
29 # - psycopg2 -> pip |
29 # - psycopg2 -> pip |
55 import shutil |
55 import shutil |
56 import tarfile |
56 import tarfile |
57 import urllib |
57 import urllib |
58 import platform |
58 import platform |
59 import patch |
59 import patch |
|
60 import zipfile |
|
61 from distutils.sysconfig import get_python_lib |
60 |
62 |
61 |
63 |
62 INDEX_URL = 'http://pypi.python.org/simple/' |
64 INDEX_URL = 'http://pypi.python.org/simple/' |
63 |
65 |
64 |
66 |
87 src_dir = join(home_dir, 'src') |
89 src_dir = join(home_dir, 'src') |
88 tmp_dir = join(home_dir, 'tmp') |
90 tmp_dir = join(home_dir, 'tmp') |
89 ensure_dir(src_dir) |
91 ensure_dir(src_dir) |
90 ensure_dir(tmp_dir) |
92 ensure_dir(tmp_dir) |
91 system_str = platform.system() |
93 system_str = platform.system() |
|
94 python_lib_dir = get_python_lib() |
92 |
95 |
93 res_source_key = options.type_install |
96 res_source_key = options.type_install |
94 |
97 |
95 logger.indent += 2 |
98 logger.indent += 2 |
96 try: |
99 try: |
111 #install jcc |
114 #install jcc |
112 |
115 |
113 #patch for linux |
116 #patch for linux |
114 if system_str == 'Linux' : |
117 if system_str == 'Linux' : |
115 olddir = os.getcwd() |
118 olddir = os.getcwd() |
116 patch_dest_path = os.path.join(lib_dir,'site-packages','setuptools-0.6c11-py'+'%s.%s' % (sys.version_info[0], sys.version_info[1])+'.egg') |
119 patch_dest_path = os.path.join(lib_dir, 'site-packages','setuptools-0.6c11-py'+'%s.%s' % (sys.version_info[0], sys.version_info[1])+'.egg') |
|
120 |
|
121 if os.path.isfile(patch_dest_path): |
|
122 # must unzip egg |
|
123 # rename file and etract all |
|
124 shutil.move(patch_dest_path, patch_dest_path + ".zip") |
|
125 zf = zipfile.ZipFile(patch_dest_path + ".zip",'r') |
|
126 zf.extractall(patch_dest_path) |
|
127 os.remove(patch_dest_path + ".zip") |
117 logger.notify("Patch jcc : %s " % (patch_dest_path)) |
128 logger.notify("Patch jcc : %s " % (patch_dest_path)) |
118 os.chdir(patch_dest_path) |
129 os.chdir(patch_dest_path) |
119 p = patch.fromfile(os.path.join(jcc_src_path,"jcc","patches","patch.43.0.6c11")) |
130 p = patch.fromfile(os.path.join(jcc_src_path,"jcc","patches","patch.43.0.6c11")) |
120 p.apply() |
131 p.apply() |
121 os.chdir(olddir) |
132 os.chdir(olddir) |
147 destination.write("NUM_FILES=2\\n") |
158 destination.write("NUM_FILES=2\\n") |
148 elif system_str == "Windows": |
159 elif system_str == "Windows": |
149 destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64 --arch i386\\n") |
160 destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64 --arch i386\\n") |
150 destination.write("NUM_FILES=2\\n") |
161 destination.write("NUM_FILES=2\\n") |
151 else: |
162 else: |
152 destination.write("JCC=$(PYTHON) -m jcc --shared\\n") |
163 if sys.version_info >= (2,6) and sys.version_info < (2,7): |
|
164 destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared\\n") |
|
165 else: |
|
166 destination.write("JCC=$(PYTHON) -m jcc --shared\\n") |
153 destination.write("NUM_FILES=2\\n") |
167 destination.write("NUM_FILES=2\\n") |
154 for line in source: |
168 for line in source: |
155 destination.write( line ) |
169 destination.write( line ) |
156 source.close() |
170 source.close() |
157 destination.close() |
171 destination.close() |