Skip to content

Commit 671b740

Browse files
gh-119679: Ensures correct import libraries are included in Windows install packages (GH-119790)
(cherry picked from commit fd01271) Co-authored-by: Steve Dower <steve.dower@python.org>
1 parent b26b410 commit 671b740

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensures correct import libraries are included in Windows installs.

PC/layout/main.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def get_tcltk_lib(ns):
121121

122122

123123
def get_layout(ns):
124-
def in_build(f, dest="", new_name=None):
124+
def in_build(f, dest="", new_name=None, no_lib=False):
125125
n, _, x = f.rpartition(".")
126126
n = new_name or n
127127
src = ns.build / f
@@ -136,7 +136,7 @@ def in_build(f, dest="", new_name=None):
136136
pdb = src.with_suffix(".pdb")
137137
if pdb.is_file():
138138
yield dest + n + ".pdb", pdb
139-
if ns.include_dev:
139+
if ns.include_dev and not no_lib:
140140
lib = src.with_suffix(".lib")
141141
if lib.is_file():
142142
yield "libs/" + n + ".lib", lib
@@ -202,7 +202,9 @@ def in_build(f, dest="", new_name=None):
202202

203203
yield "LICENSE.txt", ns.build / "LICENSE.txt"
204204

205-
for dest, src in rglob(ns.build, "*.pyd"):
205+
dest="" if ns.flat_dlls else "DLLs/"
206+
207+
for _, src in rglob(ns.build, "*.pyd"):
206208
if ns.include_freethreaded:
207209
if not src.match("*.cp*t-win*.pyd"):
208210
continue
@@ -217,14 +219,14 @@ def in_build(f, dest="", new_name=None):
217219
continue
218220
if src in TCLTK_PYDS_ONLY and not ns.include_tcltk:
219221
continue
220-
yield from in_build(src.name, dest="" if ns.flat_dlls else "DLLs/")
222+
yield from in_build(src.name, dest=dest, no_lib=True)
221223

222-
for dest, src in rglob(ns.build, "*.dll"):
224+
for _, src in rglob(ns.build, "*.dll"):
223225
if src.stem.endswith("_d") != bool(ns.debug) and src not in REQUIRED_DLLS:
224226
continue
225227
if src in EXCLUDE_FROM_DLLS:
226228
continue
227-
yield from in_build(src.name, dest="" if ns.flat_dlls else "DLLs/")
229+
yield from in_build(src.name, no_lib=True)
228230

229231
if ns.zip_lib:
230232
zip_name = PYTHON_ZIP_NAME

Tools/msi/freethreaded/freethreaded_files.wxs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
<Component Id="freethreaded_python.dll" Directory="InstallDirectory" Guid="*">
4949
<File Id="freethreaded_python.dll" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t.dll" KeyPath="yes" />
5050
</Component>
51+
<Component Id="freethreaded_python_stable.lib" Directory="libs" Guid="*">
52+
<File Id="freethreaded_python_stable.lib" Name="python$(var.MajorVersionNumber)t.lib" KeyPath="yes" />
53+
</Component>
54+
<Component Id="freethreaded_python.lib" Directory="libs" Guid="*">
55+
<File Id="freethreaded_python.lib" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t.lib" KeyPath="yes" />
56+
</Component>
5157
</ComponentGroup>
5258
</Fragment>
5359
<Fragment>
@@ -69,8 +75,14 @@
6975
<File Id="freethreaded_python_stable_d.dll" Name="python$(var.MajorVersionNumber)t_d.dll" KeyPath="yes" />
7076
</Component>
7177
<Component Id="freethreaded_python_d.dll" Directory="InstallDirectory" Guid="*">
72-
<File Id="freethreaded_python_d.dll" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)_d.dll" KeyPath="yes" />
73-
<File Id="freethreaded_python_d.pdb" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)_d.pdb" KeyPath="no" />
78+
<File Id="freethreaded_python_d.dll" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.dll" KeyPath="yes" />
79+
<File Id="freethreaded_python_d.pdb" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.pdb" KeyPath="no" />
80+
</Component>
81+
<Component Id="freethreaded_python_stable_d.lib" Directory="libs" Guid="*">
82+
<File Id="freethreaded_python_stable_d.lib" Name="python$(var.MajorVersionNumber)t_d.lib" KeyPath="yes" />
83+
</Component>
84+
<Component Id="freethreaded_python_d.lib" Directory="libs" Guid="*">
85+
<File Id="freethreaded_python_d.lib" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.lib" KeyPath="yes" />
7486
</Component>
7587
</ComponentGroup>
7688
</Fragment>
@@ -147,12 +159,6 @@
147159

148160
<?endforeach ?>
149161

150-
<Component Id="venvlauncher_d.exe" Directory="Lib_venv_scripts_nt__freethreaded" Guid="*">
151-
<File Name="python_d.exe" Source="venvlauncher_d.exe" KeyPath="yes" />
152-
</Component>
153-
<Component Id="venvwlauncher_d.exe" Directory="Lib_venv_scripts_nt__freethreaded" Guid="*">
154-
<File Name="pythonw_d.exe" Source="venvwlauncher_d.exe" KeyPath="yes" />
155-
</Component>
156162
<Component Id="venvlaunchert_d.pdb" Directory="Lib_venv_scripts_nt__freethreaded" Guid="*">
157163
<File Name="venvlaunchert_d.pdb" KeyPath="yes" />
158164
</Component>

0 commit comments

Comments
 (0)