Skip to content

Commit

Permalink
Merge branch 'main' into adodbapi-Update-collections-literals-and-com…
Browse files Browse the repository at this point in the history
…prehensions
  • Loading branch information
Avasam authored Jun 4, 2024
2 parents a2b7a44 + 60d7236 commit 098f735
Show file tree
Hide file tree
Showing 515 changed files with 7,132 additions and 7,361 deletions.
12 changes: 6 additions & 6 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# A clang-format style that approximates Python's PEP 7
# Useful for IDE integration
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html#configurable-format-style-options
Language: Cpp
BasedOnStyle: Google
AllowShortIfStatementsOnASingleLine: false

AlignAfterOpenBracket: Align
AllowShortIfStatementsOnASingleLine: false
AlwaysBreakAfterReturnType: None # Don't break after return type
BreakBeforeBraces: Stroustrup
ColumnLimit: 120
DerivePointerAlignment: false
IndentWidth: 4
Language: Cpp
PointerAlignment: Right
ReflowComments: true
SortIncludes: false # Sorting includes breaks build
SpaceBeforeParens: ControlStatements
SpacesInParentheses: false
TabWidth: 4
UseTab: Never
# sorting includes breaks build
SortIncludes: false
# don't break after return type
AlwaysBreakAfterReturnType: None
7 changes: 3 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
root = true

[*]
# TODO: Activate and run in a different PR. Lots of files affected
# trim_trailing_whitespace = true
# insert_final_newline = true
# end_of_line = crlf
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = crlf
indent_style = space
indent_size = 4
max_line_length = 120 # Same as .clang-format
Expand Down
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@

# 2021-09-11 formatted Python source with black.
858e19a76e08fc175a667ffc97409f2ef15bfc19

# 2024-05-28 formatted trailing-whitespaces and end-of-file with pre-commit
452e3dafc126faa978d67a946385bf2514477411

# 2024-05-28 formatted c++ source with clang-format
637448f8252ab142eedd539ddf9b08259b73eecc
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.9'

Expand Down
53 changes: 34 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev']
architecture: ['x64', 'x86']
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
architecture: ["x64", "x86"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
cache: pip
cache-dependency-path: .github/workflows/main.yml

- name: Setup environment
run: |
Expand Down Expand Up @@ -64,16 +66,18 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12-dev']
python-version: ["3.10", "3.11", "3.12-dev"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
architecture: "x64"
cache: pip
cache-dependency-path: .github/workflows/main.yml

- name: Setup Environment
run: |
Expand All @@ -99,32 +103,40 @@ jobs:
checkers:
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- 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'
- run: pip install pycln
python-version: "3.8"
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
with:
version: '0.3.4'
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
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/')
shell: powershell
mypy:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
# mypy 1.5 dropped support for Python 3.7
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: .github/workflows/main.yml
- run: pip install types-regex types-setuptools mypy==1.9
- run: mypy . --python-version=${{ matrix.python-version }}

Expand All @@ -133,15 +145,18 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: .github/workflows/main.yml
# pyright vendors typeshed, but let's make sure we have the most up to date stubs
- run: pip install types-regex types-setuptools
- uses: jakebailey/pyright-action@v2
with:
python-version: ${{ matrix.python-version }}
version: "1.1.358"
annotate: errors
30 changes: 19 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
# You can run this locally with `pre-commit run [--all]`
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
# TODO: Activate and run in a different PR. Lots of files affected
# - id: trailing-whitespace
# args: [--markdown-linebreak-ext=md]
# - id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=crlf]
# Vendored
exclude: ^com/win32comext/mapi/src/mapi_headers/.*$
- id: check-case-conflict
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
rev: v2.13.0
hooks:
- id: pretty-format-toml
args: [--autofix, --trailing-commas]
args: [--autofix, --trailing-commas, --inline-comment-spaces, "1", --no-sort]
- id: pretty-format-yaml
args: [--autofix, --indent, "2", --offset, "2", --preserve-quotes]
- id: pretty-format-ini
Expand All @@ -28,15 +25,26 @@ repos:
args: [--config=pycln.toml]
verbose: true
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
rev: v0.4.5
hooks:
- id: ruff # Run the linter.
args: [--fix]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.2.0
rev: 24.4.2
hooks:
- id: black
verbose: true
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.5
hooks:
- id: clang-format
# Supports a lot more filetypes, but only tagging those we use
# 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/).*$

ci:
autoupdate_schedule: quarterly
14 changes: 7 additions & 7 deletions AutoDuck/BuildHHP.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def handle_globs(lGlobs):
new = glob.glob(g)
if len(new) == 0:
print(f"The pattern '{g}' yielded no files!")
lFiles = lFiles + new
lFiles.extend(new)
# lFiles is now the list of origin files.
# Normalize all of the paths:
cFiles = len(lFiles)
Expand All @@ -52,9 +52,9 @@ def handle_globs(lGlobs):
while i < cFiles:
if not os.path.isfile(lFiles[i]):
del lFiles[i]
cFiles = cFiles - 1
cFiles -= 1
continue
i = i + 1
i += 1
# Find the common prefix of all of the files
sCommonPrefix = os.path.commonprefix(lFiles)
# Damn - more commonprefix problems
Expand All @@ -67,7 +67,7 @@ def handle_globs(lGlobs):
# else we have a trailing slash - it means we _expect_ it to be a patch as-is.
assert (
os.path.isdir(sCommonPrefix) and sCommonPrefix[-1] == "\\"
), "commonprefix splitting aint gunna work!"
), "commonprefix splitting ain't gunna work!"
print("sCommonPrefix=", sCommonPrefix)
# Ok, now remove this common prefix from every file:
lRelativeFiles = []
Expand Down Expand Up @@ -111,12 +111,12 @@ def main():
shutil.copyfile(lSrcFiles[i], file)

for file in lDestFiles:
html_files = html_files + f"{html_dir}\\{file}\n"
html_files += f"{html_dir}\\{file}\n"

for cat in doc:
html_files = html_files + f"{output_dir}\\{cat.id}.html\n"
html_files += f"{output_dir}\\{cat.id}.html\n"
for suffix in "_overview _modules _objects _constants".split():
html_files = html_files + f"{output_dir}\\{cat.id}{suffix}.html\n"
html_files += f"{output_dir}\\{cat.id}{suffix}.html\n"

f.write(sHHPFormat % {"output": output, "target": target, "html_files": html_files})
f.close()
Expand Down
2 changes: 1 addition & 1 deletion AutoDuck/Dump2HHC.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def genTOC(cats, output, title, target):
**locals()
)
)
# Dont show 'children' for objects - params etc don't need their own child nodes!
# Don't show 'children' for objects - params etc don't need their own child nodes!
_genItemsFromDict(cat.objects, cat, output, target, do_children=0)
output.write(
"""
Expand Down
6 changes: 3 additions & 3 deletions AutoDuck/InsertExternalOverviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ def processFile(input, out, extLinksHTML, extTopicHTML, importantHTML):
def genHTML(doc):
s = ""
for cat in doc:
s = s + f"<H3>{cat.label}</H3>\n"
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:
s = s + f'<LI><A HREF="html/{dict[k]}">{k}</A>\n'
s += f'<LI><A HREF="html/{dict[k]}">{k}</A>\n'
return s


def genLinksHTML(links):
s = ""
for link in links:
s = s + f'<LI><A HREF="{link.href}">{link.name}</A>\n'
s += f'<LI><A HREF="{link.href}">{link.name}</A>\n'
return s


Expand Down
Loading

0 comments on commit 098f735

Please sign in to comment.