author | ymh <ymh.work@gmail.com> |
Tue, 12 May 2015 14:57:27 +0200 | |
changeset 244 | 4f07ad576fee |
parent 0 | 87104b7cb3d6 |
permissions | -rw-r--r-- |
0 | 1 |
""" |
2 |
Call this like ``python create_python_env.py``; it will |
|
3 |
refresh the project-boot.py script |
|
4 |
||
5 |
-prerequisite: |
|
6 |
||
7 |
- virtualenv |
|
8 |
- distribute |
|
9 |
- psycopg2 requires the PostgreSQL libpq libraries and the pg_config utility |
|
10 |
||
11 |
- python project-boot.py --distribute --no-site-packages --index-url=http://pypi.websushi.org/ --clear --type-install=local --ignore-packages=MYSQL <path_to_venv> |
|
12 |
- python project-boot.py --no-site-packages --clear --ignore-packages=MYSQL --type-install=local <path_to_venv> |
|
13 |
- For Linux : |
|
14 |
python project-boot.py --unzip-setuptools --no-site-packages --index-url=http://pypi.websushi.org/ --clear --type-install=local <path_to_venv> |
|
15 |
||
16 |
Probleme avec mysql : |
|
17 |
||
18 |
sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib ~/dev/workspace/platform/virtualenv/web/env/venv_platform/lib/python2.7/site-packages/_mysql.so |
|
19 |
||
20 |
""" |
|
21 |
||
22 |
import os |
|
23 |
import subprocess |
|
24 |
import re |
|
25 |
import sys |
|
26 |
||
27 |
||
28 |
here = os.path.dirname(os.path.abspath(__file__)) |
|
29 |
base_dir = here |
|
30 |
script_name = os.path.join(base_dir, 'project-boot.py') |
|
31 |
||
32 |
import virtualenv |
|
33 |
||
34 |
src_base = os.path.abspath(os.path.join(here,"..","res","src")).replace("\\","/") |
|
35 |
lib_path = os.path.abspath(os.path.join(here,"..","res","lib")).replace("\\","/") |
|
36 |
patch_path = os.path.abspath(os.path.join(here,"res","patch")).replace("\\","/") |
|
37 |
||
38 |
||
39 |
EXTRA_TEXT = "import sys\n" |
|
40 |
EXTRA_TEXT += "sys.path.append('%s')\n" % (lib_path) |
|
41 |
EXTRA_TEXT += "sys.path.append('%s')\n" % (os.path.abspath(os.path.join(here,"res")).replace("\\","/")) |
|
42 |
EXTRA_TEXT += "from res_create_env import generate_install_methods\n" |
|
244
4f07ad576fee
finalize django 1.8 migration, upgrade version
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
43 |
EXTRA_TEXT += "adjust_options, extend_parser, after_install = generate_install_methods(path_locations, '%s', '%s', Logger, call_subprocess)\n" % (src_base, here) |
0 | 44 |
|
45 |
def main(): |
|
46 |
python_version = ".".join(map(str,sys.version_info[0:2])) |
|
47 |
text = virtualenv.create_bootstrap_script(EXTRA_TEXT, python_version=python_version) |
|
48 |
if os.path.exists(script_name): |
|
49 |
f = open(script_name) |
|
50 |
cur_text = f.read() |
|
51 |
f.close() |
|
52 |
else: |
|
53 |
cur_text = '' |
|
54 |
print 'Updating %s' % script_name |
|
55 |
if cur_text == 'text': |
|
56 |
print 'No update' |
|
57 |
else: |
|
58 |
print 'Script changed; updating...' |
|
59 |
f = open(script_name, 'w') |
|
60 |
f.write(text) |
|
61 |
f.close() |
|
62 |
||
63 |
if __name__ == '__main__': |
|
64 |
main() |
|
65 |