Skip to content
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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)


- name: Build wheels
run: pip wheel . -v --wheel-dir=dist
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Outside of a virtual environment you might want to install COM objects, services
this by executing:

```shell
python Scripts/pywin32_postinstall.py -install
pywin32_postinstall -install
```

From the root of your Python installation.
Expand Down Expand Up @@ -91,7 +91,7 @@ It usually means one of 2 things:
So you should run it again:

```shell
python Scripts/pywin32_postinstall.py -install
pywin32_postinstall -install
```

This will make some small attempts to cleanup older conflicting installs.
Expand Down
13 changes: 12 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2108,7 +2108,18 @@ def convert_optional_data_files(files):
license="PSF",
classifiers=classifiers,
cmdclass=cmdclass,
scripts=["pywin32_postinstall.py", "pywin32_testall.py"],
# This adds the scripts under Python3XX/Scripts, but doesn't actually do much
scripts=[
"win32/scripts/pywin32_postinstall.py",
"win32/scripts/pywin32_testall.py",
],
Comment on lines +2080 to +2084
Copy link
Collaborator Author

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)

# This shortcuts `python -m win32.scripts.some_script` to just `some_script`
entry_points={
"console_scripts": [
"pywin32_postinstall = win32.scripts.pywin32_postinstall:main",
"pywin32_testall = win32.scripts.pywin32_testall:main",
]
},
ext_modules=ext_modules,
package_dir={
"win32com": "com/win32com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,10 @@ def main():

> python pywin32_postinstall.py -install

* or if pywin32 is already installed:

> pywin32_postinstall -install

This should be run automatically after installation,
but if it fails you can run it again.

Expand Down
File renamed without changes.
Loading