Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions crates/uv/src/commands/project/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ pub(crate) enum RunCommand {
/// Search `sys.path` for the named module and execute its contents as the `__main__` module.
/// Equivalent to `python -m module`.
PythonModule(OsString, Vec<OsString>),
/// Execute a `pythonw` script (Windows only).
/// Execute a `pythonw` GUI script.
PythonGuiScript(PathBuf, Vec<OsString>),
/// Execute a Python package containing a `__main__.py` file.
PythonPackage(PathBuf, Vec<OsString>),
Expand Down Expand Up @@ -1201,7 +1201,13 @@ impl RunCommand {
| Self::PythonRemote(..)
| Self::Empty => Cow::Borrowed("python"),
Self::PythonModule(..) => Cow::Borrowed("python -m"),
Self::PythonGuiScript(..) => Cow::Borrowed("pythonw"),
Self::PythonGuiScript(..) => {
if cfg!(windows) {
Cow::Borrowed("pythonw")
} else {
Cow::Borrowed("python")
}
}
Self::PythonStdin(_) => Cow::Borrowed("python -c"),
Self::External(executable, _) => executable.to_string_lossy(),
}
Expand Down Expand Up @@ -1413,10 +1419,9 @@ impl RunCommand {
&& is_file
{
Ok(Self::PythonScript(target_path, args.to_vec()))
} else if cfg!(windows)
&& target_path
.extension()
.is_some_and(|ext| ext.eq_ignore_ascii_case("pyw"))
} else if target_path
.extension()
.is_some_and(|ext| ext.eq_ignore_ascii_case("pyw"))
&& is_file
{
Ok(Self::PythonGuiScript(target_path, args.to_vec()))
Expand Down
1 change: 0 additions & 1 deletion crates/uv/tests/it/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,6 @@ fn run_pep723_script_requires_python() -> Result<()> {

/// Run a `.pyw` script. The script should be executed with `pythonw.exe`.
#[test]
#[cfg(windows)]
fn run_pythonw_script() -> Result<()> {
let context = TestContext::new("3.12");

Expand Down