mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Add GraalPy support (#5141)
<!--
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
Currently, `uv` refuses to install anything on GraalPy. This is
currently blocking GraalPy testing with cibuildwheel, since manylinux
includes both `uv` and `graalpy` (but doesn't test with `uv`), whereas
cibuildwheel defaults to `uv`. See e.g.
2750618295
where it gives
```
+ python -m build /project/sample_proj --wheel --outdir=/tmp/cibuildwheel/built_wheel --installer=uv
* Creating isolated environment: venv+uv...
* Using external uv from /usr/local/bin/uv
* Installing packages in isolated environment:
- setuptools >= 40.8.0
> /usr/local/bin/uv pip install "setuptools >= 40.8.0"
< error: Unknown implementation: `graalpy`
```
## Test Plan
I simply based the GraalPy support on PyPy and added some small tests.
I'm open to discussing how to test this. GraalPy is available for
manylinux images and with setup-python, so we should be able to add
tests against it to the CI. I locally confirmed by installing `uv` into
a GraalPy venv and then trying things like `uv pip install Pillow` and
testing those extensions.
This commit is contained in:
parent
54bca18184
commit
24a0268675
6 changed files with 397 additions and 8 deletions
|
@ -178,6 +178,10 @@ pub(crate) fn create(
|
|||
)?;
|
||||
uv_fs::replace_symlink("python", scripts.join("pypy"))?;
|
||||
}
|
||||
|
||||
if interpreter.markers().implementation_name() == "graalpy" {
|
||||
uv_fs::replace_symlink("python", scripts.join("graalpy"))?;
|
||||
}
|
||||
}
|
||||
|
||||
// No symlinking on Windows, at least not on a regular non-dev non-admin Windows install.
|
||||
|
@ -189,13 +193,31 @@ pub(crate) fn create(
|
|||
&scripts,
|
||||
python_home,
|
||||
)?;
|
||||
copy_launcher_windows(
|
||||
WindowsExecutable::Pythonw,
|
||||
interpreter,
|
||||
&base_python,
|
||||
&scripts,
|
||||
python_home,
|
||||
)?;
|
||||
|
||||
if interpreter.markers().implementation_name() == "graalpy" {
|
||||
copy_launcher_windows(
|
||||
WindowsExecutable::GraalPy,
|
||||
interpreter,
|
||||
&base_python,
|
||||
&scripts,
|
||||
python_home,
|
||||
)?;
|
||||
copy_launcher_windows(
|
||||
WindowsExecutable::PythonMajor,
|
||||
interpreter,
|
||||
&base_python,
|
||||
&scripts,
|
||||
python_home,
|
||||
)?;
|
||||
} else {
|
||||
copy_launcher_windows(
|
||||
WindowsExecutable::Pythonw,
|
||||
interpreter,
|
||||
&base_python,
|
||||
&scripts,
|
||||
python_home,
|
||||
)?;
|
||||
}
|
||||
|
||||
if interpreter.markers().implementation_name() == "pypy" {
|
||||
copy_launcher_windows(
|
||||
|
@ -319,6 +341,16 @@ pub(crate) fn create(
|
|||
pyvenv_cfg_data.push(("prompt".to_string(), prompt));
|
||||
}
|
||||
|
||||
if cfg!(windows) && interpreter.markers().implementation_name() == "graalpy" {
|
||||
pyvenv_cfg_data.push((
|
||||
"venvlauncher_command".to_string(),
|
||||
python_home
|
||||
.join("graalpy.exe")
|
||||
.simplified_display()
|
||||
.to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
let mut pyvenv_cfg = BufWriter::new(File::create(location.join("pyvenv.cfg"))?);
|
||||
write_cfg(&mut pyvenv_cfg, &pyvenv_cfg_data)?;
|
||||
drop(pyvenv_cfg);
|
||||
|
@ -380,6 +412,8 @@ enum WindowsExecutable {
|
|||
PyPyw,
|
||||
/// The `pypy3.<minor>w.exe` executable.
|
||||
PyPyMajorMinorw,
|
||||
// The `graalpy.exe` executable
|
||||
GraalPy,
|
||||
}
|
||||
|
||||
impl WindowsExecutable {
|
||||
|
@ -417,6 +451,7 @@ impl WindowsExecutable {
|
|||
interpreter.python_minor()
|
||||
)
|
||||
}
|
||||
WindowsExecutable::GraalPy => String::from("graalpy.exe"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,6 +469,7 @@ impl WindowsExecutable {
|
|||
WindowsExecutable::PyPyMajorMinor => "venvlauncher.exe",
|
||||
WindowsExecutable::PyPyw => "venvwlauncher.exe",
|
||||
WindowsExecutable::PyPyMajorMinorw => "venvwlauncher.exe",
|
||||
WindowsExecutable::GraalPy => "venvlauncher.exe",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue