mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-17 22:07:47 +00:00
Revert "Show a dedicated hint for setuptools
dash-separator change" (#12453)
Reverts astral-sh/uv#12438
This commit is contained in:
parent
20e7dcd366
commit
ddbf90c906
2 changed files with 0 additions and 86 deletions
|
@ -54,12 +54,6 @@ static TORCH_NOT_FOUND_RE: LazyLock<Regex> =
|
||||||
static DISTUTILS_NOT_FOUND_RE: LazyLock<Regex> =
|
static DISTUTILS_NOT_FOUND_RE: LazyLock<Regex> =
|
||||||
LazyLock::new(|| Regex::new(r"ModuleNotFoundError: No module named 'distutils'").unwrap());
|
LazyLock::new(|| Regex::new(r"ModuleNotFoundError: No module named 'distutils'").unwrap());
|
||||||
|
|
||||||
/// e.g. `setuptools.errors.InvalidConfigError: Invalid dash-separated key`
|
|
||||||
static SETUPTOOLS_SETUP_CFG_KEY_RE: LazyLock<Regex> = LazyLock::new(|| {
|
|
||||||
Regex::new(r"setuptools.errors.InvalidConfigError: Invalid (dash-separated|uppercase) key")
|
|
||||||
.unwrap()
|
|
||||||
});
|
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
|
@ -124,7 +118,6 @@ enum MissingLibrary {
|
||||||
Linker(String),
|
Linker(String),
|
||||||
BuildDependency(String),
|
BuildDependency(String),
|
||||||
DeprecatedModule(String, Version),
|
DeprecatedModule(String, Version),
|
||||||
NonNormalizedSetupCfgKey,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
|
@ -138,12 +131,6 @@ pub struct MissingHeaderCause {
|
||||||
impl Display for MissingHeaderCause {
|
impl Display for MissingHeaderCause {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
match &self.missing_library {
|
match &self.missing_library {
|
||||||
MissingLibrary::NonNormalizedSetupCfgKey => {
|
|
||||||
write!(
|
|
||||||
f,
|
|
||||||
"setuptools removed support for dash-separated and uppercased keys in v78.0.0. Consider updating the relevant `setup.cfg`, or use `tool.uv.build-constraint-dependencies` to pin `setuptools<78`:\n```toml\n[tool.uv]\nbuild-constraint-dependencies = [\"setuptools<78\"]\n```"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
MissingLibrary::Header(header) => {
|
MissingLibrary::Header(header) => {
|
||||||
if let (Some(package_name), Some(package_version)) =
|
if let (Some(package_name), Some(package_version)) =
|
||||||
(&self.package_name, &self.package_version)
|
(&self.package_name, &self.package_version)
|
||||||
|
@ -365,8 +352,6 @@ impl Error {
|
||||||
"distutils".to_string(),
|
"distutils".to_string(),
|
||||||
Version::new([3, 12]),
|
Version::new([3, 12]),
|
||||||
))
|
))
|
||||||
} else if SETUPTOOLS_SETUP_CFG_KEY_RE.is_match(line.trim()) {
|
|
||||||
Some(MissingLibrary::NonNormalizedSetupCfgKey)
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
@ -10266,74 +10266,3 @@ fn change_layout_custom_directory() -> Result<()> {
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See: <https://github.com/astral-sh/uv/issues/12434>
|
|
||||||
#[test]
|
|
||||||
fn setuptools_non_normalized_setup_cfg() -> Result<()> {
|
|
||||||
let context = TestContext::new("3.12").with_exclude_newer("2025-03-24T20:00:00Z");
|
|
||||||
|
|
||||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
|
||||||
pyproject_toml.touch()?;
|
|
||||||
|
|
||||||
let setup_cfg = context.temp_dir.child("setup.cfg");
|
|
||||||
setup_cfg.write_str(indoc! {r"
|
|
||||||
[metadata]
|
|
||||||
name = foo
|
|
||||||
version = 0.1.0
|
|
||||||
requires-python = >=3.12
|
|
||||||
install_requires = iniconfig
|
|
||||||
"})?;
|
|
||||||
|
|
||||||
let filters = std::iter::once((r"exit code: 1", "exit status: 1"))
|
|
||||||
.chain(context.filters())
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
uv_snapshot!(filters, context.pip_install()
|
|
||||||
.arg("."), @r#"
|
|
||||||
success: false
|
|
||||||
exit_code: 1
|
|
||||||
----- stdout -----
|
|
||||||
|
|
||||||
----- stderr -----
|
|
||||||
× Failed to build `foo @ file://[TEMP_DIR]/`
|
|
||||||
├─▶ The build backend returned an error
|
|
||||||
╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)
|
|
||||||
|
|
||||||
[stderr]
|
|
||||||
Traceback (most recent call last):
|
|
||||||
File "<string>", line 14, in <module>
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/build_meta.py", line 334, in get_requires_for_build_wheel
|
|
||||||
return self._get_build_requires(config_settings, requirements=[])
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/build_meta.py", line 304, in _get_build_requires
|
|
||||||
self.run_setup()
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/build_meta.py", line 522, in run_setup
|
|
||||||
super().run_setup(setup_script=setup_script)
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/build_meta.py", line 320, in run_setup
|
|
||||||
exec(code, locals())
|
|
||||||
File "<string>", line 1, in <module>
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/__init__.py", line 116, in setup
|
|
||||||
_install_setup_requires(attrs)
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/__init__.py", line 87, in _install_setup_requires
|
|
||||||
dist.parse_config_files(ignore_option_errors=True)
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/_virtualenv.py", line 20, in parse_config_files
|
|
||||||
result = old_parse_config_files(self, *args, **kwargs)
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/dist.py", line 730, in parse_config_files
|
|
||||||
self._parse_config_files(filenames=inifiles)
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/dist.py", line 599, in _parse_config_files
|
|
||||||
opt = self._enforce_underscore(opt, section)
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/dist.py", line 629, in _enforce_underscore
|
|
||||||
raise InvalidConfigError(
|
|
||||||
setuptools.errors.InvalidConfigError: Invalid dash-separated key 'requires-python' in 'metadata' (setup.cfg), please use the underscore name 'requires_python' instead.
|
|
||||||
|
|
||||||
hint: setuptools removed support for dash-separated and uppercased keys in v78.0.0. Consider updating the relevant `setup.cfg`, or use `tool.uv.build-constraint-dependencies` to pin `setuptools<78`:
|
|
||||||
```toml
|
|
||||||
[tool.uv]
|
|
||||||
build-constraint-dependencies = ["setuptools<78"]
|
|
||||||
```
|
|
||||||
"#
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue