diff options
author | tarek@MacZiade-2.local <tarek@MacZiade-2.local> | 2009-08-04 01:51:24 +0200 |
---|---|---|
committer | tarek@MacZiade-2.local <tarek@MacZiade-2.local> | 2009-08-04 01:51:24 +0200 |
commit | b934c406ef9371ad36a23e608dcd752b8c311946 (patch) | |
tree | bd286a65bc2f012f2709e6d956e155d2a4bcd39f /bootstrap.py | |
parent | 8d37ba24ed17b6531c86c42e22d178e1e50a22a2 (diff) | |
download | external_python_setuptools-b934c406ef9371ad36a23e608dcd752b8c311946.tar.gz external_python_setuptools-b934c406ef9371ad36a23e608dcd752b8c311946.tar.bz2 external_python_setuptools-b934c406ef9371ad36a23e608dcd752b8c311946.zip |
added a post install function that ensures setuptools is faked even if not previously present
--HG--
branch : distribute
extra : rebase_source : 3254ab2ca1f771dd24a6d93a28ca87ca375fe65b
Diffstat (limited to 'bootstrap.py')
-rw-r--r-- | bootstrap.py | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/bootstrap.py b/bootstrap.py index e8a058a6..614f4983 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -212,6 +212,32 @@ def _remove_flat_installation(placeholder): 'Setuptools distribution' % element) return True +def after_install(dist): + log.warn('After install bootstrap.') + placeholder = dist.get_command_obj('install').install_purelib + if not os.path.exists(placeholder): + log.warn('Could not find the install location') + return + pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1]) + setuptools_file = 'setuptools-0.6c9-py%s.egg' % pyver + pkg_info = os.path.join(placeholder, setuptools_file) + if os.path.exists(pkg_info): + log.warn('%s already exists' % pkg_info) + return + log.warn('Creating %s' % pkg_info) + f = open(pkg_info, 'w') + try: + f.write(SETUPTOOLS_PKG_INFO) + finally: + f.close() + pth_file = os.path.join(placeholder, 'setuptools.pth') + log.warn('Creating %s' % pth_file) + f = open(pth_file, 'w') + try: + f.write(os.path.join(os.curdir, setuptools_file)) + finally: + f.close() + def _patch_egg_dir(path): # let's check if it's already patched pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO') @@ -230,6 +256,10 @@ def _patch_egg_dir(path): f.close() return True +def before_install(): + log.warn('Before install bootstrap.') + fake_setuptools() + def fake_setuptools(): log.warn('Scanning installed packages') try: @@ -238,7 +268,7 @@ def fake_setuptools(): # we're cool log.warn('Setuptools or Distribute does not seem to be installed.') return - ws = pkg_resources.working_set + ws = pkg_resources.working_set setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools')) if setuptools_dist is None: log.warn('No setuptools distribution found') @@ -247,7 +277,7 @@ def fake_setuptools(): setuptools_location = setuptools_dist.location log.warn('Setuptools installation detected at %s' % setuptools_location) - # let's see if its an egg until this supports non-egg installation + # let's see if its an egg if not setuptools_location.endswith('.egg'): log.warn('Non-egg installation') res = _remove_flat_installation(setuptools_location) |