Script wrappers generated from Python debug executable do not point to the right executable
Describe the bug
When installing a package containing script wrappers from setuptools using a debug installation of Python on Windows, the script wrappers do not point to the right python_d.exe.
This is a follow-up from https://github.com/pypa/setuptools/issues/4418
To Reproduce
- Build Python in debug mode on Windows.
- Install a package containing scripts via
python_d.exe -m pip install XXX. Below is non-working package:
# setup.py
from setuptools import setup
setup(
name="package",
version="0.0.1",
entry_points={"console_scripts": ["test_python_debug_main = package.main:main"]},
)
# pyproject.toml
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
- Try to run the generated
test_python_debug_main.exe. - The exe will throw the following error (paths removed):
Fatal error in launcher: Unable to create process using '"python.exe" "Scripts\test_python_debug_main.exe" ': The system cannot find the file specified.
Expected behavior
The script wrappers should use the right executable, i.e., python_d.exe.
Environment
- Windows 11 Pro, 23H2, 22631.3672
- pip 24.0
Why this should be required behaviour?
Why this should be required behaviour?
Because otherwise the script wrappers do not work? What would be the alternative?
Currently it is simply impossible to install script wrappers via pip using a Python debug build, which I do not think is ideal.
This would also make the behavior consistent with setuptools since python setup.py install does generate wrappers using python_d.exe.
Because otherwise the script wrappers do not work
Well I understand that, but why is there a need to support scripts to be run under debug builds of Python? Obviously you can't ship such scripts. Can you give a more detailed explanation of the actual use case?
Because otherwise the script wrappers do not work
Well I understand that, but why is there a need to support scripts to be run under debug builds of Python? Obviously you can't ship such scripts. Can you give a more detailed explanation of the actual use case?
You cannot ship such scripts, but I do not see a reason not to be able to run such scripts. AFAIK, you cannot ship the scripts installed (through pip install) with a standard Python installation since it tries to use the absolute path from the executable (at least that was I guess from the error).
Aside from the required work to implement such feature, what would justify not having the scripts use python_d.exe instead of python.exe?
My actual use-case is to build PyQt using sip and related tools. Building those in debug mode requires a Python debug installation, and it makes use of scripts generated by the sip package (sip-install, sip-module, ...). These scripts work fine if installed through the old deprecated setuptools method (python setup.py install) but not through pip, hence the issue.
I consider this a niche use case, but I'm willing to review a PR around this which meets your requirement while using a simple approach.