Skip to content

Commit

Permalink
Remove windows_h_version from setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Oct 27, 2024
1 parent 5a46a21 commit a586c34
Showing 1 changed file with 19 additions and 61 deletions.
80 changes: 19 additions & 61 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def __init__(
export_symbols=None,
export_symbol_file=None,
pch_header=None,
windows_h_version=None, # min version of windows.h needed.
extra_swig_commands=None,
is_regular_dll=False, # regular Windows DLL?
# list of headers which may not be installed forcing us to
Expand Down Expand Up @@ -126,7 +125,6 @@ def __init__(
define_macros.append(("CRYPT_DECRYPT_MESSAGE_PARA_HAS_EXTRA_FIELDS", None))
self.pch_header = pch_header
self.extra_swig_commands = extra_swig_commands or []
self.windows_h_version = windows_h_version
self.optional_headers = optional_headers
self.is_regular_dll = is_regular_dll
self.base_address = base_address
Expand Down Expand Up @@ -255,10 +253,6 @@ def get_pywin32_dir(self):
class WinExt_win32com(WinExt):
def __init__(self, name, **kw):
kw["libraries"] = kw.get("libraries", "") + " oleaut32 ole32"

# COM extensions require later windows headers.
if not kw.get("windows_h_version"):
kw["windows_h_version"] = 0x500
WinExt.__init__(self, name, **kw)

def get_pywin32_dir(self):
Expand Down Expand Up @@ -364,8 +358,6 @@ def finalize_options(self):
"win-arm64": "arm64",
}.get(self.plat_name, "x86")

self.windows_h_version = None

# The pywintypes library is created in the build_temp
# directory, so we need to add this to library_dirs
self.library_dirs.append(self.build_temp)
Expand All @@ -387,13 +379,6 @@ def _why_cant_build_extension(self, ext):
include_dirs = self.compiler.include_dirs + os.environ.get("INCLUDE", "").split(
os.pathsep
)
if self.windows_h_version is None:
# Note that we used to try and find WINVER or _WIN32_WINNT macros
# here defining the version of the Windows SDK we use and check
# it was late enough for the extension being built. But since we
# moved to the Windows 8.1 SDK (or later), this isn't necessary
# as all modules require less than this.
pass

look_dirs = include_dirs
for h in ext.optional_headers:
Expand Down Expand Up @@ -1089,27 +1074,24 @@ def finalize_options(self):
),
)

for info in (
# (name, libraries, WINVER, sources)
("mmapfile", "", None, "win32/src/mmapfilemodule.cpp"),
("odbc", "odbc32 odbccp32", None, "win32/src/odbc.cpp"),
for name, libraries, sources in (
("mmapfile", "", "win32/src/mmapfilemodule.cpp"),
("odbc", "odbc32 odbccp32", "win32/src/odbc.cpp"),
(
"perfmon",
"",
None,
"""
win32/src/PerfMon/MappingManager.cpp
win32/src/PerfMon/PerfCounterDefn.cpp
win32/src/PerfMon/PerfObjectType.cpp
win32/src/PerfMon/PyPerfMon.cpp
""",
),
("timer", "user32", None, "win32/src/timermodule.cpp"),
("win32cred", "AdvAPI32 credui", 0x0501, "win32/src/win32credmodule.cpp"),
("timer", "user32", "win32/src/timermodule.cpp"),
("win32cred", "AdvAPI32 credui", "win32/src/win32credmodule.cpp"),
(
"win32crypt",
"Crypt32 Advapi32",
0x0500,
"""
win32/src/win32crypt/win32cryptmodule.cpp
win32/src/win32crypt/win32crypt_structs.cpp
Expand All @@ -1125,48 +1107,43 @@ def finalize_options(self):
(
"win32file",
"ws2_32 mswsock",
0x0500,
"""
win32/src/win32file.i
win32/src/win32file_comm.cpp
""",
),
("win32event", "user32", None, "win32/src/win32event.i"),
("win32event", "user32", "win32/src/win32event.i"),
(
"win32clipboard",
"gdi32 user32 shell32",
None,
"win32/src/win32clipboardmodule.cpp",
),
# win32gui handled below
("win32job", "user32", 0x0500, "win32/src/win32job.i"),
("win32lz", "lz32", None, "win32/src/win32lzmodule.cpp"),
("win32job", "user32", "win32/src/win32job.i"),
("win32lz", "lz32", "win32/src/win32lzmodule.cpp"),
(
"win32net",
"netapi32 advapi32",
None,
"""
win32/src/win32net/win32netfile.cpp win32/src/win32net/win32netgroup.cpp
win32/src/win32net/win32netmisc.cpp win32/src/win32net/win32netmodule.cpp
win32/src/win32net/win32netsession.cpp win32/src/win32net/win32netuse.cpp
win32/src/win32net/win32netuser.cpp
""",
),
("win32pdh", "", None, "win32/src/win32pdhmodule.cpp"),
("win32pipe", "", None, "win32/src/win32pipe.i"),
("win32pdh", "", "win32/src/win32pdhmodule.cpp"),
("win32pipe", "", "win32/src/win32pipe.i"),
(
"win32print",
"winspool user32 gdi32",
0x0500,
"win32/src/win32print/win32print.cpp",
),
("win32process", "advapi32 user32", 0x0500, "win32/src/win32process.i"),
("win32profile", "Userenv", None, "win32/src/win32profilemodule.cpp"),
("win32ras", "rasapi32 user32", 0x0500, "win32/src/win32rasmodule.cpp"),
("win32process", "advapi32 user32", "win32/src/win32process.i"),
("win32profile", "Userenv", "win32/src/win32profilemodule.cpp"),
("win32ras", "rasapi32 user32", "win32/src/win32rasmodule.cpp"),
(
"win32security",
"advapi32 user32 netapi32",
0x0500,
"""
win32/src/win32security.i
win32/src/win32security_sspi.cpp win32/src/win32security_ds.cpp
Expand All @@ -1175,17 +1152,15 @@ def finalize_options(self):
(
"win32service",
"advapi32 oleaut32 user32",
0x0501,
"""
win32/src/win32service_messages.mc
win32/src/win32service.i
""",
),
("win32trace", "advapi32", None, "win32/src/win32trace.cpp"),
("win32trace", "advapi32", "win32/src/win32trace.cpp"),
(
"win32wnet",
"netapi32 mpr",
None,
"""
win32/src/win32wnet/PyNCB.cpp
win32/src/win32wnet/PyNetresource.cpp
Expand All @@ -1195,28 +1170,20 @@ def finalize_options(self):
(
"win32inet",
"wininet",
0x500,
"""
win32/src/win32inet.i
win32/src/win32inet_winhttp.cpp
""",
),
("win32console", "kernel32", 0x0501, "win32/src/win32consolemodule.cpp"),
("win32ts", "WtsApi32", 0x0501, "win32/src/win32tsmodule.cpp"),
("_win32sysloader", "", 0x0501, "win32/src/_win32sysloader.cpp"),
("win32transaction", "kernel32", 0x0501, "win32/src/win32transactionmodule.cpp"),
("win32console", "kernel32", "win32/src/win32consolemodule.cpp"),
("win32ts", "WtsApi32", "win32/src/win32tsmodule.cpp"),
("_win32sysloader", "", "win32/src/_win32sysloader.cpp"),
("win32transaction", "kernel32", "win32/src/win32transactionmodule.cpp"),
):
name, lib_names = info[:2]
windows_h_ver = sources = None
if len(info) > 2:
windows_h_ver = info[2]
if len(info) > 3:
sources = info[3].split()
ext = WinExt_win32(
name,
libraries=lib_names,
libraries=libraries,
extra_compile_args=[],
windows_h_version=windows_h_ver,
sources=sources,
)
win32_extensions.append(ext)
Expand All @@ -1230,7 +1197,6 @@ def finalize_options(self):
""".split(),
libraries="advapi32 oleaut32",
delay_load_libraries="wevtapi",
windows_h_version=0x0600,
),
WinExt_win32(
"win32api",
Expand All @@ -1239,15 +1205,13 @@ def finalize_options(self):
""".split(),
libraries="user32 advapi32 shell32 version",
delay_load_libraries="powrprof",
windows_h_version=0x0500,
),
WinExt_win32(
"win32gui",
sources="""
win32/src/win32dynamicdialog.cpp
win32/src/win32gui.i
""".split(),
windows_h_version=0x0500,
libraries="gdi32 user32 comdlg32 comctl32 shell32",
define_macros=[("WIN32GUI", None)],
),
Expand All @@ -1256,7 +1220,6 @@ def finalize_options(self):
"_winxptheme",
sources=["win32/src/_winxptheme.i"],
libraries="gdi32 user32 comdlg32 comctl32 shell32 Uxtheme",
windows_h_version=0x0500,
),
]
win32_extensions += [
Expand All @@ -1265,7 +1228,6 @@ def finalize_options(self):
sources=["win32/src/PythonServiceMessages.mc", "win32/src/PythonService.cpp"],
extra_compile_args=["-DPYSERVICE_BUILD_DLL"],
libraries="user32 ole32 advapi32 shell32",
windows_h_version=0x500,
),
]

Expand All @@ -1274,7 +1236,6 @@ def finalize_options(self):
"win32help",
sources=["win32/src/win32helpmodule.cpp"],
libraries="htmlhelp user32 advapi32",
windows_h_version=0x500,
),
]

Expand Down Expand Up @@ -1374,7 +1335,6 @@ def finalize_options(self):
export_symbol_file="com/win32com/src/PythonCOM.def",
extra_compile_args=["-DBUILD_PYTHONCOM"],
pch_header="stdafx.h",
windows_h_version=0x500,
base_address=dll_base_address,
)
dll_base_address += 0x80000 # pythoncom is large!
Expand Down Expand Up @@ -1566,7 +1526,6 @@ def finalize_options(self):
"shell",
libraries="shell32",
pch_header="shell_pch.h",
windows_h_version=0x600,
sources=(
"""
{shell}/PyIActiveDesktop.cpp
Expand Down Expand Up @@ -1875,7 +1834,6 @@ def finalize_options(self):
"Pythonwin/win32uioledoc.h",
],
pch_header="stdafxole.h",
windows_h_version=0x500,
optional_headers=["afxres.h"],
),
WinExt_pythonwin(
Expand Down

0 comments on commit a586c34

Please sign in to comment.