virtualenv/res/lib/lib_create_env.py
changeset 244 4f07ad576fee
parent 243 b5daed0ce08b
child 248 249a7c73e0a1
equal deleted inserted replaced
243:b5daed0ce08b 244:4f07ad576fee
    16 
    16 
    17 URLS = {
    17 URLS = {
    18     #'': {'setup': '', 'url':'', 'local':''},
    18     #'': {'setup': '', 'url':'', 'local':''},
    19     'DISTRIBUTE': {'setup': 'distribute', 'url':'http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz', 'local':"distribute-0.6.34.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    19     'DISTRIBUTE': {'setup': 'distribute', 'url':'http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz', 'local':"distribute-0.6.34.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    20     'DJANGO': {'setup': 'django', 'url': 'https://github.com/django/django/archive/1.8.tar.gz', 'local':"django-1.8.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    20     'DJANGO': {'setup': 'django', 'url': 'https://github.com/django/django/archive/1.8.tar.gz', 'local':"django-1.8.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    21     'DJANGO-EXTENSIONS': { 'setup': 'django-extensions', 'url':'https://github.com/django-extensions/django-extensions/archive/1.5.2.tar.gz', 'local':"django-extensions-1.5.2.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    21     'DJANGO-EXTENSIONS': { 'setup': 'django-extensions', 'url':'https://github.com/django-extensions/django-extensions/archive/1.5.3.tar.gz', 'local':"django-extensions-1.5.3.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    22     'DJANGO-REGISTRATION': { 'setup': 'django-registration', 'url':'https://github.com/macropin/django-registration/archive/8b38c5a925ad7a95b3884e8ce9729a05d42d0a65.tar.gz', 'local':"django-registration-8b38c5a925ad7a95b3884e8ce9729a05d42d0a65.tar.gz", 'install': {'method': 'easy_install', 'option_str': '-Z', 'dict_extra_env': None}},
    22     'DJANGO-REGISTRATION': { 'setup': 'django-registration', 'url':'https://github.com/macropin/django-registration/archive/8b38c5a925ad7a95b3884e8ce9729a05d42d0a65.tar.gz', 'local':"django-registration-redux-1.2.tar.gz", 'install': {'method': 'easy_install', 'option_str': '-Z', 'dict_extra_env': None}},
       
    23     'DJANGO-TEMPLATETAG-SUGAR': { 'setup': 'django-templatetag-sugar', 'url': 'https://github.com/alex/django-templatetag-sugar/archive/1.0.tar.gz', 'local': 'django-templatetag-sugar-1.0.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    23     'DJANGO-TAGGIT': { 'setup': 'django-taggit', 'url':'https://github.com/alex/django-taggit/archive/0.14.0.tar.gz', 'local':"django-taggit-0.14.0.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    24     'DJANGO-TAGGIT': { 'setup': 'django-taggit', 'url':'https://github.com/alex/django-taggit/archive/0.14.0.tar.gz', 'local':"django-taggit-0.14.0.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    24     'DJANGO-TAGGIT-TEMPLATETAGS': { 'setup': 'django-taggit-templatetags', 'url':'https://github.com/feuervogel/django-taggit-templatetags/archive/d2216c9d1888e0739a04899a36e5149b5cbb3381.zip', 'local':"django-taggit-templatetags-d2216c9d1888e0739a04899a36e5149b5cbb3381.zip", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    25     'DJANGO-TAGGIT-TEMPLATETAGS': { 'setup': 'django-taggit-templatetags', 'url':'https://github.com/feuervogel/django-taggit-templatetags/archive/d2216c9d1888e0739a04899a36e5149b5cbb3381.zip', 'local':"django-taggit-templatetags-0.4.5dev-r0.zip", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    25     '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}},
    26     '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}},
    26     'HTTPLIB2': { 'setup': 'python-httplib2', 'url':'https://pypi.python.org/packages/source/h/httplib2/httplib2-0.9.1.tar.gz', 'local':"httplib2-0.9.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    27     'HTTPLIB2': { 'setup': 'python-httplib2', 'url':'https://pypi.python.org/packages/source/h/httplib2/httplib2-0.9.1.tar.gz', 'local':"httplib2-0.9.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    27     'DJANGO-OAUTH-PLUS': { 'setup': 'django-oauth-plus', 'url':'https://pypi.python.org/packages/source/d/django-oauth-plus/django-oauth-plus-2.2.6.tar.gz', 'local':"django-oauth-plus-2.2.6.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    28     'DJANGO-OAUTH-PLUS': { 'setup': 'django-oauth-plus', 'url':'https://pypi.python.org/packages/source/d/django-oauth-plus/django-oauth-plus-2.2.6.tar.gz', 'local':"django-oauth-plus-2.2.6.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    28     '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}},
    29     '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}},
    29     'SOCIAL_AUTH': {'setup':'social_auth', 'url':'https://github.com/omab/python-social-auth/archive/v0.2.7.tar.gz', 'local':"python-social-auth-0.2.7.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    30     'SOCIAL_AUTH': {'setup':'social_auth', 'url':'https://github.com/omab/python-social-auth/archive/v0.2.7.tar.gz', 'local':"python-social-auth-0.2.7.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    30     'DJANGO_GUARDIAN' : { 'setup': 'django-guardian', 'url':'https://github.com/lukaszb/django-guardian/archive/8f82cf92b6b4140c84023b06d81820e5c7f24194.tar.gz', 'local':"django-guardian-8f82cf92b6b4140c84023b06d81820e5c7f24194.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    31     'DJANGO_GUARDIAN' : { 'setup': 'django-guardian', 'url':'https://github.com/lukaszb/django-guardian/archive/8f82cf92b6b4140c84023b06d81820e5c7f24194.tar.gz', 'local':"django-guardian-1.2.6.dev0.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    31     'SORL_THUMBNAIL' : { 'setup': 'sorl-thumbnail', 'url':'https://github.com/mariocesar/sorl-thumbnail/archive/v12.2.tar.gz', 'local':"sorl-thumbnail-12.2.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    32     'SORL_THUMBNAIL' : { 'setup': 'sorl-thumbnail', 'url':'https://github.com/mariocesar/sorl-thumbnail/archive/v12.2.tar.gz', 'local':"sorl-thumbnail-12.2.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    32     'LIBJPEG': {'setup': None, 'url':'jpegsrc.v9.tar.gz', 'local':'jpegsrc.v9.tar.gz', 'install': {'method': 'install_libjpeg', 'option_str': None, 'dict_extra_env': None}},
    33     'LIBJPEG': {'setup': None, 'url':'jpegsrc.v9.tar.gz', 'local':'jpegsrc.v9.tar.gz', 'install': {'method': 'install_libjpeg', 'option_str': None, 'dict_extra_env': None}},
    33     'ZLIB': {'setup': None, 'url':'zlib-1.2.8.tar.gz', 'local':'zlib-1.2.8.tar.gz', 'install': {'method': 'install_zlib', 'option_str': None, 'dict_extra_env': None}},
    34     'ZLIB': {'setup': None, 'url':'zlib-1.2.8.tar.gz', 'local':'zlib-1.2.8.tar.gz', 'install': {'method': 'install_zlib', 'option_str': None, 'dict_extra_env': None}},
    34     'HAYSTACK': {'setup': 'django-haystack', 'url': 'https://github.com/toastdriven/django-haystack/archive/v2.3.1.tar.gz', 'local': 'django-haystack-2.3.1.tar.gz', 'install':{'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    35     'HAYSTACK': {'setup': 'django-haystack', 'url': 'https://github.com/toastdriven/django-haystack/archive/v2.3.1.tar.gz', 'local': 'django-haystack-2.3.1.tar.gz', 'install':{'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    35     'REQUESTS': {'setup': 'requests', 'url':'https://github.com/kennethreitz/requests/archive/v2.6.2.tar.gz', 'local':'requests-2.6.2.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    36     'REQUESTS': {'setup': 'requests', 'url':'https://github.com/kennethreitz/requests/archive/v2.7.0.tar.gz', 'local':'requests-2.7.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
       
    37     'ELASTICSEARCH': {'setup': 'elasticsearch', 'url':'https://github.com/elastic/elasticsearch-py/archive/1.4.0.tar.gz', 'local':'elasticsearch-1.4.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    36     'PYELASTICSEARCH': {'setup': 'pyelasticsearch', 'url':'https://pypi.python.org/packages/source/p/pyelasticsearch/pyelasticsearch-1.2.3.tar.gz', 'local':'pyelasticsearch-1.2.3.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    38     'PYELASTICSEARCH': {'setup': 'pyelasticsearch', 'url':'https://pypi.python.org/packages/source/p/pyelasticsearch/pyelasticsearch-1.2.3.tar.gz', 'local':'pyelasticsearch-1.2.3.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    37     'WHOOSH': {'setup': 'whoosh', 'url':'https://bitbucket.org/mchaput/whoosh/get/2.7.0.tar.gz', 'local':'mchaput-whoosh-8abeb09483b9.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    39     'WHOOSH': {'setup': 'whoosh', 'url':'https://bitbucket.org/mchaput/whoosh/get/2.7.0.tar.gz', 'local':'whoosh-2.7.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    38     'SETUPTOOLS_HG' : {'setup':'setuptools_hg', 'url':'https://bitbucket.org/jezdez/setuptools_hg/get/v0.4.tar.gz', 'local': 'setuptools_hg-0.4.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    40     'SETUPTOOLS_HG' : {'setup':'setuptools_hg', 'url':'https://bitbucket.org/jezdez/setuptools_hg/get/v0.4.tar.gz', 'local': 'setuptools_hg-0.4.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    39     # dependencies for Tastypie : mimeparse>=0.1.3, python-dateutil>=2.1, lxml, PyYAML (not necessary but we never know), python-digest, defusedxml
    41     # dependencies for Tastypie : mimeparse>=0.1.3, python-dateutil>=2.1, lxml, PyYAML (not necessary but we never know), python-digest, defusedxml
    40     'MIMEPARSE' : {'setup':'mimeparse', 'url':'http://pypi.python.org/packages/source/m/mimeparse/mimeparse-0.1.3.tar.gz', 'local': 'mimeparse-0.1.3.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    42     'MIMEPARSE' : {'setup':'mimeparse', 'url':'http://pypi.python.org/packages/source/m/mimeparse/mimeparse-0.1.3.tar.gz', 'local': 'mimeparse-0.1.3.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    41     'SIX' : {'setup':'six', 'url':'https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz', 'local': 'six-1.9.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    43     'SIX' : {'setup':'six', 'url':'https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz', 'local': 'six-1.9.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    42     'PYTHON-DATEUTIL' : {'setup':'python-dateutil', 'url':'https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.1.tar.gz', 'local': 'python-dateutil-2.1.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    44     'PYTHON-DATEUTIL' : {'setup':'python-dateutil', 'url':'https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.1.tar.gz', 'local': 'python-dateutil-2.1.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    43     'PYYAML' : {'setup':'pyyaml', 'url':'http://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.11.tar.gz', 'local': 'PyYAML-3.11.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    45     'PYYAML' : {'setup':'pyyaml', 'url':'http://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.11.tar.gz', 'local': 'PyYAML-3.11.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    44     'PYTHON-DIGEST' : {'setup':'python-digest', 'url':'http://pypi.python.org/packages/source/p/python-digest/python-digest-1.7.tar.gz', 'local': 'python-digest-1.7.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    46     'PYTHON-DIGEST' : {'setup':'python-digest', 'url':'http://pypi.python.org/packages/source/p/python-digest/python-digest-1.7.tar.gz', 'local': 'python-digest-1.7.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    45     'DEFUSEDXML' : {'setup':'defusedxml', 'url':'https://pypi.python.org/packages/source/d/defusedxml/defusedxml-0.4.1.tar.gz', 'local': 'defusedxml-0.4.1.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    47     'DEFUSEDXML' : {'setup':'defusedxml', 'url':'https://pypi.python.org/packages/source/d/defusedxml/defusedxml-0.4.1.tar.gz', 'local': 'defusedxml-0.4.1.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    46     'DJANGO-TASTYPIE' : {'setup':'django-tastypie', 'url':'https://github.com/toastdriven/django-tastypie/archive/130cb64eb6c0e688b1efe3b9839fbd86f034b4ed.tar.gz', 'local': 'django-tastypie-130cb64eb6c0e688b1efe3b9839fbd86f034b4ed.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    48     'DJANGO-TASTYPIE' : {'setup':'django-tastypie', 'url':'https://github.com/toastdriven/django-tastypie/archive/130cb64eb6c0e688b1efe3b9839fbd86f034b4ed.tar.gz', 'local': 'django-tastypie-0.12.2.dev0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    47     'DJANGO-CORS-HEADERS' : {'setup':'django-cors-headers', 'url':'https://github.com/ottoyiu/django-cors-headers/archive/1.0.0.tar.gz', 'local': 'django-cors-headers-1.0.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    49     'DJANGO-CORS-HEADERS' : {'setup':'django-cors-headers', 'url':'https://github.com/ottoyiu/django-cors-headers/archive/1.0.0.tar.gz', 'local': 'django-cors-headers-1.0.0.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    48     'DJANGO-CHUNCKED-UPLOADS' : {'setup': 'django-chuncked-uploads', 'url':'https://github.com/IRI-Research/django-chunked-uploads/archive/v0.5.tar.gz', 'local':'django-chunked-uploads-0.5.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
    50     'DJANGO-CHUNCKED-UPLOADS' : {'setup': 'django-chuncked-uploads', 'url':'https://github.com/IRI-Research/django-chunked-uploads/archive/v0.6.tar.gz', 'local':'django-chunked-uploads-0.6.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
       
    51     'OAUTHLIB': { 'setup': 'oauthlib', 'url':"https://github.com/idan/oauthlib/archive/0.7.2.tar.gz", 'local':"oauthlib-0.7.2.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    52     'URLLIB3': { 'setup': 'urllib3', 'url':'https://github.com/shazow/urllib3/archive/1.10.4.tar.gz', 'local':"urllib3-1.10.4.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    53     'SIMPLEJSON' : { 'setup': 'simplejson', 'url': 'https://github.com/simplejson/simplejson/archive/v3.6.5.tar.gz', 'local' : 'simplejson-3.6.5.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    54     'PYJWT' : { 'setup': 'pyjwt', 'url': 'https://github.com/jpadilla/pyjwt/archive/1.1.0.tar.gz', 'local' : 'pyjwt-1.1.0.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    55     'PYTHON-MIMEPARSE': { 'setup': 'python-mimeparse', 'url': 'https://pypi.python.org/packages/source/p/python-mimeparse/python-mimeparse-0.1.4.tar.gz', 'local' : 'python-mimeparse-0.1.4.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    56     'REQUESTS-OAUTHLIB': { 'setup': 'requests-oauthlib', 'url': 'https://github.com/requests/requests-oauthlib/archive/v0.5.0.tar.gz', 'local' : 'requests-oauthlib-0.5.0.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    57     'SOUTH': { 'setup': 'South', 'url':'http://www.aeracode.org/releases/south/south-1.0.2.tar.gz', 'local':"south-1.0.2.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    49 }
    58 }
    50 
    59 
    51 if system_str == 'Windows':
    60 if system_str == 'Windows':
    52     
    61     
    53     size = 8 * struct.calcsize("P")
    62     size = 8 * struct.calcsize("P")
    61         'PIL': {'setup': 'pil', 'url': 'http://effbot.org/media/downloads/PIL-1.1.7.win32-py2.7.exe', 'local':"PIL-1.1.7.win32-py2.7.exe", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
    70         'PIL': {'setup': 'pil', 'url': 'http://effbot.org/media/downloads/PIL-1.1.7.win32-py2.7.exe', 'local':"PIL-1.1.7.win32-py2.7.exe", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
    62         'LXML': {'setup': 'lxml', 'url': 'http://pypi.python.org/packages/2.7/l/lxml/lxml-2.3-py2.7-win32.egg', 'local':"lxml-2.3-py2.7-win32.egg", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
    71         'LXML': {'setup': 'lxml', 'url': 'http://pypi.python.org/packages/2.7/l/lxml/lxml-2.3-py2.7-win32.egg', 'local':"lxml-2.3-py2.7-win32.egg", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
    63         'MYSQL': { 'setup': 'mysql-python', 'url': mysqlres, 'local': mysqlres, 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
    72         'MYSQL': { 'setup': 'mysql-python', 'url': mysqlres, 'local': mysqlres, 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
    64     })
    73     })
    65 else:
    74 else:
    66     if system_str == "Darwin":        
    75     if system_str == "Darwin":
    67         lxml_options = {'STATIC_DEPS': 'true', 'LIBXML2_VERSION': '2.9.2', 'LIBXSLT_VERSION': '1.1.28', 'LIBICONV_VERSION': '1.14'}
    76         lxml_options = {'STATIC_DEPS': 'true', 'LIBXML2_VERSION': '2.9.2', 'LIBXSLT_VERSION': '1.1.28', 'LIBICONV_VERSION': '1.14'}
    68         lxml_method = 'pip'
       
    69         if os.path.exists('/usr/local/opt/xz'):
    77         if os.path.exists('/usr/local/opt/xz'):
    70             if not os.path.exists('/usr/local/opt/libxml2'):
    78             if not os.path.exists('/usr/local/opt/libxml2'):
    71                 sys.exit("You have installed xz with Homebrew but do not have libxml2 installed with Homebrew. Install libxml2 with Homebrew and try again.")
    79                 sys.exit("You have installed xz with Homebrew but do not have libxml2 installed with Homebrew. Install libxml2 with Homebrew and try again.")
    72             lxml_options = {'LDFLAGS': '-L/usr/local/opt/libxml2/lib', 'CPPFLAGS': '-I/usr/local/opt/libxml2/include'}
    80             lxml_options = {'LDFLAGS': '-L/usr/local/opt/libxml2/lib', 'CPPFLAGS': '-I/usr/local/opt/libxml2/include'}
    73         mysql_method = 'install_mysql'
    81         mysql_method = 'install_mysql'
    74     else:
    82     else:
    75         lxml_options = None
    83         lxml_options = None
    76         lxml_method = 'easy_install'
       
    77         lxml_file = 'lxml-3.2.1.tar.bz2'
       
    78         mysql_method = 'pip'
    84         mysql_method = 'pip'
    79 
    85 
    80     URLS.update({
    86     URLS.update({
    81         'PSYCOPG2': {'setup': 'psycopg2','url': 'http://initd.org/psycopg/tarballs/PSYCOPG-2-6/psycopg2-2.6.tar.gz', 'local':"psycopg2-2.6.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    87         'PSYCOPG2': {'setup': 'psycopg2','url': 'http://initd.org/psycopg/tarballs/PSYCOPG-2-6/psycopg2-2.6.tar.gz', 'local':"psycopg2-2.6.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    82         'PIL': {'setup': 'pil', 'url': 'https://github.com/python-imaging/Pillow/archive/2.8.1.tar.gz', 'local':"Pillow-2.8.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    88         'PIL': {'setup': 'pillow', 'url': 'https://github.com/python-pillow/Pillow/archive/2.8.1.tar.gz', 'local':"Pillow-2.8.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
    83         'LXML': {'setup': 'lxml', 'url': 'lxml-3.2.1.tar.bz2', 'local': 'lxml-3.2.1.tar.bz2', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': lxml_options}},
    89         'LXML': {'setup': 'lxml', 'url': 'lxml-3.2.1.tar.bz2', 'local': 'lxml-3.2.1.tar.bz2', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': lxml_options}},
    84         'MYSQL': { 'setup': 'mysql-python', 'url': 'http://downloads.sourceforge.net/project/mysql-python/mysql-python-test/1.2.4b4/MySQL-python-1.2.4b4.tar.gz', 'local':"MySQL-python-1.2.4b4.tar.gz", 'install': {'method': mysql_method, 'option_str': None, 'dict_extra_env': None}},
    90         'MYSQL': { 'setup': 'mysql-python', 'url': 'http://downloads.sourceforge.net/project/mysql-python/mysql-python-test/1.2.4b4/MySQL-python-1.2.4b4.tar.gz', 'local':"MySQL-python-1.2.4b4.tar.gz", 'install': {'method': mysql_method, 'option_str': None, 'dict_extra_env': None}},
    85     })
    91     })
    86     
    92     
    87 
    93 
    88 class ResourcesEnv(object):
    94 class ResourcesEnv(object):
    89 
    95 
    90     def __init__(self, src_base, urls, normal_installs):
    96     def __init__(self, src_base, run_base, urls, normal_installs):
    91         self.src_base = src_base
    97         self.src_base = src_base
       
    98         self.run_base = run_base
    92         self.URLS = {}
    99         self.URLS = {}
    93         self.__init_url(urls)
   100         self.__init_url(urls)
    94         self.NORMAL_INSTALL = normal_installs
   101         self.NORMAL_INSTALL = normal_installs
    95 
   102 
    96     def get_src_base_path(self, fpath):
   103     def get_src_base_path(self, fpath):
    97         return os.path.abspath(os.path.join(self.src_base, fpath)).replace("\\","/")
   104         return os.path.abspath(os.path.join(self.src_base, fpath)).replace("\\","/")
       
   105 
       
   106     def get_run_res_base_path(self, fpath):
       
   107         return os.path.abspath(os.path.join(self.run_base, 'res', fpath)).replace("\\","/")    
    98     
   108     
    99     def __add_package_def(self, key, dict):
   109     def __add_package_def(self, key, dict):
   100         self.URLS[key] = dict
   110         self.URLS[key] = dict
   101         
   111         
   102     def __init_url(self, urls):
   112     def __init_url(self, urls):
   103         for key, url_dict in urls.items():
   113         for key, url_dict in urls.items():
   104             url_dict_copy = url_dict.copy()
   114             url_dict_copy = url_dict.copy()
       
   115             if url_dict.get('install', {}).get('method','pip') == 'pip-req':
       
   116                 get_base_path = self.get_run_res_base_path
       
   117             else:
       
   118                 get_base_path = self.get_src_base_path
   105             if not url_dict['url'].startswith("http://"):
   119             if not url_dict['url'].startswith("http://"):
   106                 url_dict_copy['url'] = self.get_src_base_path(url_dict['url'])
   120                 url_dict_copy['url'] = get_base_path(url_dict['url'])
   107             url_dict_copy['local'] = self.get_src_base_path(url_dict['local'])            
   121             url_dict_copy['local'] = get_base_path(url_dict['local'])
   108             
   122 
   109             self.__add_package_def(key, url_dict_copy )
   123             self.__add_package_def(key, url_dict_copy )
   110 
   124 
   111 def ensure_dir(dir, logger):
   125 def ensure_dir(dir, logger):
   112     logger.notify('Check directory %s' % dir)
   126     logger.notify('Check directory %s' % dir)
   113     if not os.path.exists(dir):
   127     if not os.path.exists(dir):
   129     parser.add_option(
   143     parser.add_option(
   130         '--ignore-packages',
   144         '--ignore-packages',
   131         metavar='ignore_packages',
   145         metavar='ignore_packages',
   132         dest='ignore_packages',
   146         dest='ignore_packages',
   133         default=None,
   147         default=None,
   134         help='list of comma separated keys for package to ignore')    
   148         help='list of comma separated keys for package to ignore')
       
   149     parser.add_option(
       
   150         '--no-clear',
       
   151         metavar='do not clear env',
       
   152         dest='clear',
       
   153         default=True,
       
   154         action='store_false',
       
   155         help='do not clear env')
       
   156 
       
   157 
   135 
   158 
   136 def install_psycopg2(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop):
   159 def install_psycopg2(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop):
   137     psycopg2_src = os.path.join(src_dir,"psycopg2.zip")
   160     psycopg2_src = os.path.join(src_dir,"psycopg2.zip")
   138     shutil.copy(res_env.URLS['PSYCOPG2'][res_source_key], psycopg2_src)
   161     shutil.copy(res_env.URLS['PSYCOPG2'][res_source_key], psycopg2_src)
   139     #extract psycopg2
   162     #extract psycopg2
   193         cwd=os.path.abspath(tmp_dir),
   216         cwd=os.path.abspath(tmp_dir),
   194         filter_stdout=filter_python_develop,
   217         filter_stdout=filter_python_develop,
   195         show_stdout=True)
   218         show_stdout=True)
   196 
   219 
   197 
   220 
   198 def gen_install_comp_lib(lib_name, lib_key, configure_options=[]):
   221 def gen_install_comp_lib(lib_name, lib_key, configure_options=[], configure_env={}):
   199     
   222     
   200     def install_lib(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop):
   223     def install_lib(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop):
   201         lib_src = os.path.join(src_dir,lib_name+".tar.gz")
   224         lib_src = os.path.join(src_dir,lib_name+".tar.gz")
   202         logger.notify("Copy %s to %s " % (res_env.URLS[lib_key][res_source_key],lib_src))
   225         logger.notify("Copy %s to %s " % (res_env.URLS[lib_key][res_source_key],lib_src))
   203         shutil.copy(res_env.URLS[lib_key][res_source_key], lib_src)
   226         shutil.copy(res_env.URLS[lib_key][res_source_key], lib_src)
   206         logger.notify("Extract %s to %s " % (lib_name,lib_base_path))
   229         logger.notify("Extract %s to %s " % (lib_name,lib_base_path))
   207         tf.extractall(lib_base_path)
   230         tf.extractall(lib_base_path)
   208         tf.close()
   231         tf.close()
   209         
   232         
   210         lib_src_path = os.path.join(lib_base_path, os.listdir(lib_base_path)[0])
   233         lib_src_path = os.path.join(lib_base_path, os.listdir(lib_base_path)[0])
       
   234         
       
   235         
       
   236         context_map = {
       
   237             'option_str' : option_str,
       
   238             'home_dir': os.path.abspath(home_dir),
       
   239             'lib_dir': os.path.abspath(lib_dir),
       
   240             'tmp_dir': os.path.abspath(tmp_dir),
       
   241             'src_dir': os.path.abspath(src_dir),
       
   242         }
       
   243         
       
   244         configure_options_trans = map(lambda s: s % context_map, configure_options)
       
   245         configure_env_trans = {k: s % context_map for k,s in configure_env.items()}
   211     
   246     
   212         logger.notify(lib_name + " configure in " + lib_src_path)
   247         logger.notify(lib_name + " configure in " + lib_src_path)
   213         call_subprocess(['./configure', '--prefix='+os.path.abspath(home_dir)] + configure_options,
   248         call_subprocess(['./configure', '--prefix='+os.path.abspath(home_dir)] + configure_options_trans,
   214                         cwd=os.path.abspath(lib_src_path),
   249                         cwd=os.path.abspath(lib_src_path),
   215                         filter_stdout=filter_python_develop,
   250                         filter_stdout=filter_python_develop,
   216                         show_stdout=True)
   251                         show_stdout=True,
   217         
   252                         extra_env=configure_env_trans
       
   253                         )
       
   254 
   218         logger.notify(lib_name + " make in " + lib_src_path)
   255         logger.notify(lib_name + " make in " + lib_src_path)
   219         call_subprocess(['make'],
   256         call_subprocess(['make'],
   220                         cwd=os.path.abspath(lib_src_path),
   257                         cwd=os.path.abspath(lib_src_path),
   221                         filter_stdout=filter_python_develop,
   258                         filter_stdout=filter_python_develop,
   222                         show_stdout=True)
   259                         show_stdout=True)
   226                         cwd=os.path.abspath(lib_src_path),
   263                         cwd=os.path.abspath(lib_src_path),
   227                         filter_stdout=filter_python_develop,
   264                         filter_stdout=filter_python_develop,
   228                         show_stdout=True)
   265                         show_stdout=True)
   229     return install_lib
   266     return install_lib
   230 
   267 
   231 install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared'])
   268 install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared'], {})
   232 install_zlib = gen_install_comp_lib("zlib", "ZLIB", [])
   269 install_zlib = gen_install_comp_lib("zlib", "ZLIB", [], {})
   233     
   270 
   234 
   271 #osx_extra_env = {'ARCHFLAGS': '-Wno-error=unused-command-line-argument-hard-error-in-future', 'CFLAGS': '-Qunused-arguments', 'CPPFLAGS': '-Qunused-arguments'}
   235 def lib_generate_install_methods(path_locations, src_base, Logger, call_subprocess, normal_installs, options_to_add=None, urls= None):
   272 osx_extra_env = {}
       
   273 
       
   274 def lib_generate_install_methods(path_locations, src_base, run_base, Logger, call_subprocess, normal_installs, options_to_add=None, urls= None):
   236     
   275     
   237     all_urls = URLS.copy()
   276     all_urls = URLS.copy()
   238     if urls is not None:
   277     if urls is not None:
   239         all_urls.update(urls)
   278         all_urls.update(urls)
   240         
   279         
   241     res_env = ResourcesEnv(src_base, all_urls, normal_installs)
   280     res_env = ResourcesEnv(src_base, run_base, all_urls, normal_installs)
   242 
   281 
   243     def filter_python_develop(line):
   282     def filter_python_develop(line):
   244         if not line.strip():
   283         if not line.strip():
   245             return Logger.DEBUG
   284             return Logger.DEBUG
   246         for prefix in ['Searching for', 'Reading ', 'Best match: ', 'Processing ',
   285         for prefix in ['Searching for', 'Reading ', 'Best match: ', 'Processing ',
   249             if line.startswith(prefix):
   288             if line.startswith(prefix):
   250                 return Logger.DEBUG
   289                 return Logger.DEBUG
   251         return Logger.NOTIFY
   290         return Logger.NOTIFY
   252     
   291     
   253     
   292     
   254     def normal_install(key, method, option_str, extra_env, res_source_key, home_dir, tmp_dir, res_env, logger, call_subprocess):
   293     def normal_install(key, res_path, method, option_str, extra_env, res_source_key, home_dir, tmp_dir, res_env, logger, call_subprocess):
   255         logger.notify("Install %s from %s with %s" % (key,res_env.URLS[key][res_source_key],method))
   294         logger.notify("Install %s from %s with %s" % (key,res_path,method))
   256         if method == 'pip':
   295         if method == 'pip':
   257             if sys.platform == 'win32':
   296             if sys.platform == 'win32':
   258                 args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'pip')), 'install', res_env.URLS[key][res_source_key]]
   297                 args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'pip')), 'install', res_path]
   259             else:
   298             else:
   260                 args = [os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', res_env.URLS[key][res_source_key]]
   299                 args = [os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', res_path]
   261             if option_str :
   300             if option_str :
   262                 args.insert(4,option_str)
   301                 args.append(option_str)
       
   302             if res_source_key == 'local':
       
   303                 if extra_env is None:
       
   304                     extra_env = {}
       
   305                 args.insert(2, '-f')
       
   306                 args.insert(3, res_env.get_src_base_path(""))
       
   307                 args.insert(4, '--no-index')
       
   308             logger.notify("Install %s from %s with %s args %s " % (key,res_path,method, repr(args)))
       
   309             call_subprocess(args,
       
   310                     cwd=os.path.abspath(tmp_dir),
       
   311                     filter_stdout=filter_python_develop,
       
   312                     show_stdout=True,
       
   313                     extra_env=extra_env)
       
   314         if method == 'pip-req':
       
   315             if sys.platform == 'win32':
       
   316                 args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'pip')), 'install', '-r', res_path]
       
   317             else:
       
   318                 args = [os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-r', res_path]
       
   319             if option_str :
       
   320                 args.append(option_str)
       
   321             if res_source_key == 'local':
       
   322                 if extra_env is None:
       
   323                     extra_env = {}
       
   324                 args.insert(2, '-f')
       
   325                 args.insert(3, res_env.get_src_base_path(""))
       
   326                 args.insert(4, '--no-index')
       
   327             logger.notify("Install %s from %s with %s args %s " % (key,res_path,method, repr(args)))
   263             call_subprocess(args,
   328             call_subprocess(args,
   264                     cwd=os.path.abspath(tmp_dir),
   329                     cwd=os.path.abspath(tmp_dir),
   265                     filter_stdout=filter_python_develop,
   330                     filter_stdout=filter_python_develop,
   266                     show_stdout=True,
   331                     show_stdout=True,
   267                     extra_env=extra_env)
   332                     extra_env=extra_env)
   268         else:
   333         else:
   269             if sys.platform == 'win32':
   334             if sys.platform == 'win32':
   270                 args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'easy_install')), res_env.URLS[key][res_source_key]]
   335                 args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'easy_install')), res_path]
   271             else:
   336             else:
   272                 args = [os.path.abspath(os.path.join(home_dir, 'bin', 'easy_install')), res_env.URLS[key][res_source_key]]
   337                 args = [os.path.abspath(os.path.join(home_dir, 'bin', 'easy_install')), res_path]
   273             if option_str :
   338             if option_str :
   274                 args.insert(1,option_str)
   339                 args.insert(1,option_str)
   275             call_subprocess(args,
   340             call_subprocess(args,
   276                     cwd=os.path.abspath(tmp_dir),
   341                     cwd=os.path.abspath(tmp_dir),
   277                     filter_stdout=filter_python_develop,
   342                     filter_stdout=filter_python_develop,
   278                     show_stdout=True,
   343                     show_stdout=True,
   279                     extra_env=extra_env)            
   344                     extra_env=extra_env)
   280  
   345  
   281     
   346     
   282     def after_install(options, home_dir):
   347     def after_install(options, home_dir):
   283         
   348         
   284         global logger
   349         global logger
   310             ignore_packages = options.ignore_packages.split(",")
   375             ignore_packages = options.ignore_packages.split(",")
   311         
   376         
   312         logger.indent += 2
   377         logger.indent += 2
   313         try:    
   378         try:    
   314             for key in res_env.NORMAL_INSTALL:
   379             for key in res_env.NORMAL_INSTALL:
   315                 if key not in res_env.URLS:
   380                 install_options = None
   316                     logger.notify("%s not found in def : passing" % (key,))
   381                 if isinstance(key, dict):
   317                 install_options = res_env.URLS[key].get('install', None)
   382                     install_options = key.get('install', default_install_options)
       
   383                     install_options['method'] = 'pip-req'
       
   384                     res_path = res_env.get_run_res_base_path(key['requirement'])
       
   385                 else:
       
   386                     if key not in res_env.URLS:
       
   387                         logger.notify("%s not found in def : passing" % (key,))
       
   388                     install_options = res_env.URLS[key].get('install', None)
       
   389                     res_path = res_env.URLS[key][res_source_key]
   318                 if install_options is None:
   390                 if install_options is None:
   319                     install_options = default_install_options
   391                     install_options = default_install_options
   320                 method = install_options.get('method', default_install_options['method'])
   392                 method = install_options.get('method', default_install_options['method'])
   321                 option_str = install_options.get('option_str', default_install_options['option_str'])
   393                 option_str = install_options.get('option_str', default_install_options['option_str'])
   322                 extra_env = install_options.get('dict_extra_env', default_install_options['dict_extra_env'])
   394                 extra_env = install_options.get('dict_extra_env', default_install_options['dict_extra_env'])
   323                 if not extra_env:
   395                 if not extra_env:
   324                     extra_env = {}
   396                     extra_env = {}
   325                     
   397                     
   326                 if 'TMPDIR' not in extra_env:
   398                 if 'TMPDIR' not in extra_env:
   327                     extra_env['TMPDIR'] = os.path.abspath(tmp_dir)          
   399                     extra_env['TMPDIR'] = os.path.abspath(tmp_dir)
       
   400                 if system_str == 'Darwin':
       
   401                     for flag_key, flag_value in iter(osx_extra_env.items()):
       
   402                         flags = extra_env.get(flag_key, '')
       
   403                         if flag_value not in flags:
       
   404                             #flags += " -Wno-error=unused-command-line-argument-hard-error-in-future"
       
   405                             flags += " "+flag_value
       
   406                             extra_env[flag_key] = flags.strip()
       
   407                     
   328                 #isinstance(lst, (list, tuple))
   408                 #isinstance(lst, (list, tuple))
   329                 if key not in ignore_packages:
   409                 if key not in ignore_packages:
   330                     logger.notify("install %s with method %s" % (key, repr(method)))
   410                     logger.notify("install %s with method %s" % (key, repr(method)))
   331                     if callable(method):
   411                     if callable(method):
   332                         method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop)
   412                         method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop)
   333                     elif method in globals() and callable(globals()[method]) and method not in ['pip', 'easy_install']:  
   413                     elif method in globals() and callable(globals()[method]) and method not in ['pip', 'easy_install']:  
   334                         globals()[method](option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop)
   414                         globals()[method](option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop)
   335                     else:
   415                     else:
   336                         normal_install(key, method, option_str, extra_env, res_source_key, home_dir, tmp_dir, res_env, logger, call_subprocess)
   416                         normal_install(key, res_path, method, option_str, extra_env, res_source_key, home_dir, tmp_dir, res_env, logger, call_subprocess)
   337                             
   417                             
   338             logger.notify("Clear source dir")
   418             logger.notify("Clear source dir")
   339             shutil.rmtree(src_dir)
   419             shutil.rmtree(src_dir)
   340     
   420     
   341         finally:
   421         finally:
   344         logger.notify('Run "%s Package" to install new packages that provide builds'
   424         logger.notify('Run "%s Package" to install new packages that provide builds'
   345                       % join(script_dir, 'easy_install'))
   425                       % join(script_dir, 'easy_install'))
   346     
   426     
   347     def adjust_options(options, args):
   427     def adjust_options(options, args):
   348         if not options_to_add:
   428         if not options_to_add:
   349             pass
   429             return
   350         for opt in options_to_add:
   430         for opt,opt_val in options_to_add.items():
   351             test_opt = opt.split('=',1)[0]
       
   352             #if not hasattr(options,test_opt) or getattr(options, test_opt) is None:
   431             #if not hasattr(options,test_opt) or getattr(options, test_opt) is None:
   353             setattr(options, test_opt,opt.split('=',1)[1] if "=" in opt else True)
   432             setattr(options, opt, opt_val)
   354 
   433 
   355     return adjust_options, extend_parser, after_install
   434     return adjust_options, extend_parser, after_install
       
   435