mirror of https://github.com/astral-sh/uv
Fix non-optional uv-pep440 features (#8693)
This commit is contained in:
parent
2b0e16cb75
commit
4bf01ed337
|
|
@ -6,6 +6,7 @@ use crate::{
|
|||
version, Operator, OperatorParseError, Version, VersionPattern, VersionPatternParseError,
|
||||
};
|
||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||
#[cfg(feature = "tracing")]
|
||||
use tracing::warn;
|
||||
|
||||
/// Sorted version specifiers, such as `>=2.1,<3`.
|
||||
|
|
@ -23,19 +24,12 @@ use tracing::warn;
|
|||
/// // VersionSpecifiers derefs into a list of specifiers
|
||||
/// assert_eq!(version_specifiers.iter().position(|specifier| *specifier.operator() == Operator::LessThan), Some(1));
|
||||
/// ```
|
||||
#[derive(
|
||||
Eq,
|
||||
PartialEq,
|
||||
Ord,
|
||||
PartialOrd,
|
||||
Debug,
|
||||
Clone,
|
||||
Hash,
|
||||
rkyv::Archive,
|
||||
rkyv::Deserialize,
|
||||
rkyv::Serialize,
|
||||
#[derive(Eq, PartialEq, Ord, PartialOrd, Debug, Clone, Hash)]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv",
|
||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
||||
)]
|
||||
#[rkyv(derive(Debug))]
|
||||
#[cfg_attr(feature = "rkyv", rkyv(derive(Debug)))]
|
||||
pub struct VersionSpecifiers(Vec<VersionSpecifier>);
|
||||
|
||||
impl std::ops::Deref for VersionSpecifiers {
|
||||
|
|
@ -97,6 +91,7 @@ impl VersionSpecifiers {
|
|||
specifiers.push(VersionSpecifier::not_equals_star_version(prev.clone()));
|
||||
}
|
||||
_ => {
|
||||
#[cfg(feature = "tracing")]
|
||||
warn!("Ignoring unsupported gap in `requires-python` version: {next:?} -> {lower:?}");
|
||||
}
|
||||
}
|
||||
|
|
@ -239,19 +234,12 @@ impl std::error::Error for VersionSpecifiersParseError {}
|
|||
/// let version_specifier = VersionSpecifier::from_str("== 1.*").unwrap();
|
||||
/// assert!(version_specifier.contains(&version));
|
||||
/// ```
|
||||
#[derive(
|
||||
Eq,
|
||||
Ord,
|
||||
PartialEq,
|
||||
PartialOrd,
|
||||
Debug,
|
||||
Clone,
|
||||
Hash,
|
||||
rkyv::Archive,
|
||||
rkyv::Deserialize,
|
||||
rkyv::Serialize,
|
||||
#[derive(Eq, Ord, PartialEq, PartialOrd, Debug, Clone, Hash)]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv",
|
||||
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
|
||||
)]
|
||||
#[rkyv(derive(Debug))]
|
||||
#[cfg_attr(feature = "rkyv", rkyv(derive(Debug)))]
|
||||
pub struct VersionSpecifier {
|
||||
/// ~=|==|!=|<=|>=|<|>|===, plus whether the version ended with a star
|
||||
pub(crate) operator: Operator,
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ regex = { workspace = true }
|
|||
rustc-hash = { workspace = true }
|
||||
schemars = { workspace = true, optional = true }
|
||||
serde = { workspace = true, features = ["derive", "rc"] }
|
||||
serde_json = { workspace = true, optional = true }
|
||||
smallvec = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tracing = { workspace = true, optional = true }
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ pub use origin::RequirementOrigin;
|
|||
#[cfg(feature = "non-pep508-extensions")]
|
||||
pub use unnamed::{UnnamedRequirement, UnnamedRequirementUrl};
|
||||
pub use uv_normalize::{ExtraName, InvalidNameError, PackageName};
|
||||
/// Version and version specifiers used in requirements (reexport).
|
||||
// https://github.com/konstin/pep508_rs/issues/19
|
||||
pub use uv_pep440;
|
||||
use uv_pep440::{Version, VersionSpecifier, VersionSpecifiers};
|
||||
pub use verbatim_url::{
|
||||
expand_env_vars, split_scheme, strip_host, Scheme, VerbatimUrl, VerbatimUrlError,
|
||||
|
|
|
|||
Loading…
Reference in New Issue