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()