virtualenv/res/lib/lib_create_env.py
author ymh <ymh.work@gmail.com>
Sun, 08 Mar 2015 23:53:23 +0100
changeset 493 09aa28e25840
parent 492 19220d52bce7
child 494 8382775d1344
permissions -rw-r--r--
send email with celery
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
import sys
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
import os
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
import os.path
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
import shutil
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
import tarfile
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
import zipfile
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
import urllib
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
import platform
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
import patch
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    10
import struct
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    11
import glob
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    12
import re
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
join = os.path.join
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
system_str = platform.system()
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
URLS = {
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
    #'': {'setup': '', 'url':'', 'local':''},
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    19
    'DISTRIBUTE': {'setup': 'distribute', 'url':'http://pypi.python.org/packages/source/d/distribute/distribute-0.6.24.tar.gz', 'local':"distribute-0.6.24.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    20
    'DJANGO': {'setup': 'django', 'url': 'https://www.djangoproject.com/download/1.6.8/tarball/', 'local':"Django-1.6.8.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    21
    'DJANGO-EXTENSIONS': { 'setup': 'django-extensions', 'url':'https://github.com/django-extensions/django-extensions/archive/1.4.4.tar.gz', 'local':"django-extensions-1.4.4.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    22
    'REGISTRATION': { 'setup': 'django-registration', 'url':'https://github.com/macropin/django-registration/archive/v1.1.tar.gz', 'local':"django-registration-1.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    23
    'HTTPLIB2': { 'setup': 'httplib2', 'url':'https://github.com/jcgregorio/httplib2/archive/v0.9.tar.gz', 'local':"httplib2-0.7.4.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    24
    'SOUTH': { 'setup': 'South', 'url':'http://www.aeracode.org/releases/south/south-1.0.1.tar.gz', 'local':"South-1.0.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    25
    'PYCRYPTO': {'setup': 'pycrypto', 'url':'https://github.com/dlitz/pycrypto/archive/v2.6.1.tar.gz', 'local':'pycrypto-2.6.1.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    26
    '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}},
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    27
    '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}},
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    28
    'MERCURIAL': {'setup': 'mercurial', 'url':'http://mercurial.selenic.com/release/mercurial-2.2.3.tar.gz', 'local':'mercurial-2.2.3.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    29
    'HAYSTACK': {'setup': 'django-haystack', 'url': 'https://github.com/toastdriven/django-haystack/archive/v2.2.0.tar.gz', 'local': 'django-haystack-2.2.0.tar.gz', 'install':{'method':'pip', 'option_str': None, 'dict_extra_env': None}},
271
8f77cf71ab02 commit the venv update (django and dependancies) in the good head
cavaliet
parents: 258
diff changeset
    30
    'WHOOSH': {'setup': 'whoosh', 'url':'https://pypi.python.org/packages/source/W/Whoosh/Whoosh-2.5.7.tar.gz', 'local':'whoosh-2.5.7.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    31
    'WIKITOOLS' : { 'setup': 'wikitools', 'url': 'https://github.com/alexz-enwp/wikitools/archive/1.2.tar.gz', 'local': 'wikitools-1.2.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
361
a1b85604132c upgrade rdflib to correct unicode bugs
ymh <ymh.work@gmail.com>
parents: 346
diff changeset
    32
    'ISODATE' : {'setup': 'isodate', 'url': 'http://pypi.python.org/packages/source/i/isodate/isodate-0.5.1.tar.gz', 'local': 'isodate-0.5.1.tar.gz', 'install' : {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
443
27f71b0a772d next version of import_rdf
ymh <ymh.work@gmail.com>
parents: 442
diff changeset
    33
    'RDFLIB' : { 'setup': 'rdflib', 'url': 'https://github.com/IRI-Research/rdflib/archive/30f0f8ca7dba3e9dbfef39fb2006e4b395748f6c.tar.gz', 'local': 'rdflib-4.2.0-dev.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    34
    'SPARQLWRAPPER' : { 'setup': 'SPARQLWrapper', 'url': 'https://github.com/RDFLib/sparqlwrapper/archive/1.6.4.tar.gz', 'local' : 'SPARQLWrapper-1.6.4.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},    
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    35
    'REQUESTS' : { 'setup': 'requests', 'url': 'https://github.com/kennethreitz/requests/archive/v2.4.3.tar.gz', 'local' : 'requests-2.4.3.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    36
    'ELASTICSEARCH' : { 'setup': 'elasticsearch', 'url': 'https://github.com/elasticsearch/elasticsearch-py/archive/1.2.0.tar.gz', 'local' : 'elasticsearch-1.2.0.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    37
    'PYPARSING' : { 'setup': 'pyparsing', 'url': 'https://pypi.python.org/packages/source/p/pyparsing/pyparsing-2.0.3.tar.gz', 'local' : 'pyparsing-2.0.3.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    38
    'PIL' : { 'setup': 'pil', 'url': 'http://effbot.org/downloads/Imaging-1.1.7.tar.gz', 'local' : 'Imaging-1.1.7.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    39
    'EASYTHUMBNAIL' : { 'setup': 'easy-thumbnail', 'url': 'https://github.com/SmileyChris/easy-thumbnails/archive/2.2.tar.gz', 'local' : 'easy-thumbnails-2.2.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    40
    'SIX' : { 'setup': 'six', 'url': 'https://pypi.python.org/packages/source/s/six/six-1.8.0.tar.gz', 'local' : 'six-1.8.0.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    41
    '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}},
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    42
    'HTML5LIB' : { 'setup': 'html5lib', 'url': 'https://github.com/html5lib/html5lib-python/archive/0.999.tar.gz', 'local' : 'html5lib-0.999.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
346
c1e662b964d4 Intermediary commit for test installation
ymh <ymh.work@gmail.com>
parents: 345
diff changeset
    43
    'URLLIB3': { 'setup': 'urllib3', 'url':'https://github.com/shazow/urllib3/archive/1.9.1.tar.gz', 'local':"urllib3-1.9.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
442
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
    44
    'PKGCONFIG': { 'setup': 'pkg-config', 'url':'pkg-config-0.28.tar.gz', 'local':"pkg-config-0.28.tar.gz", 'install': {'method': 'install_pkgconfig', 'option_str': None, 'dict_extra_env': None}},
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
    45
    'SQLITE': { 'setup': 'SQLITE', 'url':'sqlite-autoconf-3080701.tar.gz', 'local':"sqlite-autoconf-3080701.tar.gz", 'install': {'method': 'install_sqlite', 'option_str': None, 'dict_extra_env': None}},
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
    46
    'UNIXODBC': { 'setup': 'unixODBC', 'url':'unixODBC-2.3.2.tar.gz', 'local':"unixODBC-2.3.2.tar.gz", 'install': {'method': 'install_unixODBC', 'option_str': None, 'dict_extra_env': None}},
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
    47
    'RAPTOR2': { 'setup': 'raptor2', 'url':'raptor2-2.0.15.tar.gz', 'local':"raptor2-2.0.15.tar.gz", 'install': {'method': 'install_raptor2', 'option_str': None, 'dict_extra_env': None}},
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
    48
    'RASQAL': { 'setup': 'rasqal', 'url':'rasqal-0.9.32.tar.gz', 'local':"rasqal-0.9.32.tar.gz", 'install': {'method': 'install_rasqal', 'option_str': None, 'dict_extra_env': None}},
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
    49
    'REDLAND': { 'setup': 'redland', 'url':'redland-1.0.17.tar.gz', 'local':"redland-1.0.17.tar.gz", 'install': {'method': 'install_redland', 'option_str': None, 'dict_extra_env': None}},
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
    50
    'REDLAND_BINDINGS': { 'setup': 'redland_bindings', 'url':'redland-bindings-1.0.17.1.tar.gz', 'local':"redland-bindings-1.0.17.1.tar.gz", 'install': {'method': 'install_redland_bindings', 'option_str': None, 'dict_extra_env': None}},
443
27f71b0a772d next version of import_rdf
ymh <ymh.work@gmail.com>
parents: 442
diff changeset
    51
    'UNIDECODE': { 'setup': 'unidecode', 'url':'https://pypi.python.org/packages/source/U/Unidecode/Unidecode-0.04.17.tar.gz', 'local':"Unidecode-0.04.17.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
27f71b0a772d next version of import_rdf
ymh <ymh.work@gmail.com>
parents: 442
diff changeset
    52
    'PYTZ': { 'setup': 'pytz', 'url':'https://pypi.python.org/packages/source/p/pytz/pytz-2014.10.tar.bz2', 'local':"pytz-2014.10.tar.bz2", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
492
19220d52bce7 add preview calculation
ymh <ymh.work@gmail.com>
parents: 452
diff changeset
    53
    'KOMBU': { 'setup': 'kombu', 'url':'https://github.com/celery/kombu/archive/v3.0.24.tar.gz', 'local':"kombu-3.0.24.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
19220d52bce7 add preview calculation
ymh <ymh.work@gmail.com>
parents: 452
diff changeset
    54
    'AMQP': { 'setup': 'amqp', 'url':'https://github.com/celery/py-amqp/archive/v1.4.6.tar.gz', 'local':"py-amqp-1.4.6.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
19220d52bce7 add preview calculation
ymh <ymh.work@gmail.com>
parents: 452
diff changeset
    55
    'ANYJSON': { 'setup': 'anyjson', 'url':'https://bitbucket.org/runeh/anyjson/get/0.3.3.tar.gz', 'local':"anyjson-0.3.3.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
19220d52bce7 add preview calculation
ymh <ymh.work@gmail.com>
parents: 452
diff changeset
    56
    'BILLIARD': { 'setup': 'billiard', 'url':'https://github.com/celery/billiard/archive/v3.3.0.19.tar.gz', 'local':"billiard-3.3.0.19.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
19220d52bce7 add preview calculation
ymh <ymh.work@gmail.com>
parents: 452
diff changeset
    57
    'CELERY': { 'setup': 'celery', 'url':'https://github.com/celery/celery/archive/v3.1.17.tar.gz', 'local':"celery-3.1.17.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
493
09aa28e25840 send email with celery
ymh <ymh.work@gmail.com>
parents: 492
diff changeset
    58
    'APPCONF': { 'setup': 'django-appconf', 'url':'https://github.com/jezdez/django-appconf/archive/v1.0.1.tar.gz', 'local':"django-appconf-1.0.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
09aa28e25840 send email with celery
ymh <ymh.work@gmail.com>
parents: 492
diff changeset
    59
    'CELERY-EMAIL': { 'setup': 'django-celery-email', 'url':'https://github.com/pmclanahan/django-celery-email/archive/1.1.0.tar.gz', 'local':"django-celery-email-1.1.0.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
}
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
442
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
    62
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
    63
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
if system_str == 'Windows':
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    65
    
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
    URLS.update({
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    67
        '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}},
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    68
        '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}},
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    69
        '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}},
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    70
        'PYYAML' : { 'setup': 'PyYAML', 'url': 'http://pyyaml.org/download/pyyaml/PyYAML-3.09.win32-py2.6.exe', 'local': 'PyYAML-3.09.win32-py2.6.exe', 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
10
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
    71
        'PYSTEMMER' : { 'setup': 'pystemmer', 'url': 'PyStemmer_compiled_for_pc.zip', 'local': 'PyStemmer_compiled_for_pc.zip'},
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
    })
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
else:
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    74
    if system_str == "Darwin":
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    75
        lxml_options = {'STATIC_DEPS': 'true', 'LIBXML2_VERSION': '2.9.2', 'LIBXSLT_VERSION': '1.1.28', 'LIBICONV_VERSION': '1.14'}
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    76
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    77
        lxml_options = None
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    78
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
    URLS.update({
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    80
        'PSYCOPG2': {'setup': 'psycopg2','url': 'http://initd.org/psycopg/tarballs/PSYCOPG-2-5/psycopg2-2.5.4.tar.gz', 'local':"psycopg2-2.5.4.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    81
        '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}},
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    82
        'LXML': {'setup': 'lxml', 'url':"lxml-3.4.0.tar.gz", 'local':"lxml-3.4.0.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': lxml_options}},
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    83
        'PYYAML' : { 'setup': 'PyYAML', 'url': 'http://pyyaml.org/download/pyyaml/PyYAML-3.11.tar.gz', 'local': 'PyYAML-3.11.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
    })
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
    85
    
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
class ResourcesEnv(object):
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    89
    def __init__(self, src_base, run_base, urls, normal_installs):
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
        self.src_base = src_base
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    91
        self.run_base = run_base
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
        self.URLS = {}
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
        self.__init_url(urls)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
        self.NORMAL_INSTALL = normal_installs
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
    def get_src_base_path(self, fpath):
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
        return os.path.abspath(os.path.join(self.src_base, fpath)).replace("\\","/")
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    98
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
    99
    def get_run_res_base_path(self, fpath):
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   100
        return os.path.abspath(os.path.join(self.run_base, 'res', fpath)).replace("\\","/")    
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
    
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   102
    def __add_package_def(self, key, dict):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   103
        self.URLS[key] = dict
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   104
        
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
    def __init_url(self, urls):
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
        for key, url_dict in urls.items():
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   107
            url_dict_copy = url_dict.copy()
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   108
            if url_dict.get('install', {}).get('method','pip') == 'pip-req':
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   109
                get_base_path = self.get_run_res_base_path
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   110
            else:
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   111
                get_base_path = self.get_src_base_path
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   112
            if not url_dict['url'].startswith("http://"):
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   113
                url_dict_copy['url'] = get_base_path(url_dict['url'])
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   114
            url_dict_copy['local'] = get_base_path(url_dict['local'])
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   115
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   116
            self.__add_package_def(key, url_dict_copy )
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
def ensure_dir(dir, logger):
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   119
    logger.notify('Check directory %s' % dir)
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
    if not os.path.exists(dir):
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
        logger.notify('Creating directory %s' % dir)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
        os.makedirs(dir)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
def extend_parser(parser):    
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
    parser.add_option(
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
        '--index-url',
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
        metavar='INDEX_URL',
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
        dest='index_url',
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
        default='http://pypi.python.org/simple/',
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
        help='base URL of Python Package Index')
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
    parser.add_option(
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
        '--type-install',
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
        metavar='type_install',
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
        dest='type_install',
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   135
        help='type install : local, url, setup - default : local')
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
    parser.add_option(
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
        '--ignore-packages',
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
        metavar='ignore_packages',
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
        dest='ignore_packages',
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
        default=None,
442
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   141
        help='list of comma separated keys for package to ignore')
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   142
    parser.add_option(
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   143
        '--no-clear',
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   144
        metavar='do not clear env',
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   145
        dest='clear',
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   146
        default=True,
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   147
        action='store_false',
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   148
        help='do not clear env')
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   149
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   150
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
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):
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
    psycopg2_src = os.path.join(src_dir,"psycopg2.zip")
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
    shutil.copy(res_env.URLS['PSYCOPG2'][res_source_key], psycopg2_src)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
    #extract psycopg2
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
    zf = zipfile.ZipFile(psycopg2_src)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
    psycopg2_base_path = os.path.join(src_dir,"psycopg2")
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
    zf.extractall(psycopg2_base_path)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
    zf.close()
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
    
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
    psycopg2_src_path = os.path.join(psycopg2_base_path, os.listdir(psycopg2_base_path)[0])
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
    shutil.copytree(os.path.join(psycopg2_src_path, 'psycopg2'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'psycopg2')))
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   163
    shutil.copy(os.path.join(psycopg2_src_path, 'psycopg2-2.4.5-py2.7.egg-info'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'site-packages')))
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   164
    
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   165
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   166
442
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   167
def gen_install_comp_lib(lib_name, lib_key, configure_options=[], configure_env={}):
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   168
    
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   169
    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):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   170
        lib_src = os.path.join(src_dir,lib_name+".tar.gz")
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   171
        logger.notify("Copy %s to %s " % (res_env.URLS[lib_key][res_source_key],lib_src))
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   172
        shutil.copy(res_env.URLS[lib_key][res_source_key], lib_src)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   173
        tf = tarfile.open(lib_src,'r:gz')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   174
        lib_base_path = os.path.join(src_dir, lib_name) 
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   175
        logger.notify("Extract %s to %s " % (lib_name,lib_base_path))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   176
        tf.extractall(lib_base_path)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   177
        tf.close()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   178
        
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   179
        lib_src_path = os.path.join(lib_base_path, os.listdir(lib_base_path)[0])
442
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   180
        
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   181
        
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   182
        context_map = {
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   183
            'option_str' : option_str,
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   184
            'home_dir': os.path.abspath(home_dir),
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   185
            'lib_dir': os.path.abspath(lib_dir),
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   186
            'tmp_dir': os.path.abspath(tmp_dir),
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   187
            'src_dir': os.path.abspath(src_dir),
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   188
        }
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   189
        
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   190
        configure_options_trans = map(lambda s: s % context_map, configure_options)
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   191
        configure_env_trans = {k: s % context_map for k,s in configure_env.items()}
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   192
    
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   193
        logger.notify(lib_name + " configure in " + lib_src_path)
442
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   194
        call_subprocess(['./configure', '--prefix='+os.path.abspath(home_dir)] + configure_options_trans,
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   195
                        cwd=os.path.abspath(lib_src_path),
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   196
                        filter_stdout=filter_python_develop,
442
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   197
                        show_stdout=True,
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   198
                        extra_env=configure_env_trans
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   199
                        )
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   200
        
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   201
        logger.notify(lib_name + " make in " + lib_src_path)
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   202
        call_subprocess(['make'],
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   203
                        cwd=os.path.abspath(lib_src_path),
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   204
                        filter_stdout=filter_python_develop,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   205
                        show_stdout=True)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   206
    
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   207
        logger.notify(lib_name + "make install in " + lib_src_path)
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   208
        call_subprocess(['make', 'install'],
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   209
                        cwd=os.path.abspath(lib_src_path),
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   210
                        filter_stdout=filter_python_develop,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   211
                        show_stdout=True)
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   212
    return install_lib
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   213
442
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   214
install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared'], {})
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   215
install_zlib = gen_install_comp_lib("zlib", "ZLIB", [], {})
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   216
install_pkgconfig = gen_install_comp_lib("pkg-config", "PKGCONFIG", ['--with-internal-glib'], {})
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   217
install_sqlite = gen_install_comp_lib("sqlite", "SQLITE", [], {})
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   218
install_unixODBC = gen_install_comp_lib("unixODBC", "UNIXODBC", ['--enable-gui=no'], {})
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   219
redland_base_env = {
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   220
    'PKG_CONFIG': "%(home_dir)s/bin/pkg-config",
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   221
    'PKG_CONFIG_LIBDIR': "%(home_dir)s/lib/pkgconfig",
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   222
}
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   223
install_raptor2 = gen_install_comp_lib('raptor2', 'RAPTOR2', [], redland_base_env)
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   224
install_rasqal = gen_install_comp_lib('rasqal', "RASQAL", [], redland_base_env)
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   225
install_redland = gen_install_comp_lib('redland', 'REDLAND', [], dict(redland_base_env.items() + {'CFLAGS':'-I%(home_dir)s/include'}.items()))
450
5bf2dffe3685 correct virtualenv creation for linux
ymh <ymh.work@gmail.com>
parents: 443
diff changeset
   226
python_ld_flags = '-L'+os.path.abspath(os.path.join(os.path.dirname(os.__file__),'..'))+' -lpython'+".".join(map(str,sys.version_info[0:2]))
5bf2dffe3685 correct virtualenv creation for linux
ymh <ymh.work@gmail.com>
parents: 443
diff changeset
   227
if sys.platform == 'darwin':
5bf2dffe3685 correct virtualenv creation for linux
ymh <ymh.work@gmail.com>
parents: 443
diff changeset
   228
    python_ld_flags += ' -Wl,-dylib'
5bf2dffe3685 correct virtualenv creation for linux
ymh <ymh.work@gmail.com>
parents: 443
diff changeset
   229
elif 'linux' in sys.platform:
452
a634526a90bc correct virtualenv creation
ymh <ymh.work@gmail.com>
parents: 450
diff changeset
   230
    python_ld_flags += ' -nostartfiles -Wl,-shared'
450
5bf2dffe3685 correct virtualenv creation for linux
ymh <ymh.work@gmail.com>
parents: 443
diff changeset
   231
install_redland_bindings = gen_install_comp_lib('redland-bindings', "REDLAND_BINDINGS", ['--with-python=%(home_dir)s/bin/python', '--with-python-ldflags='+python_ld_flags], redland_base_env)
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
10
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
   233
def install_pystemmer(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop):
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
   234
    print "install PYSTEMMER from " + res_env.URLS['PYSTEMMER'][res_source_key]
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
   235
    pystemmer_src = os.path.join(src_dir,"pystemmer.zip")
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
   236
    shutil.copy(res_env.URLS['PYSTEMMER'][res_source_key], pystemmer_src)
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
   237
    #extract pystemmer
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
   238
    zf = zipfile.ZipFile(pystemmer_src)
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
   239
    pystemmer_base_path = os.path.join(src_dir,"pystemmer")
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
   240
    zf.extractall(pystemmer_base_path)
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
   241
    zf.close()
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
   242
    
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
   243
    shutil.copy(os.path.join(pystemmer_base_path, 'Stemmer.pyd'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages')))
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
   244
    shutil.copy(os.path.join(pystemmer_base_path, 'PyStemmer-1.0.1-py2.6.egg-info'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages')))
9ea5f8ba8e71 Update create env for PyStemmer on PC.
cavaliet
parents: 2
diff changeset
   245
    
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   246
#osx_extra_env = {'ARCHFLAGS': '-Wno-error=unused-command-line-argument-hard-error-in-future', 'CFLAGS': '-Qunused-arguments', 'CPPFLAGS': '-Qunused-arguments'}
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   247
osx_extra_env = {}
2
b380dc74b590 add import csv command + first test
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   248
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   249
def lib_generate_install_methods(path_locations, src_base, run_base, Logger, call_subprocess, normal_installs, options_to_add=None, urls= None):
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   250
    
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   251
    all_urls = URLS.copy()
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   252
    if urls is not None:
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
        all_urls.update(urls)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   254
        
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   255
    res_env = ResourcesEnv(src_base, run_base, all_urls, normal_installs)
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   256
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   257
    def filter_python_develop(line):
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   258
        if not line.strip():
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   259
            return Logger.DEBUG
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   260
        for prefix in ['Searching for', 'Reading ', 'Best match: ', 'Processing ',
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   261
                       'Moving ', 'Adding ', 'running ', 'writing ', 'Creating ',
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   262
                       'creating ', 'Copying ']:
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
            if line.startswith(prefix):
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   264
                return Logger.DEBUG
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   265
        return Logger.NOTIFY
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   266
    
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   267
    
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   268
    def normal_install(key, res_path, method, option_str, extra_env, res_source_key, home_dir, tmp_dir, res_env, logger, call_subprocess):
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   269
        logger.notify("Install %s from %s with %s" % (key,res_path,method))
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   270
        if method == 'pip':
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   271
            if sys.platform == 'win32':
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   272
                args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'pip')), 'install', res_path]
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   273
            else:
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   274
                args = [os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', res_path]
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   275
            if option_str :
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   276
                args.append(option_str)
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   277
            if res_source_key == 'local':
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   278
                if extra_env is None:
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   279
                    extra_env = {}
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   280
                extra_env["PIP_DOWNLOAD_CACHE"] = res_env.get_src_base_path("")
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   281
                args.insert(2, '-f')
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   282
                args.insert(3, res_env.get_src_base_path(""))
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   283
                args.insert(4, '--no-index')
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   284
            logger.notify("Install %s from %s with %s args %s " % (key,res_path,method, repr(args)))
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   285
            call_subprocess(args,
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   286
                    cwd=os.path.abspath(tmp_dir),
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   287
                    filter_stdout=filter_python_develop,
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   288
                    show_stdout=True,
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   289
                    extra_env=extra_env)
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   290
        if method == 'pip-req':
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   291
            if sys.platform == 'win32':
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   292
                args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'pip')), 'install', '-r', res_path]
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   293
            else:
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   294
                args = [os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', '-r', res_path]
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   295
            if option_str :
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   296
                args.append(option_str)
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   297
            if res_source_key == 'local':
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   298
                if extra_env is None:
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   299
                    extra_env = {}
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   300
                extra_env["PIP_DOWNLOAD_CACHE"] = res_env.get_src_base_path("")
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   301
                args.insert(2, '-f')
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   302
                args.insert(3, res_env.get_src_base_path(""))
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   303
                args.insert(4, '--no-index')
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   304
            logger.notify("Install %s from %s with %s args %s " % (key,res_path,method, repr(args)))
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   305
            call_subprocess(args,
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   306
                    cwd=os.path.abspath(tmp_dir),
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   307
                    filter_stdout=filter_python_develop,
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   308
                    show_stdout=True,
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   309
                    extra_env=extra_env)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   310
        else:
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   311
            if sys.platform == 'win32':
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   312
                args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'easy_install')), res_path]
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   313
            else:
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   314
                args = [os.path.abspath(os.path.join(home_dir, 'bin', 'easy_install')), res_path]
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   315
            if option_str :
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   316
                args.insert(1,option_str)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   317
            call_subprocess(args,
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   318
                    cwd=os.path.abspath(tmp_dir),
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   319
                    filter_stdout=filter_python_develop,
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   320
                    show_stdout=True,
442
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   321
                    extra_env=extra_env)
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   322
 
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   323
    
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   324
    def after_install(options, home_dir):
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   325
        
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   326
        global logger
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   327
        
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   328
        verbosity = options.verbose - options.quiet
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   329
        logger = Logger([(Logger.level_for_integer(2-verbosity), sys.stdout)])
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   330
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   331
        
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   332
        home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   333
        base_dir = os.path.dirname(home_dir)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   334
        src_dir = os.path.join(home_dir, 'src')
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   335
        tmp_dir = os.path.join(home_dir, 'tmp')
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   336
        ensure_dir(src_dir, logger)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   337
        ensure_dir(tmp_dir, logger)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   338
        system_str = platform.system()
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   339
                
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   340
        res_source_key = getattr(options, 'type_install') if hasattr(options, 'type_install') else 'local' #.get('type_install', 'local')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   341
        if res_source_key is None:
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   342
            res_source_key = 'local'
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   343
        
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   344
        ignore_packages = []
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   345
        
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   346
        if system_str == 'Windows':
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   347
            default_install_options = {'method': 'easy_install', 'option_str': None, 'dict_extra_env': {}}
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   348
        else:
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   349
            default_install_options = {'method': 'pip', 'option_str': None, 'dict_extra_env': {}}
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   350
            
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   351
        if options.ignore_packages :
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   352
            ignore_packages = options.ignore_packages.split(",")
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   353
        
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   354
        logger.indent += 2
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   355
        try:    
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   356
            for key in res_env.NORMAL_INSTALL:
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   357
                install_options = None
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   358
                if isinstance(key, dict):
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   359
                    install_options = key.get('install', default_install_options)
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   360
                    install_options['method'] = 'pip-req'
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   361
                    res_path = res_env.get_run_res_base_path(key['requirement'])
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   362
                else:
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   363
                    if key not in res_env.URLS:
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   364
                        logger.notify("%s not found in def : passing" % (key,))
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   365
                    install_options = res_env.URLS[key].get('install', None)
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   366
                    res_path = res_env.URLS[key][res_source_key]
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   367
                if install_options is None:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   368
                    install_options = default_install_options
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   369
                method = install_options.get('method', default_install_options['method'])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   370
                option_str = install_options.get('option_str', default_install_options['option_str'])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   371
                extra_env = install_options.get('dict_extra_env', default_install_options['dict_extra_env'])
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   372
                if not extra_env:
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   373
                    extra_env = {}
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   374
                    
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   375
                if 'TMPDIR' not in extra_env:
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   376
                    extra_env['TMPDIR'] = os.path.abspath(tmp_dir)
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   377
                if system_str == 'Darwin':
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   378
                    for flag_key, flag_value in iter(osx_extra_env.items()):
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   379
                        flags = extra_env.get(flag_key, '')
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   380
                        if flag_value not in flags:
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   381
                            #flags += " -Wno-error=unused-command-line-argument-hard-error-in-future"
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   382
                            flags += " "+flag_value
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   383
                            extra_env[flag_key] = flags.strip()
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   384
                    
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   385
                #isinstance(lst, (list, tuple))
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   386
                if key not in ignore_packages:
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   387
                    logger.notify("install %s with method %s" % (key, repr(method)))
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   388
                    if callable(method):
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   389
                        method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop)
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   390
                    elif method in globals() and callable(globals()[method]) and method not in ['pip', 'easy_install']:  
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   391
                        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)
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   392
                    else:
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   393
                        normal_install(key, res_path, method, option_str, extra_env, res_source_key, home_dir, tmp_dir, res_env, logger, call_subprocess)
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   394
                            
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   395
            logger.notify("Clear source dir")
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   396
            shutil.rmtree(src_dir)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   397
    
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   398
        finally:
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   399
            logger.indent -= 2
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   400
        script_dir = join(base_dir, bin_dir)
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   401
        logger.notify('Run "%s Package" to install new packages that provide builds'
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   402
                      % join(script_dir, 'easy_install'))
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   403
    
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   404
    def adjust_options(options, args):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents: 176
diff changeset
   405
        if not options_to_add:
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   406
            return
442
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   407
        for opt,opt_val in options_to_add.items():
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   408
            #if not hasattr(options,test_opt) or getattr(options, test_opt) is None:
442
3d54acec55d6 first stage for import_rdf
ymh <ymh.work@gmail.com>
parents: 361
diff changeset
   409
            setattr(options, opt, opt_val)
0
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   410
896db0083b76 first commit
ymh <ymh.work@gmail.com>
parents:
diff changeset
   411
    return adjust_options, extend_parser, after_install
345
7bc38c7d6cf9 update libs + add wsgi interface
ymh <ymh.work@gmail.com>
parents: 295
diff changeset
   412