Repository navigation
Conversation
A bare Maven version such as "1.0" and an unbounded range such as "(,)"
were converted to a constraint on the version string "None", giving
"vers:maven/None". NuGet inherits this method and crashed instead.
Map a Maven soft requirement to the exact version and an unbounded
range to "*". Add a NuGet override: NuGet treats a bare version as a
minimum version (">=") and does not allow unbounded ranges.
Fixes aboutcode-org#221
Signed-off-by: lahari <laharir832@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #221
Problem
MavenVersionRange.from_native("1.0")andfrom_native("(,)")both returnvers:maven/None. For a bare version,maven.VersionRangekeeps the version in.versionand adds an emptyRestriction()with both boundsNone.from_native()ignored.version, andlower_bound == upper_boundwas true forNone == None, so it created a constraint on the version string"None".NugetVersionRangeinherits this method, soNugetVersionRange.from_native("1.0")crashed withInvalidNuGetVersion: version does not contain any digit: None.Changes
Maven (
MavenVersionRange.from_native)1.0→vers:maven/1.0. This is the version Maven picks when nothing else conflicts, and it matches how a bare version is handled for other schemes.*:(,)and[,]→vers:maven/*.NuGet (
NugetVersionRange.from_native, a new override)1.0→vers:nuget/>=1.0.0. Docs: https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#version-ranges(, )raisesInvalidVersionRange. The existingtest_InvalidRange[(, )]already expected an error, but before this change it passed only because of theNonecrash.Testing
tests/test_maven_version_range.py. All 4 fail onmainand pass with this change.mainand are unrelated:test_codestyle,test_semver_versionandtest_enhanced_semantic_version.If maintainers would rather map a Maven soft requirement to
*, I can change it. It is one line.