mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-02 04:48:18 +00:00
Accept setup.py and setup.cfg files in compile (#2634)
## Summary This costs us ~nothing now that we support using PEP 517 hooks for `pyproject.toml`. ## Test Plan `cargo test`
This commit is contained in:
parent
71428f7d74
commit
ae35a215c6
5 changed files with 154 additions and 13 deletions
|
|
@ -510,6 +510,108 @@ setup(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Compile a `setup.cfg` file.
|
||||
#[test]
|
||||
fn compile_setup_cfg() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
|
||||
let setup_cfg = context.temp_dir.child("setup.cfg");
|
||||
setup_cfg.write_str(
|
||||
r#"[options]
|
||||
packages = find:
|
||||
install_requires=
|
||||
anyio
|
||||
|
||||
[options.extras_require]
|
||||
dev =
|
||||
iniconfig; python_version >= "3.7"
|
||||
mypy; python_version <= "3.8"
|
||||
"#,
|
||||
)?;
|
||||
|
||||
let setup_py = context.temp_dir.child("setup.py");
|
||||
setup_py.write_str(
|
||||
r#"# setup.py
|
||||
from setuptools import setup
|
||||
|
||||
|
||||
setup(
|
||||
name="dummypkg",
|
||||
description="A dummy package",
|
||||
)
|
||||
"#,
|
||||
)?;
|
||||
|
||||
uv_snapshot!(context.compile()
|
||||
.arg("setup.cfg")
|
||||
.arg("--extra")
|
||||
.arg("dev"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2024-03-25T00:00:00Z setup.cfg --extra dev
|
||||
anyio==4.3.0
|
||||
idna==3.6
|
||||
# via anyio
|
||||
iniconfig==2.0.0
|
||||
sniffio==1.3.1
|
||||
# via anyio
|
||||
|
||||
----- stderr -----
|
||||
Resolved 4 packages in [TIME]
|
||||
"###
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Compile a `setup.py` file.
|
||||
#[test]
|
||||
fn compile_setup_py() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
|
||||
let setup_py = context.temp_dir.child("setup.py");
|
||||
setup_py.write_str(
|
||||
r#"# setup.py
|
||||
from setuptools import setup
|
||||
|
||||
|
||||
setup(
|
||||
name="dummypkg",
|
||||
description="A dummy package",
|
||||
install_requires=["anyio"],
|
||||
extras_require={
|
||||
"dev": ["iniconfig; python_version >= '3.7'", "mypy; python_version <= '3.8'"],
|
||||
},
|
||||
)
|
||||
"#,
|
||||
)?;
|
||||
|
||||
uv_snapshot!(context.compile()
|
||||
.arg("setup.py")
|
||||
.arg("--extra")
|
||||
.arg("dev"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2024-03-25T00:00:00Z setup.py --extra dev
|
||||
anyio==4.3.0
|
||||
idna==3.6
|
||||
# via anyio
|
||||
iniconfig==2.0.0
|
||||
sniffio==1.3.1
|
||||
# via anyio
|
||||
|
||||
----- stderr -----
|
||||
Resolved 4 packages in [TIME]
|
||||
"###
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Request multiple extras that do not exist as a dependency group in a `pyproject.toml` file.
|
||||
#[test]
|
||||
fn compile_pyproject_toml_extras_missing() -> Result<()> {
|
||||
|
|
@ -564,7 +666,7 @@ fn compile_requirements_file_extra() -> Result<()> {
|
|||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
error: Requesting extras requires a pyproject.toml input file.
|
||||
error: Requesting extras requires a `pyproject.toml`, `setup.cfg`, or `setup.py` file.
|
||||
"###
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue