-
-
Notifications
You must be signed in to change notification settings - Fork 133
Unable to match version range with pre-releases #323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm having a similar issue, I have a version req that is |
@gabrik fn version_matches(version: &semver::Version, req: &semver::VersionReq) -> bool {
if req.matches(version) {
return true;
}
// This custom matching logic is needed, because semver cannot compare different version with pre-release tags
let mut version_without_pre = version.clone();
version_without_pre.pre = "".parse().unwrap();
for comp in &req.comparators {
if comp.matches(version) {
continue;
}
// If major & minor & patch are the same, this means there is a mismatch on the pre-release tag
if comp.major == version.major
&& comp.minor.is_some_and(|m| m == version.minor)
&& comp.patch.is_some_and(|p| p == version.patch)
{
return false;
}
// Otherwise, compare without pre-release tags
let mut comp_without_pre = comp.clone();
comp_without_pre.pre = "".parse().unwrap();
if !comp_without_pre.matches(&version_without_pre) {
return false;
}
}
true
} |
I see, I think I'm going to do the same thing, thank you @Wiezzel |
The current version range does not match leptos 0.8 as expected. See the following rust playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=0860f13e900c27879e533ccb643750da Unfortunately, `semver` does not support pre-release versions (dtolnay/semver#323), so the updated range in this PR still won't work for leptos 0.8.0-alpha.
There is another version range does not seems to work: |
I am trying to match all versions >=1.0.0 and <2.0.0, including pre-release versions. Unfortunately,
>=1.0.0-rc, <2.0.0-rc1
doesn't do the trick, as pre-releases only match if some comparator has exactly the same major, minor or patch. Is it even possible to specify this kind of dependency?The text was updated successfully, but these errors were encountered: