Skip to content

ToVersString drops PyPI intervals when the range has no scheme #52

Description

@itsumida

vers.NewRange returns a Range with an empty Scheme. ToVersString(r, "pypi") then checks each interval for emptiness with the default semver comparison instead of the scheme it was given, so valid PyPI intervals are dropped.

a, _ := vers.Parse("vers:pypi/>=2016.11.0|<3003rc1")
fmt.Println(vers.ToVersString(vers.NewRange(a.Intervals), "pypi"))
// got:  vers:pypi/
// want: vers:pypi/>=2016.11.0|<3003rc1

>=0.5.0b3.dev13|<0.5.0b3.dev97 fails the same way. Parsing is correct: a.Contains("2019.2.0") is true and a.IsEmpty() is false. Setting Scheme: "pypi" on the range gives the right output.

This is seen in v0.7.0 and v0.7.1.

Suggested fix: ToVersString could use its scheme argument when r.Scheme is empty. Alternatively, NewRange could take a scheme.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions