mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-26 20:19:08 +00:00
Fixup for >=2.7,!=3.0.*,!=3.1.*,<3.4.*
(#683)
Found in https://pypi.org/simple/wincertstore/?format=application/vnd.pypi.simple.v1+json
This commit is contained in:
parent
f4f67ebde0
commit
7926749296
1 changed files with 18 additions and 5 deletions
|
@ -12,8 +12,9 @@ use puffin_warnings::warn_once;
|
||||||
static MISSING_COMMA: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\d)([<>=~^!])").unwrap());
|
static MISSING_COMMA: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\d)([<>=~^!])").unwrap());
|
||||||
/// Ex) `!=~5.0`
|
/// Ex) `!=~5.0`
|
||||||
static NOT_EQUAL_TILDE: Lazy<Regex> = Lazy::new(|| Regex::new(r"!=~((?:\d\.)*\d)").unwrap());
|
static NOT_EQUAL_TILDE: Lazy<Regex> = Lazy::new(|| Regex::new(r"!=~((?:\d\.)*\d)").unwrap());
|
||||||
/// Ex) `>=1.9.*`
|
/// Ex) `>=1.9.*`, `<3.4.*`
|
||||||
static GREATER_THAN_STAR: Lazy<Regex> = Lazy::new(|| Regex::new(r">=(\d+\.\d+)\.\*").unwrap());
|
static INVALID_TRAILING_DOT_STAR: Lazy<Regex> =
|
||||||
|
Lazy::new(|| Regex::new(r"(<=|>=|<|>)(\d+\.\d+)\.\*").unwrap());
|
||||||
/// Ex) `!=3.0*`
|
/// Ex) `!=3.0*`
|
||||||
static MISSING_DOT: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\d\.\d)+\*").unwrap());
|
static MISSING_DOT: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\d\.\d)+\*").unwrap());
|
||||||
/// Ex) `>=3.6,`
|
/// Ex) `>=3.6,`
|
||||||
|
@ -35,9 +36,9 @@ static FIXUPS: &[(&Lazy<Regex>, &str, &str)] = &[
|
||||||
),
|
),
|
||||||
// Given `>=1.9.*`, rewrite to `>=1.9`.
|
// Given `>=1.9.*`, rewrite to `>=1.9`.
|
||||||
(
|
(
|
||||||
&GREATER_THAN_STAR,
|
&INVALID_TRAILING_DOT_STAR,
|
||||||
r">=${1}",
|
r"${1}${2}",
|
||||||
"removing star after greater equal",
|
"removing star after comparison operator other than equal and not equal",
|
||||||
),
|
),
|
||||||
// Given `!=3.0*`, rewrite to `!=3.0.*`.
|
// Given `!=3.0*`, rewrite to `!=3.0.*`.
|
||||||
(&MISSING_DOT, r"${1}.*", "inserting missing dot"),
|
(&MISSING_DOT, r"${1}.*", "inserting missing dot"),
|
||||||
|
@ -270,4 +271,16 @@ mod tests {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(actual, expected);
|
assert_eq!(actual, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <https://pypi.org/simple/wincertstore/?format=application/vnd.pypi.simple.v1+json>
|
||||||
|
#[test]
|
||||||
|
fn smaller_than_star() {
|
||||||
|
let actual: VersionSpecifiers =
|
||||||
|
LenientVersionSpecifiers::from_str(">=2.7,!=3.0.*,!=3.1.*,<3.4.*")
|
||||||
|
.unwrap()
|
||||||
|
.into();
|
||||||
|
let expected: VersionSpecifiers =
|
||||||
|
VersionSpecifiers::from_str(">=2.7,!=3.0.*,!=3.1.*,<3.4").unwrap();
|
||||||
|
assert_eq!(actual, expected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue