Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions com/win32comext/adsi/demos/scp.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def AllowAccessToScpProperties(
setattr(scpObject, attribute, sd)
# SetInfo updates the SCP object in the directory.
scpObject.SetInfo()
logger.info(f"Set security on object for account '{trustee}'")
logger.info("Set security on object for account %r", trustee)


# Service Principal Names functions from the same sample.
Expand Down Expand Up @@ -414,12 +414,14 @@ def main():
"-q", "--quiet", action="store_true", help="Don't print any status messages"
)

parser.add_option(
"-t",
"--test",
action="store_true",
help="Execute a mini-test suite, providing defaults for most options and args",
),
(
parser.add_option(
"-t",
"--test",
action="store_true",
help="Execute a mini-test suite, providing defaults for most options and args",
),
)

parser.add_option(
"",
Expand Down
18 changes: 16 additions & 2 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@ target-version = "py37"

[lint]
select = [
"C4", # flake8-comprehensions
"F811", # redefined-while-unused
"FLY", # static-join-to-f-string
"G", # flake8-logging-format
"I", # isort
"ISC001", # single-line-implicit-string-concatenation
"ISC002", # multi-line-implicit-string-concatenation
"PLC", # Pylint Convention
"PLE", # Pylint Error
"RSE", # flake8-raise
"W", # pycodestyle Warning
"YTT", # flake8-2020
# Ensure modern type annotation syntax and best practices
# Not including those covered by type-checkers
"FA", # flake8-future-annotations
Expand All @@ -19,12 +29,13 @@ select = [
[lint.per-file-ignores]
# Explicit re-exports is fine in __init__.py, still a code smell elsewhere.
"__init__.py" = ["PLC0414"]
# TODO: Make adodbapi changes in their own PRs
"adodbapi/*" = ["C4", "YTT301"]

[lint.isort]
detect-same-package = false # Because pywin32 has a mix of relative and absolute imports, with undetectable first-party c-extensions
combine-as-imports = true
# Because pywin32 has a mix of relative and absolute imports, with undetectable first-party c-extensions
# This makes import grouping more consistent
detect-same-package = false
known-third-party = [
"__main__",
# This forces distutils imports to always be after setuptools
Expand All @@ -33,3 +44,6 @@ known-third-party = [
"distutils",
]
extra-standard-library = ["setuptools"]

[lint.flake8-implicit-str-concat]
allow-multiline = false # ignore ISC003 with this option disabled
74 changes: 19 additions & 55 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1384,9 +1384,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 @@ -1413,9 +1411,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 @@ -1443,9 +1439,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 @@ -1463,9 +1457,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 @@ -1480,9 +1472,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 @@ -1491,9 +1481,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 @@ -1549,9 +1537,7 @@ def finalize_options(self):
{axdebug}/PyIRemoteDebugApplicationEvents.cpp
{axdebug}/PyIRemoteDebugApplicationThread.cpp
{axdebug}/stdafx.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com(
Expand All @@ -1564,9 +1550,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 @@ -1602,9 +1586,7 @@ def finalize_options(self):
{mapi}/mapiguids.cpp
{mapi}/mapi_stub_library/MapiStubLibrary.cpp
{mapi}/mapi_stub_library/StubUtils.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com_mapi(
Expand All @@ -1620,9 +1602,7 @@ def finalize_options(self):
{mapi}/exchangeguids.cpp
{mapi}/mapi_stub_library/MapiStubLibrary.cpp
{mapi}/mapi_stub_library/StubUtils.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com_mapi(
Expand All @@ -1634,9 +1614,7 @@ def finalize_options(self):
{mapi}/exchdapi.i {mapi}/exchdapi.cpp
{mapi}/mapi_stub_library/MapiStubLibrary.cpp
{mapi}/mapi_stub_library/StubUtils.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com(
Expand Down Expand Up @@ -1718,9 +1696,7 @@ def finalize_options(self):
{shell}/PyIUniformResourceLocator.cpp
{shell}/shell.cpp

""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com(
Expand Down Expand Up @@ -1748,9 +1724,7 @@ def finalize_options(self):
{propsys}/PyIObjectWithPropertyKey.cpp
{propsys}/PyIPropertyChange.cpp
{propsys}/PyIPropertyChangeArray.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
implib_name="pypropsys",
),
Expand All @@ -1766,9 +1740,7 @@ def finalize_options(self):
{taskscheduler}/PyITaskScheduler.cpp
{taskscheduler}/PyITaskTrigger.cpp

""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com(
Expand All @@ -1789,9 +1761,7 @@ def finalize_options(self):
{bits}/PyIEnumBackgroundCopyJobs.cpp
{bits}/PyIEnumBackgroundCopyFiles.cpp

""".format(
**dirs
)
""".format(**dirs)
).split(),
),
WinExt_win32com(
Expand All @@ -1812,18 +1782,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 @@ -1835,9 +1801,7 @@ def finalize_options(self):
"""
{authorization}/authorization.cpp
{authorization}/PyGSecurityInformation.cpp
""".format(
**dirs
)
""".format(**dirs)
).split(),
),
]
Expand Down Expand Up @@ -2132,7 +2096,7 @@ def convert_optional_data_files(files):
except RuntimeError as details:
if not str(details.args[0]).startswith("No file"):
raise
logging.info("NOTE: Optional file %s not found - skipping" % file)
logging.info("NOTE: Optional file %s not found - skipping", file)
else:
ret.append(temp[0])
return ret
Expand Down