Skip to content

Commit

Permalink
Merge branch 'main' into Remove-unused-hIcon-param-from-PyShellExecuteEx
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Nov 12, 2024
2 parents 8b91e9e + b64bccb commit 965c474
Show file tree
Hide file tree
Showing 27 changed files with 71 additions and 69 deletions.
32 changes: 17 additions & 15 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion AutoDuck/README → AutoDuck/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 8 additions & 9 deletions AutoDuck/common_top.mak
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion AutoDuck/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
2 changes: 1 addition & 1 deletion Pythonwin/win32win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
4 changes: 2 additions & 2 deletions com/win32com/makegw/makegw.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion com/win32com/olectl.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion com/win32com/src/ErrorUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions com/win32comext/adsi/src/PyADSIUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <objbase.h>
#pragma data_seg(".text")
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/*
* FILENAME:
* guids.h
* GUIDs.h
*
* DESCRIPTION:
* GUID definitions for the project.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion com/win32comext/mapi/mapitags.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion com/win32comext/mapi/src/PyIExchangeManageStore.i
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
%include "mapilib.i"

%{
#include <edkmdb.h>
#include <EdkMdb.h>
#define INITGUID
#include <initguid.h>
#define USES_IID_IExchangeManageStore
Expand Down
10 changes: 5 additions & 5 deletions com/win32comext/mapi/src/exchange.i
Original file line number Diff line number Diff line change
Expand Up @@ -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 <edkguid.h>
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions com/win32comext/mapi/src/mapi.i
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion isapi/src/pyISAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion isapi/src/pyISAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 2 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion win32/Lib/commctrl.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions win32/Lib/win32pdhquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<Query Error in %s>" % repr(self.query)
return f"<Query Error in {self.query!r}>"

__str__ = __repr__
2 changes: 1 addition & 1 deletion win32/src/_winxptheme.i
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "pywinobjects.h"
#include "windows.h"
#include "Uxtheme.h"
#include "commctrl.h"
#include "CommCtrl.h"


%}
Expand Down
2 changes: 1 addition & 1 deletion win32/src/stddde.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

//
// String names for some standard DDE strings not
// defined in DDEML.H
// defined in ddeml.h
//

#define SZ_READY "Ready"
Expand Down
2 changes: 1 addition & 1 deletion win32/src/win32dynamicdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "python.h"
#undef PyHANDLE
#include <windows.h>
#include "commctrl.h"
#include "CommCtrl.h"
#include "windowsx.h" // For edit control hacks.

#include "pywintypes.h"
Expand Down
2 changes: 1 addition & 1 deletion win32/src/win32gui.i
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions win32/src/win32security.i
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 965c474

Please sign in to comment.