virtualenv/res/lib/lib_create_env.py
changeset 6 9e29d68d48f1
child 14 94e058cf84de
equal deleted inserted replaced
5:e27a08b0a037 6:9e29d68d48f1
       
     1 import sys
       
     2 import os
       
     3 import os.path
       
     4 import shutil
       
     5 import tarfile
       
     6 import zipfile
       
     7 import urllib
       
     8 import platform
       
     9 import patch
       
    10 import struct
       
    11 import glob
       
    12 import re
       
    13 
       
    14 join = os.path.join
       
    15 system_str = platform.system()
       
    16 
       
    17 URLS = {
       
    18     #'': {'setup': '', 'url':'', 'local':''},
       
    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}},
       
    20     'DJANGO': {'setup': 'django', 'url': 'http://www.djangoproject.com/download/1.4.1/tarball/', 'local':"Django-1.4.1.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/tarball/0.8', 'local':"django-extensions-0.8.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    22     'DJANGO-REGISTRATION': { 'setup': 'django-registration', 'url':'https://bitbucket.org/ubernostrum/django-registration/get/v0.8.tar.gz', 'local':"django-registration-0.8.tar.gz", 'install': {'method': 'easy_install', 'option_str': '-Z', 'dict_extra_env': None}},
       
    23     'DJANGO-TAGGING': { 'setup': 'django-tagging', 'url':'http://django-tagging.googlecode.com/files/django-tagging-0.3.1.tar.gz', 'local':"django-tagging-0.3.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    24     'DJANGO-PISTON': { 'setup': 'django-piston', 'url':'django-piston-7c90898072ce-modifed.tar.gz', 'local':'django-piston-7c90898072ce-modifed.tar.gz', 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
       
    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     'HTTPLIB2': { 'setup': 'python-httplib2', 'url':'http://code.google.com/p/httplib2/downloads/detail?name=httplib2-0.7.4.tar.gz&can=2&q=', 'local':"httplib2-0.7.4.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    27     'DJANGO-OAUTH-PLUS': { 'setup': 'django-oauth-plus', 'url':'http://bitbucket.org/david/django-oauth-plus/get/f314f018e473.gz', 'local':"django-oauth-plus.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    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     'DJANGO_OPENID_CONSUMER': {'setup':'django_openid_consumer', 'url':'http://pypi.python.org/packages/source/d/django-openid-consumer/django-openid-consumer-0.1.1.tar.gz', 'local':"django-openid-consumer-0.1.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    30     'SOCIAL_AUTH': {'setup':'social_auth', 'url':'https://github.com/omab/django-social-auth/tarball/v0.3.10', 'local':"omab-django-social-auth-v0.3.10-modified.tar.gz", 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
       
    31     'SOUTH': { 'setup': 'South', 'url':'http://www.aeracode.org/releases/south/south-0.7.5.tar.gz', 'local':"south-0.7.5.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    32     'DJANGO_GUARDIAN' : { 'setup': 'django-guardian', 'url':'http://pypi.python.org/packages/source/d/django-guardian/django-guardian-1.0.3.tar.gz', 'local':"django-guardian-1.0.3.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    33     'SORL_THUMBNAIL' : { 'setup': 'sorl-thumbnail', 'url':'http://pypi.python.org/packages/source/s/sorl-thumbnail/sorl-thumbnail-11.12.tar.gz', 'local':"sorl-thumbnail-v10.12.1.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    34     'LIBJPEG': {'setup': None, 'url':'jpegsrc.v8d.tar.gz', 'local':'jpegsrc.v8d.tar.gz', 'install': {'method': 'install_libjpeg', 'option_str': None, 'dict_extra_env': None}},
       
    35     'ZLIB': {'setup': None, 'url':'zlib-1.2.7.tar.gz', 'local':'zlib-1.2.7.tar.gz', 'install': {'method': 'install_zlib', 'option_str': None, 'dict_extra_env': None}},
       
    36     'PYCRYPTO': {'setup': 'pycrypto', 'url':'https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.tar.gz', 'local':'pycrypto-2.6.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    37     '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}},
       
    38     '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}},
       
    39     '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}},
       
    40     'HAYSTACK': {'setup': 'django-haystack', 'url': 'https://github.com/toastdriven/django-haystack/tarball/master', 'local': 'django-haystack-v2.0.0.tar.gz', 'install':{'method':'pip', 'option_str': None, 'dict_extra_env': None}},
       
    41     'REQUESTS': {'setup': 'requests', 'url':'https://github.com/kennethreitz/requests/tarball/v0.13.3', 'local':'requests-v0.13.3.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
       
    42     'PYELASTICSEARCH': {'setup': 'pyelasticsearch', 'url':'https://github.com/toastdriven/pyelasticsearch/tarball/master', 'local':'pyelasticsearch.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
       
    43     'WHOOSH': {'setup': 'whoosh', 'url':'https://bitbucket.org/mchaput/whoosh/get/tip.tar.gz', 'local':'whoosh-2.5.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}},
       
    44     'LDT': {'setup': 'ldt','url': 'ldt-1.17.tar.gz', 'local':"ldt-1.17.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    45 }
       
    46 
       
    47 if system_str == 'Windows':
       
    48     
       
    49     size = 8 * struct.calcsize("P")
       
    50     if size==32:
       
    51         mysqlres = "MySQL-python-1.2.3.win32-py2.7.exe"
       
    52     else:
       
    53         mysqlres = "MySQL-python-1.2.3.win-amd64-py2.7.exe"
       
    54     
       
    55     URLS.update({
       
    56         '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}},
       
    57         '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}},
       
    58         '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}},
       
    59         'MYSQL': { 'setup': 'mysql-python', 'url': mysqlres, 'local': mysqlres, 'install': {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}},
       
    60     })
       
    61 else:
       
    62     if system_str == "Darwin":        
       
    63         lxml_options = {'STATIC_DEPS': 'true', 'LIBXML2_VERSION': '2.8.0', 'LIBXSLT_VERSION': '1.1.26', 'LIBICONV_VERSION': '1.14'}
       
    64         lxml_method = 'easy_install'
       
    65         mysql_method = 'install_mysql'
       
    66     else:
       
    67         lxml_options = None
       
    68         lxml_method = 'pip'
       
    69         mysql_method = 'pip'
       
    70 
       
    71     URLS.update({
       
    72         'PSYCOPG2': {'setup': 'psycopg2','url': 'http://www.psycopg.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.5.tar.gz', 'local':"psycopg2-2.4.5.tar.gz", 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}},
       
    73         '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}},
       
    74         'LXML': {'setup': 'lxml', 'url':"lxml-2.3.4.tar.bz2", 'local':"lxml-2.3.4.tar.bz2", 'install': {'method': lxml_method, 'option_str': None, 'dict_extra_env': lxml_options}},
       
    75         'MYSQL': { 'setup': 'mysql-python', 'url': 'http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download', 'local':"MySQL-python-1.2.3.tar.gz", 'install': {'method': mysql_method, 'option_str': None, 'dict_extra_env': None}},
       
    76     })
       
    77 
       
    78 
       
    79 
       
    80 class ResourcesEnv(object):
       
    81 
       
    82     def __init__(self, src_base, urls, normal_installs):
       
    83         self.src_base = src_base
       
    84         self.URLS = {}
       
    85         self.__init_url(urls)
       
    86         self.NORMAL_INSTALL = normal_installs
       
    87 
       
    88     def get_src_base_path(self, fpath):
       
    89         return os.path.abspath(os.path.join(self.src_base, fpath)).replace("\\","/")
       
    90     
       
    91     def __add_package_def(self, key, dict):
       
    92         self.URLS[key] = dict
       
    93         
       
    94     def __init_url(self, urls):
       
    95         for key, url_dict in urls.items():
       
    96             url_dict_copy = url_dict.copy()
       
    97             if not url_dict['url'].startswith("http://"):
       
    98                 url_dict_copy['url'] = self.get_src_base_path(url_dict['url'])
       
    99             url_dict_copy['local'] = self.get_src_base_path(url_dict['local'])            
       
   100             
       
   101             self.__add_package_def(key, url_dict_copy )
       
   102 
       
   103 def ensure_dir(dir, logger):
       
   104     if not os.path.exists(dir):
       
   105         logger.notify('Creating directory %s' % dir)
       
   106         os.makedirs(dir)
       
   107 
       
   108 def extend_parser(parser):    
       
   109     parser.add_option(
       
   110         '--index-url',
       
   111         metavar='INDEX_URL',
       
   112         dest='index_url',
       
   113         default='http://pypi.python.org/simple/',
       
   114         help='base URL of Python Package Index')
       
   115     parser.add_option(
       
   116         '--type-install',
       
   117         metavar='type_install',
       
   118         dest='type_install',
       
   119         help='type install : local, url, setup - default : local')
       
   120     parser.add_option(
       
   121         '--ignore-packages',
       
   122         metavar='ignore_packages',
       
   123         dest='ignore_packages',
       
   124         default=None,
       
   125         help='list of comma separated keys for package to ignore')    
       
   126 
       
   127 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):
       
   128     psycopg2_src = os.path.join(src_dir,"psycopg2.zip")
       
   129     shutil.copy(res_env.URLS['PSYCOPG2'][res_source_key], psycopg2_src)
       
   130     #extract psycopg2
       
   131     zf = zipfile.ZipFile(psycopg2_src)
       
   132     psycopg2_base_path = os.path.join(src_dir,"psycopg2")
       
   133     zf.extractall(psycopg2_base_path)
       
   134     zf.close()
       
   135     
       
   136     psycopg2_src_path = os.path.join(psycopg2_base_path, os.listdir(psycopg2_base_path)[0])
       
   137     shutil.copytree(os.path.join(psycopg2_src_path, 'psycopg2'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'psycopg2')))
       
   138     shutil.copy(os.path.join(psycopg2_src_path, 'psycopg2-2.0.14-py2.6.egg-info'), os.path.abspath(os.path.join(home_dir, 'Lib/site-packages', 'site-packages')))
       
   139     
       
   140 
       
   141 def install_mysql(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop):
       
   142     
       
   143     args = [os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', res_env.URLS['MYSQL'][res_source_key]]                
       
   144     if option_str :
       
   145         args.insert(4,option_str)
       
   146     call_subprocess(args,
       
   147             cwd=os.path.abspath(tmp_dir),
       
   148             filter_stdout=filter_python_develop,
       
   149             show_stdout=True,
       
   150             extra_env=extra_env)
       
   151 
       
   152     mysqlconfig_output = []
       
   153     
       
   154     call_subprocess(['mysql_config', '--libmysqld-libs'],
       
   155         cwd=os.path.abspath(tmp_dir),
       
   156         filter_stdout=lambda line: mysqlconfig_output.append(line),
       
   157         show_stdout=True)
       
   158         
       
   159     mysqlconfig_output = "".join(mysqlconfig_output)
       
   160     m = re.search("\-L[\'\"]?([\w\/]+)[\'\"]?", mysqlconfig_output)
       
   161     if m:
       
   162         repdylibpath = m.group(1)
       
   163     else:
       
   164         repdylibpath = '/usr/local/mysql/lib'
       
   165         
       
   166     dyliblist = glob.glob(repdylibpath+"/libmysqlclient.*.dylib")
       
   167     def key_func(s):
       
   168         m = re.match(repdylibpath+"/libmysqlclient\.([\d]+)\.dylib", s)
       
   169         if m:
       
   170             return int(m.group(1))
       
   171         else:
       
   172             return sys.maxint
       
   173     dyliblist.sort(key=key_func)
       
   174     
       
   175     if dyliblist:
       
   176         dylibpath = dyliblist[0]
       
   177     else:
       
   178         dylibpath = '/usr/local/mysql/lib/libmysqlclient.18.dylib'
       
   179         
       
   180     dylibname = os.path.basename(dylibpath)    
       
   181     sopath = os.path.join(os.path.abspath(lib_dir), 'site-packages', '_mysql.so')
       
   182     
       
   183     call_subprocess(['install_name_tool', '-change', dylibname, dylibpath, sopath],
       
   184         cwd=os.path.abspath(tmp_dir),
       
   185         filter_stdout=filter_python_develop,
       
   186         show_stdout=True)
       
   187 
       
   188 
       
   189 def gen_install_comp_lib(lib_name, lib_key, configure_options=[]):
       
   190     
       
   191     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):
       
   192         lib_src = os.path.join(src_dir,lib_name+".tar.gz")
       
   193         shutil.copy(res_env.URLS[lib_key][res_source_key], lib_src)
       
   194         tf = tarfile.open(lib_src,'r:gz')
       
   195         lib_base_path = os.path.join(src_dir, lib_name) 
       
   196         logger.notify("Extract %s to %s " % (lib_name,lib_base_path))
       
   197         tf.extractall(lib_base_path)
       
   198         tf.close()
       
   199         
       
   200         lib_src_path = os.path.join(lib_base_path, os.listdir(lib_base_path)[0])
       
   201     
       
   202         logger.notify(libname + " configure")
       
   203         call_subprocess(['configure', '--prefix='+os.path.abspath(home_dir)] + configure_options,
       
   204                         cwd=os.path.abspath(lib_src_path),
       
   205                         filter_stdout=filter_python_develop,
       
   206                         show_stdout=True)
       
   207         
       
   208         logger.notify(libname + " make")
       
   209         call_subprocess(['make'],
       
   210                         cwd=os.path.abspath(lib_src_path),
       
   211                         filter_stdout=filter_python_develop,
       
   212                         show_stdout=True)
       
   213     
       
   214         logger.notify(libname + "make install")
       
   215         call_subprocess(['make', 'install'],
       
   216                         cwd=os.path.abspath(lib_src_path),
       
   217                         filter_stdout=filter_python_develop,
       
   218                         show_stdout=True)
       
   219         return install_lib
       
   220 
       
   221 install_libjpeg = gen_install_comp_lib("libjpeg", "LIBJPEG", ['--enable-shared'])
       
   222 install_zlib = gen_install_comp_lib("zlib", "ZLIB", [])
       
   223 
       
   224 
       
   225     
       
   226     
       
   227 
       
   228 def lib_generate_install_methods(path_locations, src_base, Logger, call_subprocess, normal_installs, options_to_add=None, urls= None):
       
   229     
       
   230     all_urls = URLS.copy()
       
   231     if urls is not None:
       
   232         all_urls.update(urls)
       
   233         
       
   234     res_env = ResourcesEnv(src_base, all_urls, normal_installs)
       
   235 
       
   236     def filter_python_develop(line):
       
   237         if not line.strip():
       
   238             return Logger.DEBUG
       
   239         for prefix in ['Searching for', 'Reading ', 'Best match: ', 'Processing ',
       
   240                        'Moving ', 'Adding ', 'running ', 'writing ', 'Creating ',
       
   241                        'creating ', 'Copying ']:
       
   242             if line.startswith(prefix):
       
   243                 return Logger.DEBUG
       
   244         return Logger.NOTIFY
       
   245     
       
   246     
       
   247     def normal_install(key, method, option_str, extra_env, res_source_key, home_dir, tmp_dir, res_env, logger, call_subprocess):
       
   248         logger.notify("Install %s from %s with %s" % (key,res_env.URLS[key][res_source_key],method))
       
   249         if method == 'pip':
       
   250             if sys.platform == 'win32':
       
   251                 args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'pip')), 'install', res_env.URLS[key][res_source_key]]
       
   252             else:
       
   253                 args = [os.path.abspath(os.path.join(home_dir, 'bin', 'pip')), 'install', res_env.URLS[key][res_source_key]]
       
   254             if option_str :
       
   255                 args.insert(4,option_str)
       
   256             call_subprocess(args,
       
   257                     cwd=os.path.abspath(tmp_dir),
       
   258                     filter_stdout=filter_python_develop,
       
   259                     show_stdout=True,
       
   260                     extra_env=extra_env)
       
   261         else:
       
   262             if sys.platform == 'win32':
       
   263                 args = [os.path.abspath(os.path.join(home_dir, 'Scripts', 'easy_install')), res_env.URLS[key][res_source_key]]
       
   264             else:
       
   265                 args = [os.path.abspath(os.path.join(home_dir, 'bin', 'easy_install')), res_env.URLS[key][res_source_key]]
       
   266             if option_str :
       
   267                 args.insert(1,option_str)
       
   268             call_subprocess(args,
       
   269                     cwd=os.path.abspath(tmp_dir),
       
   270                     filter_stdout=filter_python_develop,
       
   271                     show_stdout=True,
       
   272                     extra_env=extra_env)            
       
   273  
       
   274     
       
   275     def after_install(options, home_dir):
       
   276         
       
   277         global logger
       
   278         
       
   279         verbosity = options.verbose - options.quiet
       
   280         logger = Logger([(Logger.level_for_integer(2-verbosity), sys.stdout)])
       
   281 
       
   282         
       
   283         home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
       
   284         base_dir = os.path.dirname(home_dir)
       
   285         src_dir = os.path.join(home_dir, 'src')
       
   286         tmp_dir = os.path.join(home_dir, 'tmp')
       
   287         ensure_dir(src_dir, logger)
       
   288         ensure_dir(tmp_dir, logger)
       
   289         system_str = platform.system()
       
   290                 
       
   291         res_source_key = getattr(options, 'type_install') if hasattr(options, 'type_install') else 'local' #.get('type_install', 'local')
       
   292         if res_source_key is None:
       
   293             res_source_key = local
       
   294         
       
   295         ignore_packages = []
       
   296         
       
   297         if system_str == 'Windows':
       
   298             default_install_options = {'method': 'easy_install', 'option_str': None, 'dict_extra_env': None}
       
   299         else:
       
   300             default_install_options = {'method': 'pip', 'option_str': None, 'dict_extra_env': None}
       
   301             
       
   302         if options.ignore_packages :
       
   303             ignore_packages = options.ignore_packages.split(",")
       
   304         
       
   305         logger.indent += 2
       
   306         try:    
       
   307             for key in res_env.NORMAL_INSTALL:
       
   308                 if key not in res_env.URLS:
       
   309                     logger.notify("%s not found in def : passing" % (key,))
       
   310                 install_options = res_env.URLS[key].get('install', None)
       
   311                 if install_options is None:
       
   312                     install_options = default_install_options
       
   313                 method = install_options.get('method', default_install_options['method'])
       
   314                 option_str = install_options.get('option_str', default_install_options['option_str'])
       
   315                 extra_env = install_options.get('dict_extra_env', default_install_options['dict_extra_env'])
       
   316                 #isinstance(lst, (list, tuple))
       
   317                 if key not in ignore_packages:
       
   318                     if callable(method):
       
   319                         method(option_str, extra_env, res_source_key, home_dir, lib_dir, tmp_dir, src_dir, res_env, logger, call_subprocess, filter_python_develop)
       
   320                     elif method in globals() and callable(globals()[method]) and method not in ['pip', 'easy_install']:  
       
   321                         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)
       
   322                     else:
       
   323                         normal_install(key, method, option_str, extra_env, res_source_key, home_dir, tmp_dir, res_env, logger, call_subprocess)
       
   324                             
       
   325             logger.notify("Clear source dir")
       
   326             shutil.rmtree(src_dir)
       
   327     
       
   328         finally:
       
   329             logger.indent -= 2
       
   330         script_dir = join(base_dir, bin_dir)
       
   331         logger.notify('Run "%s Package" to install new packages that provide builds'
       
   332                       % join(script_dir, 'easy_install'))
       
   333     
       
   334     def adjust_options(options, args):
       
   335         if not options_to_add:
       
   336             pass
       
   337         for opt in options_to_add:
       
   338             test_opt = opt.split('=',1)[0]
       
   339             if not hasattr(options,test_opt) or getattr(options, test_opt) is None:                
       
   340                 setattr(options, test_opt,opt.split('=',1)[1] if "=" in opt else True)
       
   341 
       
   342     return adjust_options, extend_parser, after_install