Skip to content

Commit

Permalink
Merge branch 'main' into adodbapi-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Oct 18, 2024
2 parents e210d58 + b922bf5 commit 8239f02
Show file tree
Hide file tree
Showing 196 changed files with 30,610 additions and 16,484 deletions.
2 changes: 1 addition & 1 deletion .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ For all bugs, please provide the following information:
## Expected behavior and actual behavior

## Steps to reproduce the problem
<!-- Prefer using code snippets rather than a screenshot. Please include a full minimal reproduction if possible. -->
<!-- Prefer using code snippets rather than a screenshot. Please include a [full minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) if possible. -->

1. ...
2. ...
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/download-arm64-libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
VERSION += f"-rc{sys.version_info.serial}"

URL = f"https://www.nuget.org/api/v2/package/pythonarm64/{VERSION}"
PATH = dest / f"pythonarm64.{VERSION}.zip"
DEST_PATH = dest / f"pythonarm64.{VERSION}.zip"

if PATH.is_file():
print("Skipping download because", PATH, "exists")
if DEST_PATH.is_file():
print("Skipping download because", DEST_PATH, "exists")
else:
print("Downloading", URL)
urlretrieve(URL, PATH)
print("Downloaded", PATH)
urlretrieve(URL, DEST_PATH)
print("Downloaded", DEST_PATH)

with ZipFile(PATH, "r") as zf:
with ZipFile(DEST_PATH, "r") as zf:
for name in zf.namelist():
zip_path = pathlib.PurePath(name)
if zip_path.parts[:2] == ("tools", "libs"):
Expand Down
33 changes: 19 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ jobs:
test:
name: Build and test
runs-on: windows-2019
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
architecture: ["x64", "x86"]

steps:
Expand All @@ -36,11 +37,11 @@ jobs:
run: |
python --version
pip --version
pip install --upgrade setuptools wheel
pip install --upgrade setuptools>=74 wheel
- name: Build and install
run: |
python setup.py --skip-verstamp install --user
python setup.py install --user
- name: Run tests
# Run the tests directly from the source dir so support files (eg, .wav files etc)
Expand All @@ -64,6 +65,7 @@ jobs:
build_arm64:
name: Cross-compile ARM
runs-on: windows-2019
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
Expand All @@ -84,14 +86,14 @@ jobs:
run: |
python --version
pip --version
pip install --upgrade setuptools wheel
pip install --upgrade setuptools>=74 wheel
- name: Obtain ARM64 library files
run: |
python .github\workflows\download-arm64-libs.py .\arm64libs
- name: Build wheels
run: python setup.py --skip-verstamp build_ext -L .\arm64libs --plat-name win-arm64 build --plat-name win-arm64 bdist_wheel --plat-name win-arm64
run: python setup.py build_ext -L .\arm64libs --plat-name win-arm64 build --plat-name win-arm64 bdist_wheel --plat-name win-arm64

- uses: actions/upload-artifact@v3
if: ${{ always() }}
Expand All @@ -103,33 +105,35 @@ jobs:
# This job can be run locally by running `pre-commit run`
checkers:
runs-on: windows-2019
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
# This job only needs to target the oldest supported version (black@stable supports Python >=3.8)
python-version: "3.8"
# This job only needs to target the oldest version supported by our checkers
# (black>=24.10.0 supports Python >=3.9)
python-version: "3.9"
cache: pip
cache-dependency-path: .github/workflows/main.yml
- run: pip install clang-format pycln
- run: pycln . --config=pycln.toml --check
- uses: chartboost/ruff-action@v1
- uses: astral-sh/ruff-action@v1
with:
version: "0.4.5"
- uses: psf/black@stable
with:
options: "--fast --check --diff --verbose"
- run: | # Too many files to fit in a single command, exclude vendored Scintilla and mapi_headers
- run: | # Too many files to fit in a single command, also exclude vendored Scintilla and MAPIStubLibrary
clang-format --Werror --dry-run $(git ls-files '*.cpp')
clang-format --Werror --dry-run $(git ls-files '*.h' ':!:Pythonwin/Scintilla/' ':!:com/win32comext/mapi/src/mapi_headers/')
clang-format --Werror --dry-run $(git ls-files '*.h' ':!:Pythonwin/Scintilla/' ':!:com/win32comext/mapi/src/MAPIStubLibrary/')
shell: powershell
mypy:
runs-on: windows-2019
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
# mypy 1.5 dropped support for Python 3.7
# mypy won't understand "3.13-dev", keeping the CI simple by just omitting it
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
Expand All @@ -140,15 +144,16 @@ jobs:
cache: pip
cache-dependency-path: .github/workflows/main.yml
check-latest: true
- run: pip install types-regex types-setuptools mypy==1.11
- run: pip install types-regex types-setuptools PyOpenGL mypy==1.11
- run: mypy . --python-version=${{ matrix.python-version }}

pyright:
runs-on: windows-2019
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -158,7 +163,7 @@ jobs:
cache-dependency-path: .github/workflows/main.yml
check-latest: true
# pyright vendors typeshed, but let's make sure we have the most up to date stubs
- run: pip install types-regex types-setuptools
- run: pip install types-regex types-setuptools PyOpenGL
- uses: jakebailey/pyright-action@v2
with:
python-version: ${{ matrix.python-version }}
Expand Down
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MANIFEST
build
dist
__pycache__
*.exe
*.zip
*.dbg
Expand All @@ -11,10 +12,10 @@ dist
*.flg
*.chm
*.chw
*.pyc
*.pyo
*.pdb
arm64libs/
pywin32.egg-info/
Pythonwin/Scintilla/win32/*.pdb
PyWin32.kpf

# COM test bits
Expand All @@ -27,7 +28,6 @@ com/TestSources/PyCOMTest/PyCOMTest.vc*proj*
com/TestSources/PyCOMTest/PyCOMTest_i.c
com/TestSources/PyCOMTest/.vs/


# SWIG generated files.
com/win32comext/adsi/src/*.cpp
!com/win32comext/adsi/src/PyADSIUtil.cpp
Expand All @@ -43,7 +43,6 @@ com/win32comext/mapi/src/Py*.h
!com/win32comext/mapi/src/PyMAPIUtil.h
win32/src/*_swig.cpp


# Generated from message files
win32/src/PerfMon/PyPerfMsgs.h
win32/src/PythonServiceMessages.h
Expand Down
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ repos:
# https://github.com/pre-commit/mirrors-clang-format/blob/main/.pre-commit-hooks.yaml#L6
types: [c++]


# Vendored
exclude: ^(com/win32comext/mapi/src/mapi_headers/|Pythonwin/Scintilla/).*$
exclude: ^(com/win32comext/mapi/src/MAPIStubLibrary/|Pythonwin/Scintilla/).*$

ci:
autoupdate_schedule: quarterly
8 changes: 2 additions & 6 deletions AutoDuck/Dump2HHC.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,7 @@ def _urlescape(name):


def _genCategoryHTMLFromDict(dict, output):
keys = list(dict.keys())
keys.sort()
for key in keys:
for key in sorted(dict):
topic = dict[key]
output.write(f'<LI><A HREF="{topic.context}">{topic.name}</A>\n')

Expand Down Expand Up @@ -285,9 +283,7 @@ def genCategoryHTML(output_dir, cats):

def _genItemsFromDict(dict, cat, output, target, do_children=1):
CHM = "mk:@MSITStore:%s.chm::/" % target
keys = list(dict.keys())
keys.sort()
for k in keys:
for k in sorted(dict):
context = dict[k].context
name = dict[k].name
output.write(
Expand Down
8 changes: 2 additions & 6 deletions AutoDuck/InsertExternalOverviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@ def genHTML(doc):
s = ""
for cat in doc:
s += f"<H3>{cat.label}</H3>\n"
dict = {}
for item in cat.overviewItems.items:
dict[item.name] = item.href
keys = list(dict.keys())
keys.sort()
for k in keys:
dict = {item.name: item.href for item in cat.overviewItems.items}
for k in sorted(dict):
s += f'<LI><A HREF="html/{dict[k]}">{k}</A>\n'
return s

Expand Down
1 change: 0 additions & 1 deletion AutoDuck/TOCToHHK.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os.path
import sys

"""
Expand Down
4 changes: 2 additions & 2 deletions AutoDuck/py2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def build_module(fp, mod_name):
functions = []
classes = []
constants = []
for name, ob in list(mod.__dict__.items()):
for name, ob in mod.__dict__.items():
if name.startswith("_"):
continue
if hasattr(ob, "__module__") and ob.__module__ != mod_name:
Expand Down Expand Up @@ -139,7 +139,7 @@ def build_module(fp, mod_name):
func_infos = []
# We need to iter the keys then to a getattr() so the funky descriptor
# things work.
for n in list(ob.ob.__dict__.keys()):
for n in ob.ob.__dict__:
o = getattr(ob.ob, n)
if isinstance(o, (types.FunctionType, types.MethodType)):
info = BuildInfo(n, o)
Expand Down
5 changes: 0 additions & 5 deletions AutoDuck/pywin32.mak
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ WIN32COM_SOURCE = \
$(GENDIR)\PyIProfAdmin.d \
$(GENDIR)\PyIProfSect.d \
$(GENDIR)\exchange.d \
$(GENDIR)\exchdapi.d \
$(ADSI_DIR)\src\*.cpp \
$(GENDIR)\adsi.d \
$(GENDIR)\PyIADsContainer.d \
Expand Down Expand Up @@ -231,10 +230,6 @@ $(GENDIR)\PyIProfSect.d: $(MAPI_DIR)/src/$(*B).i
$(GENDIR)\exchange.d: $(MAPI_DIR)/src/$(*B).i
$(PYTHON) makedfromi.py -o$*.d $(MAPI_DIR)/src/$(*B).i

# Exchange stuff.
$(GENDIR)\exchdapi.d: $(MAPI_DIR)/src/$(*B).i
$(PYTHON) makedfromi.py -o$*.d $(MAPI_DIR)/src/$(*B).i

# ADSI
$(GENDIR)\adsi.d: $(ADSI_DIR)/src/$(*B).i
$(PYTHON) makedfromi.py -o$*.d $(ADSI_DIR)/src/$(*B).i
Expand Down
39 changes: 37 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,45 @@ or
As of build 305, installation .exe files have been deprecated; see
https://mhammond.github.io/pywin32_installers.html.

Coming in build 307, as yet unreleased
Coming in build 309, as yet unreleased
--------------------------------------

* Dropped support for Python 3.7 (#2207, @Avasam)
* Implement the creation of SAFEARRAY(VT_RECORD) from a sequence of COM Records (#2317, @geppi)
* Implement record pointers as [in, out] method parameters of a Dispatch Interface (#2304, #2310, @geppi)
* Fix memory leak converting to PyObject from some SAFEARRAY elements (#2316)
* Fix bug where makepy support was unnecessarily generated (#2354, #2353, @geppi)
* Fail sooner on invalid `win32timezone.TimeZoneInfo` creation (#2338, @Avasam)
* Removed temporary `win32com.server.policy` reexports hack (#2344, @Avasam)
Import `DispatcherWin32trace` and `DispatcherTrace` from `win32com.server.dispatcher` instead.
* Fixed `win32timezone.TimeZoneInfo` initialization from a `[DYNAMIC_]TIME_ZONE_INFORMATION` (#2339, @Avasam)
* Added runtime deprecation warning of `win2kras`, use `win32ras` instead (#2356, @Avasam)
* Improved handling of dict iterations and fallbacks (removes Python 2 support code, small general speed improvement) (#2332, #2330, @Avasam)
* Fixed "Open GL Demo" (`Pythonwin/pywin/Demos/openGLDemo.py`) and restore "Font" demo in `Pythonwin/pywin/Demos/guidemo.py` (#2345, @Avasam)
* Fixed accidentally trying to raise an undefined name instead of an `Exception` in `Pythonwin/pywin/debugger/debugger.py` (#2326, @Avasam)

Build 308, released 2024-10-12
------------------------------
* Fix Pythonwin displaying syntax errors in Python 3.13 (#2393)
* Allowed installs from source w/o having pywin32 pre-installed (for instance, from GitHub) (#2349, @Avasam)
* Restored version stamping of installed DLLs (#2349, @Avasam)
* Fixed a circular import between `win32comext.axscript.client.framework` and `win32comext.axscript.client.error` (#2381, @Avasam)
* Remove long-deprecated `win32com.server.dispatcher.DispatcherWin32dbg` (#2382, @Avasam)

Build 307, released 2024-10-04
------------------------------
### Release process changes

pywin32 is now released from artifacts created by Github actions, whereas previously they were
created from an environment where certain tools and libraries were located and installed
by hand.

This means some capabilities are no longer provided - this includes some documentation artifacts, such
as the .chm file, certain MAPI libraries etc, and .exe installers.

### pywin32
* Remove obsolete and unused `pywin.is_platform_unicode` (#2343, @Avasam)
* Fix `isapi.ThreadPoolExtension`'s printing of exception traceback broken on Python 3.8+ (#2312, @Avasam)
* Add RealGetWindowClass (#2299, @CristiFati)
* Make it compile on Python 3.13 (#2260, @clin1234)
* Fixed accidentally trying to raise a `str` instead of an `Exception` in (#2270, @Avasam)
Expand Down Expand Up @@ -153,7 +188,7 @@ Coming in build 307, as yet unreleased
* Removed redundant and obsolete references to older python unicode compatibility (#2085, @Avasam)
* Use byte-string (`b""`) for constant bytes values instead of superfluous `.encode` calls (#2046, @Avasam)
* Cleaned up unused imports (#1986, #2051, #1990, #2124, #2126, @Avasam)
* Removed duplicated declarations, constants and definitions (#2050 , #1950, #1990, @Avasam)
* Removed duplicated declarations, constants and definitions (#2050, #1950, #1990, @Avasam)
* Small generalized optimization by using augmented assignements (in-place operators) where possible (#2274, @Avasam)
* General speed and size improvements due to all the removed code. (#2046, #1986, #2050, #1950, #2085, #2087, #2051, #1990, #2106, #2127, #2124, #2126, #2177, #2218, #2202, #2205, #2217)

Expand Down
4 changes: 1 addition & 3 deletions Pythonwin/pywin/Demos/app/customprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ def OnDraw(self, dc):
oldPen = None
x, y = self.size
delta = 2
colors = list(self.colors.keys())
colors.sort()
colors *= 2
colors = sorted(self.colors) * 2
for color in colors:
if oldPen is None:
oldPen = dc.SelectObject(self.pens[color])
Expand Down
5 changes: 1 addition & 4 deletions Pythonwin/pywin/Demos/cmdserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ def unregister(self):

def getwriter(self):
"Return the current thread's writer, default sys.stdout"
try:
return self.writers[_thread.get_ident()]
except KeyError:
return self.origStdOut
self.writers.get(_thread.get_ident(), self.origStdOut)

def write(self, str):
"Write to the current thread's writer, default sys.stdout"
Expand Down
Loading

0 comments on commit 8239f02

Please sign in to comment.