-
Notifications
You must be signed in to change notification settings - Fork 807
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
Make pywin32_postinstall
and pywin32_testall
into Console Scripts
#2408
base: main
Are you sure you want to change the base?
Conversation
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
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) |
.github/workflows/main.yml
Outdated
@@ -52,7 +52,7 @@ jobs: | |||
- name: Run tests | |||
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Probably a good idea to get postinstall tests first: #2392
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_testall
since 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: