Repository navigation
Fix pythonw launcher mode for managed Windows venv links #19235
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
22d1cd7
Fix pythonw launcher mode for managed Windows venv links
nooscraft f6d480d
test: cover managed Windows launcher interpreter targets
zanieb 6fdb3b2
fix: target pythonw for windowed managed launchers
zanieb 18db869
refactor: use borrowed Python executables and explicit window modes
zanieb 992214e
Merge commit '338d632a3e504933896bad31b831d0a9ff2f2c86' into zb/revie…
zanieb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ use uv_fs::{CWD, Simplified, cachedir}; | |
| use uv_platform_tags::Os; | ||
| use uv_pypi_types::Scheme; | ||
| use uv_python::managed::{ | ||
| ManagedPythonInstallation, PythonMinorVersionLink, replace_link_to_executable, | ||
| LauncherTarget, ManagedPythonInstallation, PythonMinorVersionLink, replace_link_to_executable, | ||
| }; | ||
| use uv_python::{Interpreter, VirtualEnvironment}; | ||
| use uv_shell::escape_posix_for_single_quotes; | ||
|
|
@@ -298,25 +298,40 @@ pub(crate) fn create( | |
| if cfg!(windows) { | ||
| if using_minor_version_link { | ||
| let target = scripts.join(WindowsExecutable::Python.exe(interpreter)); | ||
| replace_link_to_executable(target.as_path(), &executable_target) | ||
| .map_err(Error::Python)?; | ||
| replace_link_to_executable( | ||
| target.as_path(), | ||
| &LauncherTarget::console(executable_target.clone()), | ||
| ) | ||
| .map_err(Error::Python)?; | ||
| let targetw = scripts.join(WindowsExecutable::Pythonw.exe(interpreter)); | ||
| replace_link_to_executable(targetw.as_path(), &executable_target) | ||
| .map_err(Error::Python)?; | ||
| replace_link_to_executable( | ||
| targetw.as_path(), | ||
| &LauncherTarget::windowed(executable_target.clone()), | ||
| ) | ||
| .map_err(Error::Python)?; | ||
| if interpreter.gil_disabled() { | ||
| let targett = scripts.join(WindowsExecutable::PythonMajorMinort.exe(interpreter)); | ||
| replace_link_to_executable(targett.as_path(), &executable_target) | ||
| .map_err(Error::Python)?; | ||
| replace_link_to_executable( | ||
| targett.as_path(), | ||
| &LauncherTarget::console(executable_target.clone()), | ||
| ) | ||
| .map_err(Error::Python)?; | ||
| let targetwt = scripts.join(WindowsExecutable::PythonwMajorMinort.exe(interpreter)); | ||
| replace_link_to_executable(targetwt.as_path(), &executable_target) | ||
| .map_err(Error::Python)?; | ||
| replace_link_to_executable( | ||
| targetwt.as_path(), | ||
| &LauncherTarget::windowed(executable_target.clone()), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
| ) | ||
| .map_err(Error::Python)?; | ||
| } | ||
| } else if matches!(interpreter.platform().os(), Os::Pyodide { .. }) { | ||
| // For Pyodide, link only `python.exe`. | ||
| // This should not be copied as `python.exe` is a wrapper that launches Pyodide. | ||
| let target = scripts.join(WindowsExecutable::Python.exe(interpreter)); | ||
| replace_link_to_executable(target.as_path(), &executable_target) | ||
| .map_err(Error::Python)?; | ||
| replace_link_to_executable( | ||
| target.as_path(), | ||
| &LauncherTarget::console(executable_target.clone()), | ||
| ) | ||
| .map_err(Error::Python)?; | ||
| } else { | ||
| // Always copy `python.exe`. | ||
| copy_launcher_windows( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
executable_targetis created (viaPythonMinorVersionLink::from_installation) withinstallation.executable(false)which means it's the base python interpreter and not pythonw. Won't using it here still lead to a console window being created?