-
Notifications
You must be signed in to change notification settings - Fork 808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically run pywin32_postinstall.py
for "local"/"from source" installs
#2447
Open
Avasam
wants to merge
4
commits into
mhammond:main
Choose a base branch
from
Avasam:run-postinstall-on-local-installs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+14
−17
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9ff63c2
Automatically run `pywin32_postinstall.py` for local/from source inst…
Avasam d854542
Merge branch 'main' into run-postinstall-on-local-installs
Avasam d1fa232
Hacky skip for build-only commands
Avasam 71b349c
Merge branch 'run-postinstall-on-local-installs' of https://github.co…
Avasam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -856,16 +856,6 @@ def run(self): | |||||
This is only run for local installs. Wheel-based installs won't run this code. | ||||||
""" | ||||||
install.run(self) | ||||||
# If self.root has a value, it means we are being "installed" into some other | ||||||
# directory than Python itself - in which case we must *not* run our installer. | ||||||
# bdist_wininst used to trigger this by using a temp directory. | ||||||
# Is this still a concern ? | ||||||
if self.root: | ||||||
print( | ||||||
"Not executing post install script when " | ||||||
+ f"not installing in Python itself (self.root={self.root})" | ||||||
) | ||||||
return | ||||||
self.execute(self._postinstall, (), msg="Executing post install script...") | ||||||
|
||||||
def _postinstall(self): | ||||||
|
@@ -874,17 +864,16 @@ def _postinstall(self): | |||||
raise RuntimeError(f"Can't find '{filename}'") | ||||||
# As of setuptools>=74.0.0, we no longer need to | ||||||
# be concerned about distutils calling win32api | ||||||
subprocess.Popen( | ||||||
[ | ||||||
subprocess.check_call( | ||||||
( | ||||||
sys.executable, | ||||||
filename, | ||||||
"-install", | ||||||
"-destination", | ||||||
self.install_lib, | ||||||
"-quiet", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At first I did
Suggested change
but realized pip without |
||||||
"-wait", | ||||||
str(os.getpid()), | ||||||
] | ||||||
) | ||||||
) | ||||||
|
||||||
|
||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This wouldn't replace #2392
That other PR also tests uninstalling
In fact both together should be better as it would test the install under 2 different contexts, and test a re-install.