Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python WiX Build incorrect path to the wix-314 external / The imported project "C:\Wix.targets" was not found #118756

Open
SebTV opened this issue May 8, 2024 · 4 comments
Labels
build The build process and cross-build OS-windows type-bug An unexpected behavior, bug, or error

Comments

@SebTV
Copy link

SebTV commented May 8, 2024

Bug report

Bug description:

On Windows try to build Python+Installer using tools\msi\buildrelease.bat:
Use get_externals.batto offline-cache packages
Set EXTERNALS_DIR
start buildrelease.bat
Result
<...>Python-3.12.2\Tools\msi\launcher\launcher.wixproj" (default target) (1) -> <...>Python-3.12.2\Tools\msi\msi.targets(78,5): error MSB4019: The imported project "C:\Wix.targets" was not found. Confirm that the expression in the Import declaration "\Wix.targets" is correct, and that the file exists on disk. [<...>Python-3.12.2\Tools\msi\launcher\launcher.wixproj]

Note that get_externals.bat puts wix-314 into the root of EXTERNALS_DIR while Python-3.12.2/Tools/msi/wix.props expects a subdirectory windows-installer.

See the better workaround below. Deleting this patch as it goes into the wrong direction

CPython versions tested on:

3.12

Operating systems tested on:

Windows

@SebTV SebTV added the type-bug An unexpected behavior, bug, or error label May 8, 2024
@terryjreedy terryjreedy added OS-windows build The build process and cross-build labels May 8, 2024
@SebTV
Copy link
Author

SebTV commented May 8, 2024

Addition: The same applies to the redist-1 path in the same file.
My guess is that buildrelease.bat and wix.props (unlike get_externals.bat) do not check whether EXTERNALS_DIR is set and calculate different paths. All scripts should come to the same final results

@zooba
Copy link
Member

zooba commented May 8, 2024

get_externals.bat in Tools/msi should add the windows-installer directory to the path regardless of where it came from.

@SebTV
Copy link
Author

SebTV commented May 10, 2024

Then this is the correct fix when EXTERNAL_DIRS is in use

--- Python-3.12.2/Tools/msi/get_externals.bat.org	2024-05-10 21:32:11.211387400 +0200
+++ Python-3.12.2/Tools/msi/get_externals.bat	2024-05-10 21:34:43.038714100 +0200
@@ -4,7 +4,11 @@
 
 set HERE=%~dp0
 if "%PCBUILD%"=="" (set PCBUILD=%HERE%..\..\PCbuild\)
-if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%HERE%..\..\externals\windows-installer)
+if "%EXTERNALS_DIR%"=="" (
+  set EXTERNALS_DIR=%HERE%..\..\externals\windows-installer
+) else (
+  set EXTERNALS_DIR=%EXTERNALS_DIR%\windows-installer
+)
 if "%NUGET%"=="" (set NUGET=%EXTERNALS_DIR%\..\nuget.exe)
 if "%NUGET_URL%"=="" (set NUGET_URL=https://aka.ms/nugetclidl)

It should also be noted that EXTERNALS_DIR cannot be a UNC Path. light.exe cannot load WixUtilExtension.dll from an UNC Path.

light.exe : error LGHT0001 : The system cannot find the file specified. (Exception from HRESULT: 0x80070002)

Exception Type: System.IO.FileNotFoundException

for the pip.wixproj

@SebTV SebTV closed this as completed May 10, 2024
@zooba zooba reopened this May 13, 2024
@zooba
Copy link
Member

zooba commented May 13, 2024

Correct, that's the fix, and we can make it in our repository, so the issue can stay open until someone makes a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build OS-windows type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants