Make pywin32_postinstall and pywin32_testall into Console Scripts#2408
Make pywin32_postinstall and pywin32_testall into Console Scripts#2408Avasam merged 15 commits intomhammond:mainfrom
pywin32_postinstall and pywin32_testall into Console Scripts#2408Conversation
44cd308 to
bc7ad11
Compare
| # This adds the scripts under Python3XX/Scripts, but doesn't actually do much | ||
| scripts=[ | ||
| "win32/scripts/pywin32_postinstall.py", | ||
| "win32/scripts/pywin32_testall.py", | ||
| ], |
There was a problem hiding this comment.
I'm keeping this for now as to not break some poor sysadmin's workflow of looking in Python's Scripts folder 😉 (then again, they were probably using .exe installers, but it's barely 4 lines to keep the support)
2bda609 to
31eb27c
Compare
mhammond
left a comment
There was a problem hiding this comment.
I don't understand how the commit message relates to this PR, nor how the post_install script is run automatically?
It doesn't (and can't when shipped as a wheel due to the current wheel specifications). This is simply an easier way for users to run the postinstall script without having to know or navigate to their Python install's scripts or lib folder. It integrates the same idea as #1855 of moving the script into a pywin32 package so it can be run as a module ( The same was done for (I've updated the PR description with this explanation) |
| # Run the tests directly from the source dir so support files (eg, .wav files etc) | ||
| # can be found - they aren't installed into the Python tree. | ||
| run: python pywin32_testall.py -v -skip-adodbapi | ||
| run: python -m win32.scripts.pywin32_testall -v -skip-adodbapi |
There was a problem hiding this comment.
| run: python -m win32.scripts.pywin32_testall -v -skip-adodbapi | |
| run: python win32/scripts/pywin32_testall.py -v -skip-adodbapi |
The failing test https://github.com/mhammond/pywin32/actions/runs/12308761196/job/34354669586?pr=2408#step:7:316 and comment
# Run the tests directly from the source dir so support files (eg, .wav files etc)
# can be found - they aren't installed into the Python tree.
tell me that it maybe didn't even make sense that the test was shipped in the first place (or could be modified to skip some tests when not run from source)
|
I fixed the location reference in |
mhammond
left a comment
There was a problem hiding this comment.
sorry for the delay, this seems correct, thanks!
|
|
||
| This should be run automatically after installation when installing from source, | ||
| but if it fails you can run it again. |
There was a problem hiding this comment.
| This should be run automatically after installation when installing from source, | |
| but if it fails you can run it again. |
Just tested and the "when installed from source" part isn't even true because self.root=build\bdist.win-amd64\wheel when running pip install . . So class my_install in setup.py right now is complete dead code. I'll tackle that in a different PR.
Edit: Done in #2447
Only happens on Python 3.10+, x86 That is a very interesting issue. Glad I waited to have the smokescreen test first. (although it may not really affect end-users) |
2f86667 to
b2acc3b
Compare
|
@mhammond I have worked around PATH issues from actions/setup-python#1005 |
Probably a good idea to get postinstall tests first: #2392Done!Closes #1855 by obsoleting it. It integrates the same idea of moving the script into a pywin32 package so it can be run as a module (
python -m win32.scripts.pywin32_postinstall -install), but with far less changes.It also registers it as a console script, which means users can simply call
pywin32_postinstall -install.The same was done for
pywin32_testallsince it was also already shipped as a Script.I've been doing some reading and if this works, it should be a really clean solution.

Doc: https://setuptools.pypa.io/en/latest/userguide/entry_point.html#console-scripts
Results: