https://github.com/python/cpython/commit/671b740f45bf606208d89300b63b1d206c6a6e4a
commit: 671b740f45bf606208d89300b63b1d206c6a6e4a
branch: 3.13
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: zooba <steve.do...@microsoft.com>
date: 2024-06-03T15:06:53Z
summary:

gh-119679: Ensures correct import libraries are included in Windows install 
packages (GH-119790)

(cherry picked from commit fd01271366abefa8f991e53f090387882fbd6bdd)

Co-authored-by: Steve Dower <steve.do...@python.org>

files:
A Misc/NEWS.d/next/Windows/2024-05-30-17-39-25.gh-issue-119679.mZC87w.rst
M PC/layout/main.py
M Tools/msi/freethreaded/freethreaded_files.wxs

diff --git 
a/Misc/NEWS.d/next/Windows/2024-05-30-17-39-25.gh-issue-119679.mZC87w.rst 
b/Misc/NEWS.d/next/Windows/2024-05-30-17-39-25.gh-issue-119679.mZC87w.rst
new file mode 100644
index 00000000000000..db9e798d3ddcb8
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2024-05-30-17-39-25.gh-issue-119679.mZC87w.rst
@@ -0,0 +1 @@
+Ensures correct import libraries are included in Windows installs.
diff --git a/PC/layout/main.py b/PC/layout/main.py
index 1c4842f8588a5b..716f01097fe3b0 100644
--- a/PC/layout/main.py
+++ b/PC/layout/main.py
@@ -121,7 +121,7 @@ def get_tcltk_lib(ns):
 
 
 def get_layout(ns):
-    def in_build(f, dest="", new_name=None):
+    def in_build(f, dest="", new_name=None, no_lib=False):
         n, _, x = f.rpartition(".")
         n = new_name or n
         src = ns.build / f
@@ -136,7 +136,7 @@ def in_build(f, dest="", new_name=None):
             pdb = src.with_suffix(".pdb")
             if pdb.is_file():
                 yield dest + n + ".pdb", pdb
-        if ns.include_dev:
+        if ns.include_dev and not no_lib:
             lib = src.with_suffix(".lib")
             if lib.is_file():
                 yield "libs/" + n + ".lib", lib
@@ -202,7 +202,9 @@ def in_build(f, dest="", new_name=None):
 
     yield "LICENSE.txt", ns.build / "LICENSE.txt"
 
-    for dest, src in rglob(ns.build, "*.pyd"):
+    dest="" if ns.flat_dlls else "DLLs/"
+
+    for _, src in rglob(ns.build, "*.pyd"):
         if ns.include_freethreaded:
             if not src.match("*.cp*t-win*.pyd"):
                 continue
@@ -217,14 +219,14 @@ def in_build(f, dest="", new_name=None):
             continue
         if src in TCLTK_PYDS_ONLY and not ns.include_tcltk:
             continue
-        yield from in_build(src.name, dest="" if ns.flat_dlls else "DLLs/")
+        yield from in_build(src.name, dest=dest, no_lib=True)
 
-    for dest, src in rglob(ns.build, "*.dll"):
+    for _, src in rglob(ns.build, "*.dll"):
         if src.stem.endswith("_d") != bool(ns.debug) and src not in 
REQUIRED_DLLS:
             continue
         if src in EXCLUDE_FROM_DLLS:
             continue
-        yield from in_build(src.name, dest="" if ns.flat_dlls else "DLLs/")
+        yield from in_build(src.name, no_lib=True)
 
     if ns.zip_lib:
         zip_name = PYTHON_ZIP_NAME
diff --git a/Tools/msi/freethreaded/freethreaded_files.wxs 
b/Tools/msi/freethreaded/freethreaded_files.wxs
index adaf63c69d5ade..49ecb3429ad8f3 100644
--- a/Tools/msi/freethreaded/freethreaded_files.wxs
+++ b/Tools/msi/freethreaded/freethreaded_files.wxs
@@ -48,6 +48,12 @@
             <Component Id="freethreaded_python.dll" 
Directory="InstallDirectory" Guid="*">
                 <File Id="freethreaded_python.dll" 
Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t.dll" 
KeyPath="yes" />
             </Component>
+            <Component Id="freethreaded_python_stable.lib" Directory="libs" 
Guid="*">
+                <File Id="freethreaded_python_stable.lib" 
Name="python$(var.MajorVersionNumber)t.lib" KeyPath="yes" />
+            </Component>
+            <Component Id="freethreaded_python.lib" Directory="libs" Guid="*">
+                <File Id="freethreaded_python.lib" 
Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t.lib" 
KeyPath="yes" />
+            </Component>
         </ComponentGroup>
     </Fragment>
     <Fragment>
@@ -69,8 +75,14 @@
                 <File Id="freethreaded_python_stable_d.dll" 
Name="python$(var.MajorVersionNumber)t_d.dll" KeyPath="yes" />
             </Component>
             <Component Id="freethreaded_python_d.dll" 
Directory="InstallDirectory" Guid="*">
-                <File Id="freethreaded_python_d.dll" 
Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)_d.dll" 
KeyPath="yes" />
-                <File Id="freethreaded_python_d.pdb" 
Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)_d.pdb" 
KeyPath="no" />
+                <File Id="freethreaded_python_d.dll" 
Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.dll" 
KeyPath="yes" />
+                <File Id="freethreaded_python_d.pdb" 
Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.pdb" 
KeyPath="no" />
+            </Component>
+            <Component Id="freethreaded_python_stable_d.lib" Directory="libs" 
Guid="*">
+                <File Id="freethreaded_python_stable_d.lib" 
Name="python$(var.MajorVersionNumber)t_d.lib" KeyPath="yes" />
+            </Component>
+            <Component Id="freethreaded_python_d.lib" Directory="libs" 
Guid="*">
+                <File Id="freethreaded_python_d.lib" 
Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.lib" 
KeyPath="yes" />
             </Component>
         </ComponentGroup>
     </Fragment>
@@ -147,12 +159,6 @@
             
             <?endforeach ?>
             
-            <Component Id="venvlauncher_d.exe" 
Directory="Lib_venv_scripts_nt__freethreaded" Guid="*">
-                <File Name="python_d.exe" Source="venvlauncher_d.exe" 
KeyPath="yes" />
-            </Component>
-            <Component Id="venvwlauncher_d.exe" 
Directory="Lib_venv_scripts_nt__freethreaded" Guid="*">
-                <File Name="pythonw_d.exe" Source="venvwlauncher_d.exe" 
KeyPath="yes" />
-            </Component>
             <Component Id="venvlaunchert_d.pdb" 
Directory="Lib_venv_scripts_nt__freethreaded" Guid="*">
                 <File Name="venvlaunchert_d.pdb" KeyPath="yes" />
             </Component>

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to