Commit a227478f authored by tarek's avatar tarek

now calling after_install in bootstrap.main too

--HG--
branch : distribute
extra : rebase_source : 5ed71a412016a97c699ebf16d92d3e476cb5c3f0
parent 897e85aa
...@@ -307,6 +307,22 @@ def _relaunch(): ...@@ -307,6 +307,22 @@ def _relaunch():
else: else:
sys.exit(os.spawnv(os.P_WAIT, sys.executable, args)) sys.exit(os.spawnv(os.P_WAIT, sys.executable, args))
def _easy_install(argv, egg=None):
from setuptools import setup
from setuptools.dist import Distribution
import distutils.core
if egg is not None:
setup_args = list(argv) + ['-v'] + [egg]
else:
setup_args = list(argv)
try:
return setup(script_args = ['-q','easy_install',
'-v'] + setup_args,
script_name = sys.argv[0] or 'easy_install',
distclass=Distribution)
except DistutilsError:
return sys.exit(2)
def main(argv, version=DEFAULT_VERSION): def main(argv, version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall""" """Install or upgrade setuptools and EasyInstall"""
# let's deactivate any existing setuptools installation first # let's deactivate any existing setuptools installation first
...@@ -337,11 +353,14 @@ def main(argv, version=DEFAULT_VERSION): ...@@ -337,11 +353,14 @@ def main(argv, version=DEFAULT_VERSION):
"If you are inside a virtualenv, make sure you used the --no-site-packages option" "If you are inside a virtualenv, make sure you used the --no-site-packages option"
) )
sys.exit(2) sys.exit(2)
from setuptools.command import easy_install dist = _easy_install(argv, egg)
try: after_install(dist)
return easy_install.main(list(argv)+['-v']+[egg]) return
except DistutilsError: #from setuptools.command import easy_install
return sys.exit(2) #try:
# return easy_install.main(list(argv)+['-v']+[egg])
#except DistutilsError:
# return sys.exit(2)
finally: finally:
if egg and os.path.exists(egg): if egg and os.path.exists(egg):
os.unlink(egg) os.unlink(egg)
...@@ -359,15 +378,17 @@ def main(argv, version=DEFAULT_VERSION): ...@@ -359,15 +378,17 @@ def main(argv, version=DEFAULT_VERSION):
pkg_resources.require(req) pkg_resources.require(req)
except pkg_resources.VersionConflict: except pkg_resources.VersionConflict:
try: try:
from setuptools.command.easy_install import main _easy_install(argv, [download_setuptools(delay=0)])
#from setuptools.command.easy_install import main
except ImportError: except ImportError:
from easy_install import main from easy_install import main
main(list(argv)+[download_setuptools(delay=0)]) main(list(argv)+[download_setuptools(delay=0)])
sys.exit(0) # try to force an exit sys.exit(0) # try to force an exit
else: else:
if argv: if argv:
from setuptools.command.easy_install import main _easy_install(argv)
main(argv) #from setuptools.command.easy_install import main
#main(argv)
else: else:
print "distribute version",version,"or greater has been installed." print "distribute version",version,"or greater has been installed."
print '(Run "ez_setup.py -U distribute" to reinstall or upgrade.)' print '(Run "ez_setup.py -U distribute" to reinstall or upgrade.)'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment