| author | grandjoncl |
| Mon, 12 Nov 2012 16:37:57 +0100 | |
| branch | embed_config |
| changeset 933 | 7d0b9d12bf5a |
| parent 731 | aba6c30b6d2a |
| 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 |
||
| 47 | 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> |
|
| 0 | 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 |
||
| 731 | 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 |
||
| 0 | 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 |
||
|
50
0d59e0522d36
simplify virtualenv creation script
ymh <ymh.work@gmail.com>
parents:
49
diff
changeset
|
34 |
src_base = os.path.abspath(os.path.join(here,"..","res","src")).replace("\\","/") |
|
0d59e0522d36
simplify virtualenv creation script
ymh <ymh.work@gmail.com>
parents:
49
diff
changeset
|
35 |
lib_path = os.path.abspath(os.path.join(here,"..","res","lib")).replace("\\","/") |
| 17 | 36 |
patch_path = os.path.abspath(os.path.join(here,"res","patch")).replace("\\","/") |
| 0 | 37 |
|
38 |
||
| 47 | 39 |
EXTRA_TEXT = "import sys\n" |
40 |
EXTRA_TEXT += "sys.path.append('%s')\n" % (lib_path) |
|
| 49 | 41 |
EXTRA_TEXT += "sys.path.append('%s')\n" % (os.path.abspath(os.path.join(here,"res")).replace("\\","/")) |
| 671 | 42 |
EXTRA_TEXT += "from res_create_env import generate_install_methods\n" |
| 49 | 43 |
EXTRA_TEXT += "adjust_options, extend_parser, after_install = generate_install_methods(path_locations, '%s', Logger, call_subprocess)\n" % (src_base) |
| 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 |