Skip to content

Commit

Permalink
Make pywin32_postinstall and pywin32_testall into console_scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Oct 15, 2024
1 parent c717bfa commit 44cd308
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: pywin32_testall -v -skip-adodbapi

- name: Build wheels
run: |
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
81 changes: 29 additions & 52 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1350,9 +1350,7 @@ def finalize_options(self):
{win32com}/extensions/PyICancelMethodCalls.cpp {win32com}/extensions/PyIContext.cpp
{win32com}/extensions/PyIEnumContextProps.cpp {win32com}/extensions/PyIClientSecurity.cpp
{win32com}/extensions/PyIServerSecurity.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
depends=(
"""
Expand All @@ -1379,9 +1377,7 @@ def finalize_options(self):
{win32com}/include\\PyICancelMethodCalls.h {win32com}/include\\PyIContext.h
{win32com}/include\\PyIEnumContextProps.h {win32com}/include\\PyIClientSecurity.h
{win32com}/include\\PyIServerSecurity.h
""".format(
**dirs
)
""".format(**dirs)
).split(),
libraries="oleaut32 ole32 user32 urlmon",
export_symbol_file="com/win32com/src/PythonCOM.def",
Expand Down Expand Up @@ -1409,9 +1405,7 @@ def finalize_options(self):
{adsi}/adsilib.i
{adsi}/PyADSIUtil.cpp {adsi}/PyDSOPObjects.cpp
{adsi}/PyIADs.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com(
Expand All @@ -1429,9 +1423,7 @@ def finalize_options(self):
{axcontrol}/PyIOleClientSite.cpp {axcontrol}/PyIOleInPlaceSite.cpp
{axcontrol}/PyIOleObject.cpp {axcontrol}/PyIViewObject2.cpp
{axcontrol}/PyIOleCommandTarget.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com(
Expand All @@ -1446,9 +1438,7 @@ def finalize_options(self):
{axscript}/PyIActiveScriptParse.cpp {axscript}/PyIActiveScriptParseProcedure.cpp
{axscript}/PyIActiveScriptSite.cpp {axscript}/PyIMultiInfos.cpp
{axscript}/PyIObjectSafety.cpp {axscript}/stdafx.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
depends=(
"""
Expand All @@ -1457,9 +1447,7 @@ def finalize_options(self):
{axscript}/PyIActiveScriptError.h {axscript}/PyIObjectSafety.h
{axscript}/PyIProvideMultipleClassInfo.h
{axscript}/stdafx.h
""".format(
**dirs
)
""".format(**dirs)
).split(),
extra_compile_args=["-DPY_BUILD_AXSCRIPT"],
implib_name="axscript",
Expand Down Expand Up @@ -1515,9 +1503,7 @@ def finalize_options(self):
{axdebug}/PyIRemoteDebugApplicationEvents.cpp
{axdebug}/PyIRemoteDebugApplicationThread.cpp
{axdebug}/stdafx.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com(
Expand All @@ -1530,9 +1516,7 @@ def finalize_options(self):
{internet}/PyIInternetPriority.cpp {internet}/PyIInternetProtocol.cpp
{internet}/PyIInternetProtocolInfo.cpp {internet}/PyIInternetProtocolRoot.cpp
{internet}/PyIInternetProtocolSink.cpp {internet}/PyIInternetSecurityManager.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
depends=["{internet}/internet_pch.h".format(**dirs)],
),
Expand Down Expand Up @@ -1568,9 +1552,7 @@ def finalize_options(self):
{mapi}/mapiguids.cpp
{mapi}/MAPIStubLibrary/library/mapiStubLibrary.cpp
{mapi}/MAPIStubLibrary/library/stubutils.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com_mapi(
Expand All @@ -1586,9 +1568,7 @@ def finalize_options(self):
{mapi}/exchangeguids.cpp
{mapi}/MAPIStubLibrary/library/mapiStubLibrary.cpp
{mapi}/MAPIStubLibrary/library/stubutils.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com(
Expand Down Expand Up @@ -1670,9 +1650,7 @@ def finalize_options(self):
{shell}/PyIUniformResourceLocator.cpp
{shell}/shell.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com(
Expand Down Expand Up @@ -1700,9 +1678,7 @@ def finalize_options(self):
{propsys}/PyIObjectWithPropertyKey.cpp
{propsys}/PyIPropertyChange.cpp
{propsys}/PyIPropertyChangeArray.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
implib_name="pypropsys",
),
Expand All @@ -1718,9 +1694,7 @@ def finalize_options(self):
{taskscheduler}/PyITaskScheduler.cpp
{taskscheduler}/PyITaskTrigger.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com(
Expand All @@ -1741,9 +1715,7 @@ def finalize_options(self):
{bits}/PyIEnumBackgroundCopyJobs.cpp
{bits}/PyIEnumBackgroundCopyFiles.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com(
Expand All @@ -1764,18 +1736,14 @@ def finalize_options(self):
{directsound}/PyIDirectSoundBuffer.cpp {directsound}/PyIDirectSoundCapture.cpp
{directsound}/PyIDirectSoundCaptureBuffer.cpp
{directsound}/PyIDirectSoundNotify.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
depends=(
"""
{directsound}/directsound_pch.h {directsound}/PyIDirectSound.h
{directsound}/PyIDirectSoundBuffer.h {directsound}/PyIDirectSoundCapture.h
{directsound}/PyIDirectSoundCaptureBuffer.h {directsound}/PyIDirectSoundNotify.h
""".format(
**dirs
)
""".format(**dirs)
).split(),
optional_headers=["dsound.h"],
libraries="user32 dsound dxguid",
Expand All @@ -1787,9 +1755,7 @@ def finalize_options(self):
"""
{authorization}/authorization.cpp
{authorization}/PyGSecurityInformation.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
]
Expand Down Expand Up @@ -2222,7 +2188,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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
File renamed without changes.

0 comments on commit 44cd308

Please sign in to comment.