Skip to content

Commit

Permalink
In install command, use super to call the superclass methods. Avoids …
Browse files Browse the repository at this point in the history
…race conditions when monkeypatching from _distutils_system_mod occurs late.

Fixes #4136
  • Loading branch information
jaraco committed May 17, 2024
1 parent 2212422 commit 59c47e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions newsfragments/4136.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In install command, use super to call the superclass methods. Avoids race conditions when monkeypatching from _distutils_system_mod occurs late.
8 changes: 4 additions & 4 deletions setuptools/command/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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()

Expand Down

0 comments on commit 59c47e4

Please sign in to comment.