fix: Handle dotted package names in script path resolution (#15300)

<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

Fix WindowsRunnable::from_script_path to correctly append extensions
instead of replacing them when resolving executable paths. This resolves
https://github.com/astral-sh/uv/issues/15165#issue-3304086689.

- Add add_extension_to_path helper that appends extensions properly
- Update extension resolution to use the new helper
- Add tests

## Test Plan

Added unit tests for the new and existing functionality that the change
touches. Tested manually locally on Windows.
<!-- How was it tested? -->

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
Chris Hughes 2025-08-15 22:44:59 +01:00 committed by GitHub
parent 191c9175fe
commit 9346b4d0f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 230 additions and 2 deletions

View file

@ -0,0 +1,6 @@
# package.name.with.dots
Test package for verifying Windows executable handling with dotted package names.
This package is used to test the fix for the uvx Windows executable bug where package names
containing dots were incorrectly handled when adding Windows executable extensions.

View file

@ -0,0 +1,11 @@
[project]
name = "package.name.with.dots"
version = "0.1.0"
requires-python = ">=3.8"
[tool.uv.build-backend.data]
scripts = "scripts"
[build-system]
requires = ["uv_build>=0.8.0,<0.9"]
build-backend = "uv_build"

View file

@ -0,0 +1,2 @@
Write-Host "package.name.with.dots version 0.1.0"
exit 0

View file

@ -0,0 +1,3 @@
"""Test package for verifying Windows executable handling with dotted package names."""
__version__ = "0.1.0"