diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index edeb8e066..0cb4702dd 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -3,15 +3,18 @@ name: docs on: create: tags: - # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet + # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet - b[0-9][0-9][0-9] - publish-docs* push: branches: - main + pull_request: # Temporary just for test + branches: + - main jobs: - decompile: + generate: runs-on: windows-latest steps: @@ -22,44 +25,43 @@ jobs: with: python-version: '3.9' + # We still need to install pywin32 because + # AutoDuck/py2d.py currently relies on runtime imports for introspection + # Downloading latest release is faster than re-building - name: Install latest release run: pip install --user --upgrade pywin32 - - name: Set Python user site directory - run: python -c "import os,site;open(os.environ['GITHUB_ENV'], 'a').write(f'USER_DIR={site.USER_SITE}\n')" + - name: Generate PyWin32.chm help file + run: python AutoDuck/make.py - - name: Decompile shipped help file - run: hh -decompile site ${env:USER_DIR}\PyWin32.chm + - name: Decompile help file into HTML + run: hh -decompile site PyWin32.chm - name: Rename root HTML file run: mv site\PyWin32.HTML site\index.html - # Compress first to avoid slowly uploading thousands of individual files - - name: Create archive - run: python -m zipfile -c site.zip site - - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: documentation - path: site.zip + path: site/ publish: runs-on: ubuntu-latest needs: - - decompile + - generate # Only publish tags if: github.event_name == 'create' && github.event.ref_type == 'tag' steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: documentation - name: Unpack archive run: python -m zipfile -e site.zip . - - uses: peaceiris/actions-gh-pages@v3 + - uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: site diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 88e5ae6ca..1b004b1f3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,6 +43,13 @@ jobs: run: | python setup.py install --user + # This needs to happen *after* installing pywin32 since + # AutoDuck/py2d.py currently relies on runtime imports for introspection + # This isn't included in the wheel (TODO: could we?) + # and only servces as a PR test for the docs.yaml workflow + - name: Generate PyWin32.chm help file + run: python AutoDuck/make.py + - 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. diff --git a/AutoDuck/README b/AutoDuck/README.md similarity index 77% rename from AutoDuck/README rename to AutoDuck/README.md index 5d0520aed..192828d79 100644 --- a/AutoDuck/README +++ b/AutoDuck/README.md @@ -1,4 +1,4 @@ -Just run MAKE.BAT to build the documentation. +Just run [make.py](./make.py) to build the documentation. Main focus these days is on the .chm file - a single .chm provides the best documentation solution. We don't even diff --git a/AutoDuck/common_top.mak b/AutoDuck/common_top.mak index a76ffcda9..a2ebbd9e0 100644 --- a/AutoDuck/common_top.mak +++ b/AutoDuck/common_top.mak @@ -1,13 +1,12 @@ # Common AutoDuck make file -AD = bin\autoduck.exe /Spythonwin.fmt +AD = bin\autoduck.exe /Spythonwin.fmt ADHTMLFMT = bin\autoduck.exe /Spyhtml.fmt ADHTMLLOG = /R html "/L$(GENDIR)\$(TARGET).HHLOG" /N -ADLOG = /R help "/L$(GENDIR)\$(TARGET).HLOG" /N -ADHTML = /R html "/G$(GENDIR)\$(TARGET).DUMP" "/C$(GENDIR)\$(TARGET).HHLOG" "/I$(GENDIR)\$(TARGET).IDX" "/O$(GENDIR)\$(TARGET).HTML" /D "title=$(TITLE)" -ADHLP = /R help "/C$(GENDIR)\$(TARGET).HLOG" "/O$(GENDIR)\$(TARGET).RTF" /D "title=$(TITLE)" -ADDOC = /RD "/O$(GENDIR)\$(TARGET).DOC" /D "doc_header=$(DOCHDR)" -ADTAB = 8 -HC = hcw /a /c /e -HHC = hhc -PYTHON = py -2.7 +ADLOG = /R help "/L$(GENDIR)\$(TARGET).HLOG" /N +ADHTML = /R html "/G$(GENDIR)\$(TARGET).DUMP" "/C$(GENDIR)\$(TARGET).HHLOG" "/I$(GENDIR)\$(TARGET).IDX" "/O$(GENDIR)\$(TARGET).HTML" /D "title=$(TITLE)" +ADHLP = /R help "/C$(GENDIR)\$(TARGET).HLOG" "/O$(GENDIR)\$(TARGET).RTF" /D "title=$(TITLE)" +ADDOC = /RD "/O$(GENDIR)\$(TARGET).DOC" /D "doc_header=$(DOCHDR)" +ADTAB = 8 +HC = hcw /a /c /e +HHC = hhc diff --git a/AutoDuck/make.py b/AutoDuck/make.py index d3b9ee39a..c205aa0da 100644 --- a/AutoDuck/make.py +++ b/AutoDuck/make.py @@ -26,5 +26,7 @@ ).splitlines()[-1] subprocess.run( - [nmake, "-E", "-f", "pywin32.mak"], cwd=os.path.dirname(sys.argv[0]), check=True + [nmake, f'PYTHON="{sys.executable}"', "-E", "-f", "pywin32.mak"], + cwd=os.path.dirname(sys.argv[0]), + check=True, ) diff --git a/Pythonwin/win32win.cpp b/Pythonwin/win32win.cpp index f7db04170..4d8f9996e 100644 --- a/Pythonwin/win32win.cpp +++ b/Pythonwin/win32win.cpp @@ -25,7 +25,7 @@ generates Windows .hlp files. #include "win32cmdui.h" #include "win32rgn.h" #include "reswin32ui.h" -#include "AFXSTAT_.H" +#include "afxstat_.h" static char *szErrMsgBadHandle = "The window handle does not specify a valid window"; #define CHECK_HWND_VALID(pWnd) \ diff --git a/com/win32com/makegw/makegw.py b/com/win32com/makegw/makegw.py index 2a12239c8..e3c85d61a 100644 --- a/com/win32com/makegw/makegw.py +++ b/com/win32com/makegw/makegw.py @@ -20,7 +20,7 @@ any result values. This module automates the generation of such code. It has the ability to -parse a .H file generated by the MIDL tool (ie, almost all COM .h files) +parse a .h file generated by the MIDL tool (ie, almost all COM .h files) and build almost totally complete C++ code. The module understands some of the well known data types, and how to @@ -61,7 +61,7 @@ def make_framework_support( ): """Generate C++ code for a Python Interface and Gateway - header_file_name -- The full path to the .H file which defines the interface. + header_file_name -- The full path to the .h file which defines the interface. interface_name -- The name of the interface to search for, and to generate. bMakeInterface = 1 -- Should interface (ie, client) support be generated. bMakeGatewayInterface = 1 -- Should gateway (ie, server) support be generated. diff --git a/com/win32com/olectl.py b/com/win32com/olectl.py index 3ec5bf6ef..e2e16b42d 100644 --- a/com/win32com/olectl.py +++ b/com/win32com/olectl.py @@ -1,6 +1,6 @@ """Constants used by COM Controls -Hand created version of OLECTL.H constants. +Hand created version of olectl.h constants. """ import winerror diff --git a/com/win32com/src/ErrorUtils.cpp b/com/win32com/src/ErrorUtils.cpp index ff16d9985..c774e9f99 100644 --- a/com/win32com/src/ErrorUtils.cpp +++ b/com/win32com/src/ErrorUtils.cpp @@ -1115,7 +1115,7 @@ LPCTSTR GetFacilityString(HRESULT hr) _T("FACILITY_0x06"), _T("FACILITY_WIN32"), _T("FACILITY_WINDOWS"), - _T("FACILITY_SSPI/FACILITY_MQ"), // SSPI from ADSERR.H, MQ from mq.h + _T("FACILITY_SSPI/FACILITY_MQ"), // SSPI from AdsErr.h, MQ from mq.h _T("FACILITY_CONTROL"), _T("FACILITY_EDK"), _T("FACILITY_INTERNET"), diff --git a/com/win32comext/adsi/src/PyADSIUtil.cpp b/com/win32comext/adsi/src/PyADSIUtil.cpp index 07f3093d1..06c0ec209 100644 --- a/com/win32comext/adsi/src/PyADSIUtil.cpp +++ b/com/win32comext/adsi/src/PyADSIUtil.cpp @@ -672,11 +672,11 @@ BOOL PyADSIObject_AsADS_SEARCHPREF_INFOs(PyObject *ob, ADS_SEARCHPREF_INFO **ppr // // Error string utility. // -// ADSERR.h is built from a message file. +// AdsErr.h is built from a message file. // Therefore, there _must_ be a DLL around we can call // FormatMessage with. // However, it's not obvious, and this code was cut directly from MSDN. -#include "adserr.h" +#include "AdsErr.h" typedef struct tagADSERRMSG { HRESULT hr; LPCWSTR pszError; diff --git a/com/win32comext/axscript/src/GUIDS.CPP b/com/win32comext/axscript/src/GUIDs.cpp similarity index 72% rename from com/win32comext/axscript/src/GUIDS.CPP rename to com/win32comext/axscript/src/GUIDs.cpp index bce8d8807..9038c1225 100644 --- a/com/win32comext/axscript/src/GUIDS.CPP +++ b/com/win32comext/axscript/src/GUIDs.cpp @@ -1,10 +1,10 @@ /* * FILENAME: - * guids.cpp + * GUIDs.cpp * * DESCRIPTION: - * Define the guids used by the project. Both internally defined - * guids as well as guids from external sources. + * Define the GUIDs used by the project. Both internally defined + * GUIDs as well as GUIDs from external sources. */ #include #pragma data_seg(".text") @@ -17,7 +17,7 @@ #endif // === Project Guids === -#include "GUIDS.H" +#include "GUIDs.h" // NOTE - The standard "activscp.h" header is not good enough - // need to use IE4 SDK or MSVC6 etc #include "activscp.h" diff --git a/com/win32comext/axscript/src/GUIDS.H b/com/win32comext/axscript/src/GUIDs.h similarity index 98% rename from com/win32comext/axscript/src/GUIDS.H rename to com/win32comext/axscript/src/GUIDs.h index 20355e4d9..857a5b43d 100644 --- a/com/win32comext/axscript/src/GUIDS.H +++ b/com/win32comext/axscript/src/GUIDs.h @@ -3,7 +3,7 @@ /* * FILENAME: - * guids.h + * GUIDs.h * * DESCRIPTION: * GUID definitions for the project. diff --git a/com/win32comext/axscript/src/MULTINFO.H b/com/win32comext/axscript/src/multinfo.h similarity index 100% rename from com/win32comext/axscript/src/MULTINFO.H rename to com/win32comext/axscript/src/multinfo.h diff --git a/com/win32comext/mapi/mapitags.py b/com/win32comext/mapi/mapitags.py index e6e9667e0..e3238b662 100644 --- a/com/win32comext/mapi/mapitags.py +++ b/com/win32comext/mapi/mapitags.py @@ -824,7 +824,7 @@ def PROP_TAG(ulPropType, ulPropID): PROP_ID_SECURE_MIN = 26608 PROP_ID_SECURE_MAX = 26623 -# From EDKMDB.H +# From EdkMdb.h pidExchangeXmitReservedMin = 16352 pidExchangeNonXmitReservedMin = 26080 pidProfileMin = 26112 diff --git a/com/win32comext/mapi/src/PyIExchangeManageStore.i b/com/win32comext/mapi/src/PyIExchangeManageStore.i index 36e71e6bd..013136512 100644 --- a/com/win32comext/mapi/src/PyIExchangeManageStore.i +++ b/com/win32comext/mapi/src/PyIExchangeManageStore.i @@ -11,7 +11,7 @@ %include "mapilib.i" %{ -#include +#include #define INITGUID #include #define USES_IID_IExchangeManageStore diff --git a/com/win32comext/mapi/src/exchange.i b/com/win32comext/mapi/src/exchange.i index 8afdf76b0..8287cb008 100644 --- a/com/win32comext/mapi/src/exchange.i +++ b/com/win32comext/mapi/src/exchange.i @@ -26,8 +26,8 @@ #include "PythonCOMServer.h" #include "PythonCOMRegister.h" -#include "MAPIUTIL.H" -#include "EDKMDB.H" +#include "MAPIUtil.h" +#include "EdkMdb.h" #define USES_IID_IExchangeManageStore #include @@ -75,9 +75,9 @@ static int AddIID(PyObject *dict, const char *key, REFGUID guid) */ #ifdef SWIG_PY32BIT %{ -#include "EDKMAPI.H" -#include "EDKCFG.H" -#include "EDKUTILS.H" +#include "EdkMAPI.h" +#include "EdkCfg.h" +#include "EdkUtils.h" %} // @pyswig int, int|HrGetExchangeStatus|Obtains the current state of the server on a computer. diff --git a/com/win32comext/mapi/src/mapi.i b/com/win32comext/mapi/src/mapi.i index b66133443..be270f51d 100644 --- a/com/win32comext/mapi/src/mapi.i +++ b/com/win32comext/mapi/src/mapi.i @@ -52,9 +52,8 @@ #include "IConverterSession.h" #include "PyIConverterSession.h" -#include "MAPISPI.H" -#include "MAPISPI.H" -#include "IMESSAGE.H" +#include "MAPISPI.h" +#include "IMessage.h" #include "MSPST.h" #include "extraMAPIGuids.h" diff --git a/isapi/src/pyISAPI.cpp b/isapi/src/pyISAPI.cpp index 453cc2b99..6cf639351 100644 --- a/isapi/src/pyISAPI.cpp +++ b/isapi/src/pyISAPI.cpp @@ -23,7 +23,7 @@ ====================================================================== */ -// PYISAPI.CPP - Implementation file for your Internet Server +// pyISAPI.cpp - Implementation file for your Internet Server // Python ISAPI Extension #include "stdafx.h" diff --git a/isapi/src/pyISAPI.h b/isapi/src/pyISAPI.h index b5931e538..6a82a9a91 100644 --- a/isapi/src/pyISAPI.h +++ b/isapi/src/pyISAPI.h @@ -25,7 +25,7 @@ #ifndef __PYISAPI_H__ #define __PYISAPI_H__ -// PYISAPI.H - Header file for your Internet Server +// pyISAPI.h - Header file for your Internet Server // Python ISAPI Extension #include "PythonEng.h" diff --git a/setup.py b/setup.py index fcd1d6381..bd63dead1 100644 --- a/setup.py +++ b/setup.py @@ -921,13 +921,6 @@ def my_new_compiler(**kw): class my_compiler(MSVCCompiler): - # Just one GUIDS.CPP and it gives trouble on mainwin too. Maybe I - # should just rename the file, but a case-only rename is likely to be - # worse! This can probably go away once we kill the VS project files - # though, as we can just specify the lowercase name in the module def. - _cpp_extensions = MSVCCompiler._cpp_extensions + [".CPP"] - src_extensions = MSVCCompiler.src_extensions + [".CPP"] # type: ignore[operator] # TODO: Fix in typeshed - def link( self, target_desc, @@ -1422,7 +1415,7 @@ def finalize_options(self): sources=( """ {axscript}/AXScript.cpp - {axscript}/GUIDS.CPP {axscript}/PyGActiveScript.cpp + {axscript}/GUIDS.cpp {axscript}/PyGActiveScript.cpp {axscript}/PyGActiveScriptError.cpp {axscript}/PyGActiveScriptParse.cpp {axscript}/PyGActiveScriptSite.cpp {axscript}/PyGObjectSafety.cpp {axscript}/PyIActiveScript.cpp {axscript}/PyIActiveScriptError.cpp @@ -1434,7 +1427,7 @@ def finalize_options(self): depends=( """ {axscript}/AXScript.h - {axscript}/guids.h {axscript}/PyGActiveScriptError.h + {axscript}/GUIDs.h {axscript}/PyGActiveScriptError.h {axscript}/PyIActiveScriptError.h {axscript}/PyIObjectSafety.h {axscript}/PyIProvideMultipleClassInfo.h {axscript}/stdafx.h diff --git a/win32/Lib/commctrl.py b/win32/Lib/commctrl.py index 26641e845..452fe62ef 100644 --- a/win32/Lib/commctrl.py +++ b/win32/Lib/commctrl.py @@ -1,4 +1,4 @@ -# Generated by h2py from COMMCTRL.H +# Generated by h2py from CommCtrl.h WM_USER = 1024 ICC_LISTVIEW_CLASSES = 1 # listview, header ICC_TREEVIEW_CLASSES = 2 # treeview, tooltips diff --git a/win32/Lib/win32pdhquery.py b/win32/Lib/win32pdhquery.py index 724a668a7..301b85c16 100644 --- a/win32/Lib/win32pdhquery.py +++ b/win32/Lib/win32pdhquery.py @@ -560,11 +560,11 @@ def __setstate__(self, volatilecounters): self.volatilecounters = volatilecounters -class QueryError: - def __init__(self, query): +class QueryError(Exception): + def __init__(self, query: BaseQuery): self.query = query def __repr__(self): - return "" % repr(self.query) + return f"" __str__ = __repr__ diff --git a/win32/src/_winxptheme.i b/win32/src/_winxptheme.i index 3ef07bbb9..2320b881e 100644 --- a/win32/src/_winxptheme.i +++ b/win32/src/_winxptheme.i @@ -21,7 +21,7 @@ #include "pywinobjects.h" #include "windows.h" #include "Uxtheme.h" -#include "commctrl.h" +#include "CommCtrl.h" %} diff --git a/win32/src/stddde.h b/win32/src/stddde.h index 85688c1f9..3263f4fbd 100644 --- a/win32/src/stddde.h +++ b/win32/src/stddde.h @@ -26,7 +26,7 @@ // // String names for some standard DDE strings not -// defined in DDEML.H +// defined in ddeml.h // #define SZ_READY "Ready" diff --git a/win32/src/win32dynamicdialog.cpp b/win32/src/win32dynamicdialog.cpp index bef647374..2b1992d67 100644 --- a/win32/src/win32dynamicdialog.cpp +++ b/win32/src/win32dynamicdialog.cpp @@ -34,7 +34,7 @@ #include "python.h" #undef PyHANDLE #include -#include "commctrl.h" +#include "CommCtrl.h" #include "windowsx.h" // For edit control hacks. #include "pywintypes.h" diff --git a/win32/src/win32gui.i b/win32/src/win32gui.i index fa0906b7e..172218879 100644 --- a/win32/src/win32gui.i +++ b/win32/src/win32gui.i @@ -14,7 +14,7 @@ #undef PyHANDLE #include "pywinobjects.h" #include "winuser.h" -#include "commctrl.h" +#include "CommCtrl.h" #include "windowsx.h" // For edit control hacks. #include "Dbt.h" // device notification #include "malloc.h" diff --git a/win32/src/win32security.i b/win32/src/win32security.i index c614d3081..48b4d2dc8 100644 --- a/win32/src/win32security.i +++ b/win32/src/win32security.i @@ -1246,9 +1246,9 @@ done: if it fails. If the SID can be constructed successfully, a valid binary SID is returned. - This function requires TCHAR.H and the C runtime library. + This function requires tchar.h and the C runtime library. - The following are macros defined in TCHAR.H that allow this + The following are macros defined in tchar.h that allow this function to be compiled with or without UNICODE defined. To replace these macros with direct calls to their corresponding ANSI functions first make sure this module is not compiled