Skip to content

Commit

Permalink
Merge pull request #4361
Browse files Browse the repository at this point in the history
Use super in commands.install
  • Loading branch information
jaraco authored May 17, 2024
2 parents 2212422 + 59c47e4 commit ef853fd
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 ef853fd

Please # to comment.