summaryrefslogtreecommitdiff
path: root/setuptools/command
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2022-03-25 22:48:21 +0000
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2022-03-25 22:48:21 +0000
commit93a24585683944a9369d8fd37a824c0bca345af4 (patch)
tree37da0b85445b246a033337fbec436f0d85b02eff /setuptools/command
parenta5658e826c1191eb1a40bff894fb625af7cccaa9 (diff)
downloadpython-setuptools-git-93a24585683944a9369d8fd37a824c0bca345af4.tar.gz
Make install consider dist.run_command is overwritten in v61.0.0
Starting in v61, setuptools.dist overwrites distutils.dist.run_command to add auto-discovery functionality on top of the original implementation. This change modifies the existing code in setuptools.command.install to consider that previous change when trying to decide if the install command was called directly from `setup.py` or not.
Diffstat (limited to 'setuptools/command')
-rw-r--r--setuptools/command/install.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/setuptools/command/install.py b/setuptools/command/install.py
index 35e54d20..55fdb124 100644
--- a/setuptools/command/install.py
+++ b/setuptools/command/install.py
@@ -91,14 +91,21 @@ class install(orig.install):
msg = "For best results, pass -X:Frames to enable call stack."
warnings.warn(msg)
return True
- res = inspect.getouterframes(run_frame)[2]
- caller, = res[:1]
- info = inspect.getframeinfo(caller)
- caller_module = caller.f_globals.get('__name__', '')
- return (
- caller_module == 'distutils.dist'
- and info.function == 'run_commands'
- )
+
+ frames = inspect.getouterframes(run_frame)
+ for frame in frames[2:4]:
+ caller, = frame[:1]
+ info = inspect.getframeinfo(caller)
+ caller_module = caller.f_globals.get('__name__', '')
+
+ if caller_module == "setuptools.dist" and info.function == "run_command":
+ # Starting from v61.0.0 setuptools overwrites dist.run_command
+ continue
+
+ return (
+ caller_module == 'distutils.dist'
+ and info.function == 'run_commands'
+ )
def do_egg_install(self):