-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Summary
Moved from #15569 (comment)
Description
On Windows, when running uv add uwsgi, the build process fails (which is expected as uwsgi cannot compile on Windows). However, when subsequently running uv cache clean, the command fails because the cached sdist contains a file with a Windows-incompatible name (ending with a period).
Steps to Reproduce
On Windows, create a new project and add uwsgi.
uv init
uv add uwsgiThe build fails as expected since uwsgi is not supported on Windows.
Then run:
uv cache cleanExpected Behavior
uv cache clean should remove cached source distributions (sdists).
Actual Behavior
Clearing cache at: AppData\Local\uv\cache
error: Failed to clear cache at: AppData\Local\uv\cache
Caused by: failed to remove file `C:\Users\root\AppData\Local\uv\cache\sdists-v9\index\3ba65c4f41aac3a1\uwsgi\2.0.31\l1w3t3Nrz8OnzxF6ri3eg\src\core\logging.`: The system cannot find the file specified. (os error 2)
Suggested Fix
Use logic similar to Python’s isreserved to detect and handle reserved or invalid Windows filenames before deletion.
When removing such files, use the extended \\?\ path prefix to bypass Win32 path normalization, which allows operations on paths exceeding MAX_PATH or containing characters normally restricted by the Win32 API (such as trailing dots or spaces).
Platform
Windows 11 24H2
Version
uv 0.9.7 (0adb444 2025-10-30)
Python version
Python 3.13.5