From 59c47e42e304f0c56a9069b86bca2f11ca6ced7b Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 16 May 2024 21:30:08 -0400 Subject: [PATCH] In install command, use super to call the superclass methods. Avoids race conditions when monkeypatching from _distutils_system_mod occurs late. Fixes #4136 --- newsfragments/4136.bugfix.rst | 1 + setuptools/command/install.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 newsfragments/4136.bugfix.rst diff --git a/newsfragments/4136.bugfix.rst b/newsfragments/4136.bugfix.rst new file mode 100644 index 0000000000..f56346f0c7 --- /dev/null +++ b/newsfragments/4136.bugfix.rst @@ -0,0 +1 @@ +In install command, use super to call the superclass methods. Avoids race conditions when monkeypatching from _distutils_system_mod occurs late. \ No newline at end of file diff --git a/setuptools/command/install.py b/setuptools/command/install.py index 56c1155b50..c49fcda939 100644 --- a/setuptools/command/install.py +++ b/setuptools/command/install.py @@ -49,12 +49,12 @@ def initialize_options(self): # and then add a due_date to this warning. ) - orig.install.initialize_options(self) + super().initialize_options() self.old_and_unmanageable = None self.single_version_externally_managed = None def finalize_options(self): - orig.install.finalize_options(self) + super().finalize_options() if self.root: self.single_version_externally_managed = True elif self.single_version_externally_managed: @@ -78,11 +78,11 @@ def handle_extra_path(self): def run(self): # Explicit request for old-style install? Just do it if self.old_and_unmanageable or self.single_version_externally_managed: - return orig.install.run(self) + return super().run() if not self._called_from_setup(inspect.currentframe()): # Run in backward-compatibility mode to support bdist_* commands. - orig.install.run(self) + super().run() else: self.do_egg_install()