diff options
Diffstat (limited to 'setuptools/command/install.py')
-rw-r--r-- | setuptools/command/install.py | 52 |
1 files changed, 45 insertions, 7 deletions
diff --git a/setuptools/command/install.py b/setuptools/command/install.py index 760a416c..55321256 100644 --- a/setuptools/command/install.py +++ b/setuptools/command/install.py @@ -37,21 +37,51 @@ class install(_install): " packages" ) + + def handle_extra_path(self): # We always ignore extra_path, because we install as .egg or .egg-info self.path_file = None self.extra_dirs = '' def run(self): - if (self.old_and_unmanageable or self.single_version_externally_managed - or sys._getframe(1).f_globals.get('__name__','') != 'distutils.dist' - ): - # Either we were asked for the old behavior, or we're not being - # run from the command line. This is a bit kludgy, because a - # command might use dist.run_command() to run 'install', but - # bdist_dumb and bdist_wininst both call run() directly right now. + # Explicit request for old-style install? Just do it + if self.old_and_unmanageable or self.single_version_externally_managed: return _install.run(self) + # Attempt to detect whether we were called from setup() or by another + # command. If we were called by setup(), our caller will be the + # 'run_command' method in 'distutils.dist', and *its* caller will be + # the 'run_commands' method. If we were called any other way, our + # immediate caller *might* be 'run_command', but it won't have been + # called by 'run_commands'. This is slightly kludgy, but seems to + # work. + # + caller = sys._getframe(2) + caller_module = caller.f_globals.get('__name__','') + caller_name = caller.f_code.co_name + + if caller_module != 'distutils.dist' or caller_name!='run_commands': + # We weren't called from the command line or setup(), so we + # should run in backward-compatibility mode to support bdist_* + # commands. + _install.run(self) + else: + self.do_egg_install() + + + + + + + + + + + + + def do_egg_install(self): + from setuptools.command.easy_install import easy_install cmd = easy_install( @@ -83,3 +113,11 @@ class install(_install): + + + + + + + + |