mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-31 15:57:26 +00:00
uv-python: use windows-sys instead of winapi (#5591)
<!-- 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 use windows-sys bindings maintained by microsoft devs. winapi didn't has any updates for more than 3 years ## Test Plan cargo test. it failed locally because I don't have Python 3.12 installed
This commit is contained in:
parent
c0d3da8b6a
commit
228a803fde
4 changed files with 11 additions and 10 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4958,7 +4958,7 @@ dependencies = [
|
|||
"uv-state",
|
||||
"uv-warnings",
|
||||
"which",
|
||||
"winapi",
|
||||
"windows-sys 0.52.0",
|
||||
"winsafe",
|
||||
]
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ url = { version = "2.5.0" }
|
|||
urlencoding = { version = "2.1.3" }
|
||||
walkdir = { version = "2.5.0" }
|
||||
which = { version = "6.0.0", features = ["regex"] }
|
||||
winapi = { version = "0.3.9", features = ["fileapi", "handleapi", "ioapiset", "winbase", "winioctl", "winnt"] }
|
||||
windows-sys = { version = "0.52.0", features = ["Win32_Foundation", "Win32_Security", "Win32_Storage_FileSystem", "Win32_System_Ioctl", "Win32_System_IO"] }
|
||||
winreg = { version = "0.52.0" }
|
||||
winsafe = { version = "0.0.19", features = ["kernel"] }
|
||||
wiremock = { version = "0.6.0" }
|
||||
|
|
|
@ -55,7 +55,7 @@ which = { workspace = true }
|
|||
rustix = { workspace = true }
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
winapi = { workspace = true }
|
||||
windows-sys = { workspace = true }
|
||||
winsafe = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -923,12 +923,13 @@ fn warn_on_unsupported_python(interpreter: &Interpreter) {
|
|||
pub(crate) fn is_windows_store_shim(path: &Path) -> bool {
|
||||
use std::os::windows::fs::MetadataExt;
|
||||
use std::os::windows::prelude::OsStrExt;
|
||||
use winapi::um::fileapi::{CreateFileW, OPEN_EXISTING};
|
||||
use winapi::um::handleapi::{CloseHandle, INVALID_HANDLE_VALUE};
|
||||
use winapi::um::ioapiset::DeviceIoControl;
|
||||
use winapi::um::winbase::{FILE_FLAG_BACKUP_SEMANTICS, FILE_FLAG_OPEN_REPARSE_POINT};
|
||||
use winapi::um::winioctl::FSCTL_GET_REPARSE_POINT;
|
||||
use winapi::um::winnt::{FILE_ATTRIBUTE_REPARSE_POINT, MAXIMUM_REPARSE_DATA_BUFFER_SIZE};
|
||||
use windows_sys::Win32::Foundation::{CloseHandle, INVALID_HANDLE_VALUE};
|
||||
use windows_sys::Win32::Storage::FileSystem::{
|
||||
CreateFileW, FILE_ATTRIBUTE_REPARSE_POINT, FILE_FLAG_BACKUP_SEMANTICS,
|
||||
FILE_FLAG_OPEN_REPARSE_POINT, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, OPEN_EXISTING,
|
||||
};
|
||||
use windows_sys::Win32::System::Ioctl::FSCTL_GET_REPARSE_POINT;
|
||||
use windows_sys::Win32::System::IO::DeviceIoControl;
|
||||
|
||||
// The path must be absolute.
|
||||
if !path.is_absolute() {
|
||||
|
@ -988,7 +989,7 @@ pub(crate) fn is_windows_store_shim(path: &Path) -> bool {
|
|||
std::ptr::null_mut(),
|
||||
OPEN_EXISTING,
|
||||
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
|
||||
std::ptr::null_mut(),
|
||||
0,
|
||||
)
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue