# HG changeset patch # User ymh # Date 1287675541 -7200 # Node ID 1b99846565d527d0f05e19df30ab15354acc2f6a # Parent a2711e44ba5de8b1675d7e0ee6aaa4a6c56a9b46 correct env creation diff -r a2711e44ba5d -r 1b99846565d5 sbin/create_python_env.py --- a/sbin/create_python_env.py Sun Jun 06 03:17:50 2010 +0200 +++ b/sbin/create_python_env.py Thu Oct 21 17:39:01 2010 +0200 @@ -1,6 +1,6 @@ """ Call this like ``python create_python_env.py``; it will -refresh the blinkster-boot.py script +refresh the project-boot.py script -prerequisite: @@ -9,7 +9,7 @@ - psycopg2 requires the PostgreSQL libpq libraries and the pg_config utility - virtualenv --distribute --no-site-packages venv -- python blinkster-boot.py --distribute --no-site-packages --index-url=http://pypi.websushi.org/ --clear bvenv +- python project-boot.py --distribute --no-site-packages --index-url=http://pypi.websushi.org/ --clear bvenv """ @@ -21,7 +21,7 @@ here = os.path.dirname(os.path.abspath(__file__)) base_dir = here -script_name = os.path.join(base_dir, 'blinkster-boot.py') +script_name = os.path.join(base_dir, 'project-boot.py') import virtualenv @@ -57,6 +57,8 @@ import urllib import platform import patch +import zipfile +from distutils.sysconfig import get_python_lib INDEX_URL = 'http://pypi.python.org/simple/' @@ -89,6 +91,7 @@ ensure_dir(src_dir) ensure_dir(tmp_dir) system_str = platform.system() + python_lib_dir = get_python_lib() res_source_key = options.type_install @@ -113,7 +116,15 @@ #patch for linux if system_str == 'Linux' : olddir = os.getcwd() - 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') + 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') + + if os.path.isfile(patch_dest_path): + # must unzip egg + # rename file and etract all + shutil.move(patch_dest_path, patch_dest_path + ".zip") + zf = zipfile.ZipFile(patch_dest_path + ".zip",'r') + zf.extractall(patch_dest_path) + os.remove(patch_dest_path + ".zip") logger.notify("Patch jcc : %s " % (patch_dest_path)) os.chdir(patch_dest_path) p = patch.fromfile(os.path.join(jcc_src_path,"jcc","patches","patch.43.0.6c11")) @@ -149,7 +160,10 @@ destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64 --arch i386\\n") destination.write("NUM_FILES=2\\n") else: - destination.write("JCC=$(PYTHON) -m jcc --shared\\n") + if sys.version_info >= (2,6) and sys.version_info < (2,7): + destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared\\n") + else: + destination.write("JCC=$(PYTHON) -m jcc --shared\\n") destination.write("NUM_FILES=2\\n") for line in source: destination.write( line )