--- a/sbin/sync/config.py.tmpl Thu Jun 14 10:18:38 2012 +0200
+++ b/sbin/sync/config.py.tmpl Thu Jun 14 15:01:50 2012 +0200
@@ -1,6 +1,10 @@
from fabric.api import env
env.hosts = ['iri@web.iri.centrepompidou.fr']
+
+env.web_group = 'www-data'
+env.folders = ['index', 'log', 'static/media']
+
env.base_export_path = "~/tmp"
env.export_prefix = "platform"
env.remote_web_path = "/iridata/www/ldt/"
@@ -27,3 +31,29 @@
"+ core",
]
env.web_relaunch_cmd = "supervisorctl restart platform"
+
+env.base_url = "/ldtplatform/"
+env.web_url = "http://ldt.iri.centrepompidou.fr"
+env.stream_url = "rtmp://media.iri.centrepompidou.fr/ddc_player/"
+
+env.stream_src_prefix = ""
+env.ffmpeg_path = ""
+
+env.db_engine = 'django.db.backends.postgresql_psycopg2'
+env.db_name = 'platform'
+env.db_user = 'iriuser'
+env.db_password = ''
+env.db_host = 'sql.iri.centrepompidou.fr'
+env.db_port = 5432
+
+env.log_file = env.remote_web_path + '/log/log.txt'
+env.index_path = env.remote_web_path + '/index/'
+
+env.google_analytics_code = ""
+
+env.email_use_tls = True
+env.email_host = ""
+env.email_host_user = ""
+env.email_host_user = ""
+env.email_port = ""
+
--- a/sbin/sync/fabfile.py Thu Jun 14 10:18:38 2012 +0200
+++ b/sbin/sync/fabfile.py Thu Jun 14 15:01:50 2012 +0200
@@ -1,6 +1,8 @@
from fabric.api import task, run, local, env, cd, put, prefix, sudo
from fabric.colors import green
from fabric.contrib.project import rsync_project
+from fabric.contrib.files import exists, upload_template
+from fabric.context_managers import settings
from mercurial import commands, ui, hg, cmdutil
import imp
import os, os.path
@@ -99,10 +101,40 @@
def collectstatic(remotepath, remotevirtualenvpath):
print("Collect static in %s with %s" % (remotepath, remotevirtualenvpath))
activate_path = os.path.join(remotevirtualenvpath, "bin/activate")
- with prefix("source \"%s\"" % activate_path), prefix("export PYTHONPATH=\"%s\"" % remotepath), cd(os.path.join(remotepath, env.platform_web_module)):
+ with prefix("source \"%s\"" % activate_path), prefix("export PYTHONPATH=\"%s\"" % remotepath), cd(remotepath):
run("python manage.py collectstatic --noinput")
-
+def create_config(export_path):
+ print("Create config from %s" % (export_path,))
+ remotepath = env.remote_web_path
+ remote_config_path = os.path.join(remotepath, env.platform_web_module, "config.py")
+ template_path = os.path.join(export_path, "web", env.platform_web_module, "config.py.tmpl")
+
+ context = {
+ 'base_dir': os.path.join(remotepath, env.platform_web_module).rstrip("/")+"/",
+ 'base_url': env.base_url,
+ 'web_url': env.web_url,
+ 'stream_url': env.stream_url,
+ 'stream_src_prefix': env.stream_src_prefix,
+ 'ffmpeg_path': env.ffmpeg_path,
+ 'db_engine': env.db_engine,
+ 'db_name': env.db_name,
+ 'db_user': env.db_user,
+ 'db_password': env.db_password,
+ 'db_host': env.db_host,
+ 'db_port': env.db_port,
+ 'log_file': env.log_file,
+ 'index_path': env.index_path,
+ 'google_analytics_code': env.google_analytics_code,
+ 'email_use_tls': env.email_use_tls,
+ 'email_host': env.email_host,
+ 'email_host_user': env.email_host_user,
+ 'email_host_user': env.email_host_user,
+ 'email_port': env.email_port,
+ }
+
+ if not exists(remote_config_path, verbose=True):
+ upload_template(template_path, remote_config_path, context=context)
def export_version(version):
print("export version %s" % str(version))
@@ -134,6 +166,10 @@
build_src(src_path)
(_,version_str) = get_src_version(src_path)
build_path = os.path.join(src_path,"dist","ldt-%s.tar.gz" % version_str)
+ sync_install_build(build_path)
+
+
+def sync_install_build(build_path):
res_trans = None
try:
res_trans = sync_build(build_path)
@@ -142,6 +178,7 @@
if res_trans:
remove_build(res_trans[0])
+
def do_sync_web(version, export_path):
print("do_sync_web with version %s and path %s" % (version,export_path))
web_path = os.path.join(export_path,"web/")
@@ -151,12 +188,26 @@
print("Relaunch server")
collectstatic(env.remote_web_path, env.remote_virtualenv_path)
sudo(env.web_relaunch_cmd, shell=False)
+
+def check_folder_access():
+ print("Check folder access")
+ # get remote user
+ for folder_path in env.folders:
+ if not os.path.isabs(folder_path):
+ folder_path = env.remote_web_path.rstrip("/")+ "/" + folder_path
+ with settings(warn_only=True):
+ if not exists(folder_path):
+ run("mkdir -p \"%s\"" % folder_path)
+ run("chown -R -c :%s \"%s\"" % (env.web_group, folder_path))
+ run("chown -R -c g+w \"%s\"" % folder_path)
@task
def sync_web(version):
print(green("sync web with version %s" % version))
export_path = export_version(version)
- do_sync_web(version, export_path)
+ do_sync_web(version, export_path)
+ check_folder_access()
+ create_config(export_path)
clean_export_folder(export_path)
relaunch_server()
@@ -166,14 +217,33 @@
export_path = export_version(version)
do_sync_ldt(version, export_path)
clean_export_folder(export_path)
- relaunch_server()
-
+ relaunch_server()
+
+@task
+def update_lib(version, package):
+ print(green("update ldt with version %s" % version))
+ export_path = export_version(version)
+ lib_path = os.path.join(export_path, "virtualenv", "res", "lib")
+
+ f, pathname, description = imp.find_module("patch", [lib_path])
+ patch = imp.load_module("patch", f, pathname, description)
+ f, pathname, description = imp.find_module("lib_create_env", [lib_path])
+ lib_create_env = imp.load_module("lib_create_env", f, pathname, description)
+
+ package_path = os.path.join(export_path, "virtualenv", "res", "src", lib_create_env.URLS[package]['local'])
+
+ sync_install_build(package_path)
+ clean_export_folder(export_path)
+ relaunch_server()
+
@task
def sync_platform(version):
print(green("sync platform with version %s" % version))
export_path = export_version(version)
do_sync_ldt(version, export_path)
do_sync_web(version, export_path)
+ check_folder_access()
+ create_config(export_path)
clean_export_folder(export_path)
relaunch_server()
--- a/virtualenv/res/lib/lib_create_env.py Thu Jun 14 10:18:38 2012 +0200
+++ b/virtualenv/res/lib/lib_create_env.py Thu Jun 14 15:01:50 2012 +0200
@@ -14,47 +14,45 @@
URLS = {
#'': {'setup': '', 'url':'', 'local':''},
- 'DISTRIBUTE': {'setup': 'distribute', 'url':'http://pypi.python.org/packages/source/d/distribute/distribute-0.6.14.tar.gz', 'local':"distribute-0.6.14.tar.gz"},
- 'DJANGO': {'setup': 'django', 'url': 'http://www.djangoproject.com/download/1.4/tarball/', 'local':"Django-1.4.tar.gz"},
- 'DJANGO-EXTENSIONS': { 'setup': 'django-extensions', 'url':'https://github.com/django-extensions/django-extensions/tarball/0.8', 'local':"django-extensions-0.8.tar.gz"},
- 'DJANGO-REGISTRATION': { 'setup': 'django-registration', 'url':'https://bitbucket.org/ubernostrum/django-registration/get/v0.8.tar.gz', 'local':"django-registration-0.8.tar.gz"},
- 'DJANGO-TAGGING': { 'setup': 'django-tagging', 'url':'http://django-tagging.googlecode.com/files/django-tagging-0.3.1.tar.gz', 'local':"django-tagging-0.3.1.tar.gz"},
- 'DJANGO-PISTON': { 'setup': 'django-piston', 'url':'django-piston-7c90898072ce-modifed.tar.gz', 'local':'django-piston-7c90898072ce-modifed.tar.gz'},
- 'OAUTH2': { 'setup': 'python-oauth2', 'url':"https://github.com/simplegeo/python-oauth2/tarball/hudson-python-oauth2-211", 'local':"oauth2-1.5.211.tar.gz"},
- 'HTTPLIB2': { 'setup': 'python-httplib2', 'url':'http://code.google.com/p/httplib2/downloads/detail?name=httplib2-0.7.4.tar.gz&can=2&q=', 'local':"httplib2-0.7.4.tar.gz"},
- 'DJANGO-OAUTH-PLUS': { 'setup': 'django-oauth-plus', 'url':'http://bitbucket.org/david/django-oauth-plus/get/f314f018e473.gz', 'local':"django-oauth-plus.tar.gz"},
- 'MYSQL': { 'setup': 'mysql-python', 'url': 'http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download', 'local':"MySQL-python-1.2.3.tar.gz"},
- 'OPENID': {'setup':'openid', 'url':'http://pypi.python.org/packages/source/p/python-openid/python-openid-2.2.5.tar.gz', 'local':"python-openid-2.2.5.tar.gz"},
- 'DJANGO_OPENID_CONSUMER': {'setup':'django_openid_consumer', 'url':'http://pypi.python.org/packages/source/d/django-openid-consumer/django-openid-consumer-0.1.1.tar.gz', 'local':"django-openid-consumer-0.1.1.tar.gz"},
- 'SOCIAL_AUTH': {'setup':'social_auth', 'url':'https://github.com/omab/django-social-auth/tarball/v0.3.10', 'local':"omab-django-social-auth-v0.3.10-modified.tar.gz"},
- 'SOUTH': { 'setup': 'South', 'url':'http://www.aeracode.org/releases/south/south-0.7.5.tar.gz', 'local':"south-0.7.5.tar.gz"},
- 'DJANGO_GUARDIAN' : { 'setup': 'django-guardian', 'url':'http://pypi.python.org/packages/source/d/django-guardian/django-guardian-1.0.3.tar.gz', 'local':"django-guardian-1.0.3.tar.gz"},
- 'SORL_THUMBNAIL' : { 'setup': 'sorl-thumbnail', 'url':'http://pypi.python.org/packages/source/s/sorl-thumbnail/sorl-thumbnail-11.12.tar.gz', 'local':"sorl-thumbnail-v10.12.1.tar.gz"},
- 'LIBJPEG': {'setup': None, 'url':'jpegsrc.v8d.tar.gz', 'local':'jpegsrc.v8d.tar.gz'},
- 'ZLIB': {'setup': None, 'url':'zlib-1.2.7.tar.gz', 'local':'zlib-1.2.7.tar.gz'},
- 'PYCRYPTO': {'setup': 'pycrypto', 'url':'https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.tar.gz', 'local':'pycrypto-2.6.tar.gz'},
- 'SSH': {'setup': 'ssh', 'url':'http://pypi.python.org/packages/source/s/ssh/ssh-1.7.14.tar.gz#md5=4cdd0549ef4699bd67b96264d3b21427', 'local':'ssh-1.7.14.tar.gz'},
- 'FABRIC': {'setup': 'fabric', 'url':'https://github.com/fabric/fabric/tarball/1.4.2', 'local':'fabric-1.4.2.tar.gz'},
- 'MERCURIAL': {'setup': 'mercurial', 'url':'http://mercurial.selenic.com/release/mercurial-2.2.2.tar.gz', 'local':'mercurial-2.2.2.tar.gz'},
+ 'DJANGO': {'setup': 'django', 'url': 'http://www.djangoproject.com/download/1.4/tarball/', 'local':"Django-1.4.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'DJANGO-EXTENSIONS': { 'setup': 'django-extensions', 'url':'https://github.com/django-extensions/django-extensions/tarball/0.8', 'local':"django-extensions-0.8.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'DJANGO-REGISTRATION': { 'setup': 'django-registration', 'url':'https://bitbucket.org/ubernostrum/django-registration/get/v0.8.tar.gz', 'local':"django-registration-0.8.tar.gz", 'install': {'method': 'easy_install', 'option_str': '-Z', 'dict_extra_env': None}},
+ 'DJANGO-TAGGING': { 'setup': 'django-tagging', 'url':'http://django-tagging.googlecode.com/files/django-tagging-0.3.1.tar.gz', 'local':"django-tagging-0.3.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'DJANGO-PISTON': { 'setup': 'django-piston', 'url':'django-piston-7c90898072ce-modifed.tar.gz', 'local':'django-piston-7c90898072ce-modifed.tar.gz', 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
+ 'OAUTH2': { 'setup': 'python-oauth2', 'url':"https://github.com/simplegeo/python-oauth2/tarball/hudson-python-oauth2-211", 'local':"oauth2-1.5.211.tar.gz", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
+ 'HTTPLIB2': { 'setup': 'python-httplib2', 'url':'http://code.google.com/p/httplib2/downloads/detail?name=httplib2-0.7.4.tar.gz&can=2&q=', 'local':"httplib2-0.7.4.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'DJANGO-OAUTH-PLUS': { 'setup': 'django-oauth-plus', 'url':'http://bitbucket.org/david/django-oauth-plus/get/f314f018e473.gz', 'local':"django-oauth-plus.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'MYSQL': { 'setup': 'mysql-python', 'url': 'http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download', 'local':"MySQL-python-1.2.3.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'OPENID': {'setup':'openid', 'url':'http://pypi.python.org/packages/source/p/python-openid/python-openid-2.2.5.tar.gz', 'local':"python-openid-2.2.5.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'DJANGO_OPENID_CONSUMER': {'setup':'django_openid_consumer', 'url':'http://pypi.python.org/packages/source/d/django-openid-consumer/django-openid-consumer-0.1.1.tar.gz', 'local':"django-openid-consumer-0.1.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'SOCIAL_AUTH': {'setup':'social_auth', 'url':'https://github.com/omab/django-social-auth/tarball/v0.3.10', 'local':"omab-django-social-auth-v0.3.10-modified.tar.gz", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
+ 'SOUTH': { 'setup': 'South', 'url':'http://www.aeracode.org/releases/south/south-0.7.5.tar.gz', 'local':"south-0.7.5.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'DJANGO_GUARDIAN' : { 'setup': 'django-guardian', 'url':'http://pypi.python.org/packages/source/d/django-guardian/django-guardian-1.0.3.tar.gz', 'local':"django-guardian-1.0.3.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'SORL_THUMBNAIL' : { 'setup': 'sorl-thumbnail', 'url':'http://pypi.python.org/packages/source/s/sorl-thumbnail/sorl-thumbnail-11.12.tar.gz', 'local':"sorl-thumbnail-v10.12.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'LIBJPEG': {'setup': None, 'url':'jpegsrc.v8d.tar.gz', 'local':'jpegsrc.v8d.tar.gz', 'install': {'method': install_libjpeg, 'option_str': None, 'dict_extra_env': None}},
+ 'ZLIB': {'setup': None, 'url':'zlib-1.2.7.tar.gz', 'local':'zlib-1.2.7.tar.gz', 'install': {'method': install_zlib, 'option_str': None, 'dict_extra_env': None}},
+ 'PYCRYPTO': {'setup': 'pycrypto', 'url':'https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.tar.gz', 'local':'pycrypto-2.6.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'SSH': {'setup': 'ssh', 'url':'http://pypi.python.org/packages/source/s/ssh/ssh-1.7.14.tar.gz#md5=4cdd0549ef4699bd67b96264d3b21427', 'local':'ssh-1.7.14.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'FABRIC': {'setup': 'fabric', 'url':'https://github.com/fabric/fabric/tarball/1.4.2', 'local':'fabric-1.4.2.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'MERCURIAL': {'setup': 'mercurial', 'url':'http://mercurial.selenic.com/release/mercurial-2.2.2.tar.gz', 'local':'mercurial-2.2.2.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
}
if system_str == 'Windows':
URLS.update({
- 'PSYCOPG2': {'setup': 'psycopg2','url': 'psycopg2-2.0.14.win32-py2.6-pg8.4.3-release.zip', 'local':"psycopg2-2.0.14.win32-py2.6-pg8.4.3-release.zip"},
- 'JCC': {'setup': 'jcc', 'url': 'http://pylucene-win32-binary.googlecode.com/files/JCC-2.6-py2.6-win32.egg', 'local':"JCC-2.6-py2.6-win32.egg"},
- 'PYLUCENE': {'setup': 'pylucene', 'url': 'http://pylucene-win32-binary.googlecode.com/files/lucene-3.0.2-py2.6-win32.egg', 'local':"lucene-3.0.2-py2.6-win32.egg"},
- 'PIL': {'setup': 'pil', 'url': 'http://effbot.org/media/downloads/PIL-1.1.7.win32-py2.6.exe', 'local':"PIL-1.1.7.win32-py2.6.exe"},
- 'LXML': {'setup': 'lxml', 'url': 'http://pypi.python.org/packages/2.6/l/lxml/lxml-2.2.2-py2.6-win32.egg', 'local':"lxml-2.2.2-py2.6-win32.egg"}
+ 'PSYCOPG2': {'setup': 'psycopg2','url': 'psycopg2-2.0.14.win32-py2.6-pg8.4.3-release.zip', 'local':"psycopg2-2.0.14.win32-py2.6-pg8.4.3-release.zip", 'install': {'method': install_psycopg2, 'option_str': None, 'dict_extra_env': None}},
+ 'JCC': {'setup': 'jcc', 'url': 'http://pylucene-win32-binary.googlecode.com/files/JCC-2.6-py2.6-win32.egg', 'local':"JCC-2.6-py2.6-win32.egg", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
+ 'PYLUCENE': {'setup': 'pylucene', 'url': 'http://pylucene-win32-binary.googlecode.com/files/lucene-3.0.2-py2.6-win32.egg', 'local':"lucene-3.0.2-py2.6-win32.egg", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
+ 'PIL': {'setup': 'pil', 'url': 'http://effbot.org/media/downloads/PIL-1.1.7.win32-py2.6.exe', 'local':"PIL-1.1.7.win32-py2.6.exe", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
+ 'LXML': {'setup': 'lxml', 'url': 'http://pypi.python.org/packages/2.6/l/lxml/lxml-2.2.2-py2.6-win32.egg', 'local':"lxml-2.2.2-py2.6-win32.egg", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}}
})
else:
URLS.update({
- 'PSYCOPG2': {'setup': 'psycopg2','url': 'http://www.psycopg.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.5.tar.gz', 'local':"psycopg2-2.4.5.tar.gz"},
- 'PYLUCENE': {'setup': 'pylucene', 'url': 'http://mirrors.ircam.fr/pub/apache/lucene/pylucene/pylucene-3.6.0-2-src.tar.gz', 'local':"pylucene-3.6.0-2-src.tar.gz"},
- 'PIL': {'setup': 'pil', 'url': 'http://effbot.org/downloads/Imaging-1.1.7.tar.gz', 'local':"Imaging-1.1.7.tar.gz"},
- 'LXML': {'setup': 'lxml', 'url':"lxml-2.3.4.tar.bz2", 'local':"lxml-2.3.4.tar.bz2"}
+ 'PSYCOPG2': {'setup': 'psycopg2','url': 'http://www.psycopg.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.5.tar.gz', 'local':"psycopg2-2.4.5.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
+ 'PYLUCENE': {'setup': 'pylucene', 'url': 'http://mirrors.ircam.fr/pub/apache/lucene/pylucene/pylucene-3.6.0-2-src.tar.gz', 'local':"pylucene-3.6.0-2-src.tar.gz", 'install': {'method': install_pylucene, 'option_str': None, 'dict_extra_env': None}},
+ 'PIL': {'setup': 'pil', 'url': 'http://effbot.org/downloads/Imaging-1.1.7.tar.gz', 'local':"Imaging-1.1.7.tar.gz", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
+ 'LXML': {'setup': 'lxml', 'url':"lxml-2.3.4.tar.bz2", 'local':"lxml-2.3.4.tar.bz2", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': {'STATIC_DEPS': 'true', 'LIBXML2_VERSION': '2.7.8', 'LIBXSLT_VERSION': '1.1.26', 'LIBICONV_VERSION': '1.13.1'}}},
})
-
-
+
class ResourcesEnv(object):
@@ -318,12 +316,26 @@
ignore_packages = []
+ if system_str == 'Windows':
+ default_install_options = {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}
+ else:
+ default_install_options = {'method': 'pip', 'option_str': None, 'dict_extra_env': None}
+
if options.ignore_packages :
ignore_packages = options.ignore_packages.split(",")
logger.indent += 2
try:
- for key, method, option_str, extra_env in res_env.NORMAL_INSTALL:
+ for key in res_env.NORMAL_INSTALL:
+ if key not in res_env.URLS:
+ logger.notify("%s not found in def : passing" % (key,))
+ install_options = res_env.URLS[key].get('install', None)
+ if install_options is None:
+ install_options = default_install_options
+ method = install_options.get('method', default_install_options['method'])
+ option_str = install_options.get('option_str', default_install_options['option_str'])
+ extra_env = install_options.get('dict_extra_env', default_install_options['dict_extra_env'])
+ #isinstance(lst, (list, tuple))
if key not in ignore_packages:
if callable(method):
method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop)
@@ -341,3 +353,15 @@
return adjust_options, extend_parser, after_install
+
+def lib_add_options(options_to_add):
+ import sys
+ def check_option(str):
+ for opt in sys.argv:
+ if opt.startswith(str):
+ return true
+ return false
+ for opt in options_to_add:
+ test_opt = opt.split(['='])[0]
+ if not check_option(test_opt):
+ sys.argv.insert(len(sys.argv)-1, opt)
--- a/virtualenv/setup/create_python_env.py Thu Jun 14 10:18:38 2012 +0200
+++ b/virtualenv/setup/create_python_env.py Thu Jun 14 15:01:50 2012 +0200
@@ -22,13 +22,6 @@
import virtualenv
-# things to install
-# - psycopg2 -> pip
-# - PIL -> pip
-# - pyxml -> pip
-# - 4Suite-xml - easy_install ftp://ftp.4suite.org/pub/4Suite/4Suite-XML-1.0.2.tar.bz2
-# - pylucene - script
-
src_base = os.path.abspath(os.path.join(here,"..","res","src")).replace("\\","/")
lib_path = os.path.abspath(os.path.join(here,"..","res","lib")).replace("\\","/")
patch_path = os.path.abspath(os.path.join(here,"res","patch")).replace("\\","/")
--- a/virtualenv/setup/res/res_create_env.py Thu Jun 14 10:18:38 2012 +0200
+++ b/virtualenv/setup/res/res_create_env.py Thu Jun 14 15:01:50 2012 +0200
@@ -1,13 +1,16 @@
import platform
-from lib_create_env import lib_generate_install_methods, install_pylucene, install_psycopg2
+from lib_create_env import lib_generate_install_methods, install_pylucene, install_psycopg2, lib_add_options
system_str = platform.system()
INSTALLS = [#(key,method, option_str, dict_extra_env)
- ('DISTRIBUTE', 'pip', None, None),
]
+OPTIONS_TO_ADD = ['--no-site-packages','--clear', '--type-install=local', "--unzip-setuptools"]
+
def generate_install_methods(path_locations, src_base, Logger, call_subprocess):
return lib_generate_install_methods(path_locations, src_base, Logger, call_subprocess, INSTALLS)
+
+add_options = lambda : lib_add_options(OPTIONS_TO_ADD)
\ No newline at end of file
--- a/virtualenv/sync/create_python_env.py Thu Jun 14 10:18:38 2012 +0200
+++ b/virtualenv/sync/create_python_env.py Thu Jun 14 15:01:50 2012 +0200
@@ -22,13 +22,6 @@
import virtualenv
-# things to install
-# - psycopg2 -> pip
-# - PIL -> pip
-# - pyxml -> pip
-# - 4Suite-xml - easy_install ftp://ftp.4suite.org/pub/4Suite/4Suite-XML-1.0.2.tar.bz2
-# - pylucene - script
-
src_base = os.path.abspath(os.path.join(here,"..","res","src")).replace("\\","/")
lib_path = os.path.abspath(os.path.join(here,"..","res","lib")).replace("\\","/")
patch_path = os.path.abspath(os.path.join(here,"res","patch")).replace("\\","/")
@@ -37,8 +30,9 @@
EXTRA_TEXT = "import sys\n"
EXTRA_TEXT += "sys.path.append('%s')\n" % (lib_path)
EXTRA_TEXT += "sys.path.append('%s')\n" % (os.path.abspath(os.path.join(here,"res")).replace("\\","/"))
-EXTRA_TEXT += "from res_create_env import generate_install_methods\n"
+EXTRA_TEXT += "from res_create_env import generate_install_methods, add_options\n"
EXTRA_TEXT += "adjust_options, extend_parser, after_install = generate_install_methods(path_locations, '%s', Logger, call_subprocess)\n" % (src_base)
+EXTRA_TEXT += "add_options()"
def main():
--- a/virtualenv/sync/res/res_create_env.py Thu Jun 14 10:18:38 2012 +0200
+++ b/virtualenv/sync/res/res_create_env.py Thu Jun 14 15:01:50 2012 +0200
@@ -1,17 +1,19 @@
import platform
-from lib_create_env import lib_generate_install_methods, install_pylucene, install_psycopg2
+from lib_create_env import lib_generate_install_methods, lib_add_options
system_str = platform.system()
+INSTALLS = [#(key,method, option_str, dict_extra_env)
+ 'PYCRYPTO',
+ 'SSH',
+ 'FABRIC',
+ 'MERCURIAL',
+]
-INSTALLS = [#(key,method, option_str, dict_extra_env)
- ('DISTRIBUTE', 'pip', None, None),
- ('PYCRYPTO', 'pip', None, None),
- ('SSH', 'pip', None, None),
- ('FABRIC', 'pip', None, None),
- ('MERCURIAL', 'pip', None, None),
-]
+OPTIONS_TO_ADD = ['--no-site-packages','--clear', '--type-install=local', "--unzip-setuptools"]
def generate_install_methods(path_locations, src_base, Logger, call_subprocess):
return lib_generate_install_methods(path_locations, src_base, Logger, call_subprocess, INSTALLS)
+
+add_options = lambda : lib_add_options(OPTIONS_TO_ADD)
--- a/virtualenv/web/create_python_env.py Thu Jun 14 10:18:38 2012 +0200
+++ b/virtualenv/web/create_python_env.py Thu Jun 14 15:01:50 2012 +0200
@@ -27,13 +27,6 @@
import virtualenv
-# things to install
-# - psycopg2 -> pip
-# - PIL -> pip
-# - pyxml -> pip
-# - 4Suite-xml - easy_install ftp://ftp.4suite.org/pub/4Suite/4Suite-XML-1.0.2.tar.bz2
-# - pylucene - script
-
src_base = os.path.abspath(os.path.join(here,"..","res","src")).replace("\\","/")
lib_path = os.path.abspath(os.path.join(here,"..","res","lib")).replace("\\","/")
patch_path = os.path.abspath(os.path.join(here,"res","patch")).replace("\\","/")
@@ -42,15 +35,9 @@
EXTRA_TEXT = "import sys\n"
EXTRA_TEXT += "sys.path.append('%s')\n" % (lib_path)
EXTRA_TEXT += "sys.path.append('%s')\n" % (os.path.abspath(os.path.join(here,"res")).replace("\\","/"))
-EXTRA_TEXT += "from res_create_env import generate_install_methods\n"
+EXTRA_TEXT += "from res_create_env import generate_install_methods, add_options\n"
EXTRA_TEXT += "adjust_options, extend_parser, after_install = generate_install_methods(path_locations, '%s', Logger, call_subprocess)\n" % (src_base)
-
-
-
-#f = open(os.path.join(os.path. os.path.join(os.path.dirname(os.path.abspath(__file__)),"res"),'res_create_env.py'), 'r')
-#EXTRA_TEXT += f.read()
-#EXTRA_TEXT += "\n"
-#EXTRA_TEXT += "RES_ENV = ResourcesEnv('%s')\n" % (src_base)
+EXTRA_TEXT += "add_options()"
def main():
python_version = ".".join(map(str,sys.version_info[0:2]))
--- a/virtualenv/web/res/res_create_env.py Thu Jun 14 10:18:38 2012 +0200
+++ b/virtualenv/web/res/res_create_env.py Thu Jun 14 15:01:50 2012 +0200
@@ -1,53 +1,39 @@
import platform
-from lib_create_env import lib_generate_install_methods, install_pylucene, install_psycopg2
+from lib_create_env import lib_generate_install_methods, lib_add_options
system_str = platform.system()
-if system_str == 'Windows':
- INSTALLS = [
- ('JCC','easy_install',None,None),
- ('PSYCOPG2',install_psycopg2,None,None),
- ('PYLUCENE','easy_install',None,None),
- ]
-else:
- INSTALLS = [
- ('PYLUCENE',install_pylucene,None,None),
- ('PSYCOPG2', 'pip', None, None),
- ]
-
-if system_str == 'Linux':
- INSTALLS.extend([
- ('DISTRIBUTE', 'pip', None, None),
- ])
-INSTALLS.extend([ #(key,method, option_str, dict_extra_env)
- ('SOUTH', 'pip', None, None),
- ('PIL', 'easy_install', None, None),
- ('DJANGO','pip', None, None),
- ('DJANGO-EXTENSIONS', 'pip', None, None),
- ('DJANGO-REGISTRATION', 'easy_install', '-Z', None),
- ('DJANGO-TAGGING', 'pip', None, None),
- ('DJANGO-PISTON', 'easy_install', None, None),
- ('HTTPLIB2', 'pip', None, None),
- ('OAUTH2', 'easy_install', None, None),
- ('DJANGO-OAUTH-PLUS', 'pip', None, None),
- ('OPENID', 'pip', None, None),
- ('DJANGO_OPENID_CONSUMER', 'pip', None, None),
- ('SOCIAL_AUTH', 'easy_install', None, None),
- ('DJANGO_GUARDIAN', 'pip', None, None),
- ('SORL_THUMBNAIL', 'pip', None, None),
-])
+INSTALLS = [ #(key,method, option_str, dict_extra_env)
+ 'PYLUCENE',
+ 'PSYCOPG2',
+ 'SOUTH',
+ 'PIL',
+ 'DJANGO',
+ 'DJANGO-EXTENSIONS',
+ 'DJANGO-REGISTRATION',
+ 'DJANGO-TAGGING',
+ 'DJANGO-PISTON',
+ 'HTTPLIB2',
+ 'OAUTH2',
+ 'DJANGO-OAUTH-PLUS',
+ 'OPENID',
+ 'DJANGO_OPENID_CONSUMER',
+ 'SOCIAL_AUTH',
+ 'DJANGO_GUARDIAN',
+ 'SORL_THUMBNAIL',
+ 'LXML',
+]
-if system_str == "Darwin":
- INSTALLS.extend([
- ('LXML', 'easy_install', None, {'STATIC_DEPS': 'true', 'LIBXML2_VERSION': '2.7.8', 'LIBXSLT_VERSION': '1.1.26', 'LIBICONV_VERSION': '1.13.1'}),
- ])
-else:
- INSTALLS.extend([
- ('LXML', 'easy_install', None, None),
- ])
+if system_str == 'Windows':
+ INSTALLS.insert(0, 'JCC')
+OPTIONS_TO_ADD = ['--no-site-packages','--clear', '--type-install=local']
+if system_str == "Linux":
+ OPTIONS_TO_ADD.append("--unzip-setuptools")
def generate_install_methods(path_locations, src_base, Logger, call_subprocess):
return lib_generate_install_methods(path_locations, src_base, Logger, call_subprocess, INSTALLS)
+
+add_options = lambda : lib_add_options(OPTIONS_TO_ADD)