--- a/sbin/create_python_env.py Tue Jun 01 10:44:27 2010 +0200
+++ b/sbin/create_python_env.py Tue Jun 01 19:07:23 2010 +0200
@@ -10,6 +10,8 @@
- virtualenv --distribute --no-site-packages venv
+- python blinkster-boot.py --distribute --no-site-packages --index-url=http://pypi.websushi.org/ --clear bvenv
+
"""
import os
import subprocess
@@ -38,24 +40,24 @@
import urllib
import platform
+PSYCOPG2_URL = 'http://initd.org/pub/software/psycopg/psycopg2-2.2.1.tar.gz'
FOURSUITE_XML_URL = 'ftp://ftp.4suite.org/pub/4Suite/4Suite-XML-1.0.2.tar.bz2'
PY_LUCENE_URL = 'http://apache.crihan.fr/dist/lucene/pylucene/pylucene-3.0.1-1-src.tar.gz'
+PIL_URL = 'http://effbot.org/downloads/Imaging-1.1.7.tar.gz'
+INDEX_URL = 'http://pypi.python.org/simple/'
+PYXML_URL = "http://sourceforge.net/projects/pyxml/files/pyxml/0.8.4/PyXML-0.8.4.tar.gz/download"
+
def extend_parser(parser):
- pass
+ parser.add_option(
+ '--index-url',
+ metavar='INDEX_URL',
+ dest='index_url',
+ default='',
+ help='base URL of Python Package Index')
def adjust_options(options, args):
- if not args:
- return # caller will raise error
-
- # We're actually going to build the venv in a subdirectory
- base_dir = args[0]
- if len(args) > 1:
- venv_name = args[1]
- else:
- venv_name = "blinkster"
-
- args[0] = join(base_dir, venv_name)
+ pass
def after_install(options, home_dir):
@@ -66,14 +68,22 @@
ensure_dir(tmp_dir)
logger.indent += 2
try:
- call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')) ,'-E '+ os.path.abspath(home_dir), 'psycopg2', 'pil', 'pyxml'],
+ call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), PSYCOPG2_URL],
cwd=os.path.abspath(tmp_dir),
filter_stdout=filter_python_develop,
- show_stdout=False)
+ show_stdout=True)
+ call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), PIL_URL],
+ cwd=os.path.abspath(tmp_dir),
+ filter_stdout=filter_python_develop,
+ show_stdout=True)
+ call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-E', os.path.abspath(home_dir), PYXML_URL],
+ cwd=os.path.abspath(tmp_dir),
+ filter_stdout=filter_python_develop,
+ show_stdout=True)
call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'easy_install')), FOURSUITE_XML_URL],
cwd=os.path.abspath(tmp_dir),
filter_stdout=filter_python_develop,
- show_stdout=False)
+ show_stdout=True)
#get pylucene
pylucene_src = os.path.join(src_dir,"pylucene.tar.gz")
@@ -89,7 +99,7 @@
call_subprocess([os.path.abspath(os.path.join(home_dir, 'bin', 'python')), 'setup.py', 'install'],
cwd=os.path.abspath(os.path.join(pylucene_src_path,"jcc")),
filter_stdout=filter_python_develop,
- show_stdout=False)
+ show_stdout=True)
#install pylucene
#modify makefile
makefile_path = os.path.join(pylucene_src_path,"Makefile")
@@ -97,19 +107,22 @@
destination= open( makefile_path, "w" )
source= open( makefile_path+"~", "r" )
- destination.write("PREFIX_PYTHON="+os.path.abspath(home_dir))
- destination.write("ANT=ant")
- destination.write("PYTHON=$(PREFIX_PYTHON)/bin/python")
+ destination.write("PREFIX_PYTHON="+os.path.abspath(home_dir)+"\\n")
+ destination.write("ANT=ant\\n")
+ destination.write("PYTHON=$(PREFIX_PYTHON)/bin/python\\n")
system_str = platform.system()
if system_str == "Darwin":
- destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64 --arch i386")
- destination.write("NUM_FILES=2")
+ if sys.version_info > (2,6):
+ destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64 --arch i386\\n")
+ else:
+ destination.write("JCC=$(PYTHON) -m jcc --shared --arch x86_64 --arch i386\\n")
+ destination.write("NUM_FILES=2\\n")
elif system_str == "Windows":
- destination.write("JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64 --arch i386")
- destination.write("NUM_FILES=2")
+ 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")
- destination.write("NUM_FILES=2")
+ destination.write("JCC=$(PYTHON) -m jcc --shared\\n")
+ destination.write("NUM_FILES=2\\n")
for line in source:
destination.write( line )
source.close()
@@ -119,11 +132,8 @@
call_subprocess(['make', 'install'],
cwd=os.path.abspath(pylucene_src_path),
filter_stdout=filter_python_develop,
- show_stdout=False)
-
- os.re
-
- os.removedirs(src_dir)
+ show_stdout=True)
+ shutil.rmtree(src_dir)
finally:
logger.indent -= 2