From bc7ad11b2d65509504499bfc89941df9a290f9a4 Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 15 Oct 2024 18:16:59 -0400 Subject: [PATCH] Make pywin32_postinstall and pywin32_testall into console_scripts --- .github/workflows/main.yml | 2 +- README.md | 4 ++-- setup.py | 13 ++++++++++++- .../scripts/pywin32_postinstall.py | 4 ++++ .../scripts/pywin32_testall.py | 0 5 files changed, 19 insertions(+), 4 deletions(-) rename pywin32_postinstall.py => win32/scripts/pywin32_postinstall.py (99%) rename pywin32_testall.py => win32/scripts/pywin32_testall.py (100%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aa1049f062..5106b15a85 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,7 +46,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 - name: Build wheels run: | diff --git a/README.md b/README.md index b03454e45f..de76e05fc0 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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. diff --git a/setup.py b/setup.py index ce0120e249..1a1af46982 100644 --- a/setup.py +++ b/setup.py @@ -2222,7 +2222,18 @@ def maybe_fixup_exes(): "user_access_control": "auto", }, }, - 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", + ], + # 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", diff --git a/pywin32_postinstall.py b/win32/scripts/pywin32_postinstall.py similarity index 99% rename from pywin32_postinstall.py rename to win32/scripts/pywin32_postinstall.py index a9dd85645d..a6395ee35d 100644 --- a/pywin32_postinstall.py +++ b/win32/scripts/pywin32_postinstall.py @@ -702,6 +702,10 @@ def main(): > python pywin32_postinstall.py -install + * or if pywin32 is already installed: + + > pywin32_postinstall -install + If you installed pywin32 via a .exe installer, this should be run automatically after installation, but if it fails you can run it again. diff --git a/pywin32_testall.py b/win32/scripts/pywin32_testall.py similarity index 100% rename from pywin32_testall.py rename to win32/scripts/pywin32_testall.py