Revert "fix python versioning to be semver compliant"

This reverts commit de100bafd4.
This commit is contained in:
evanboyle 2020-03-19 17:00:23 -07:00
parent fcc63aaf76
commit 269cef2142
2 changed files with 9 additions and 10 deletions

View file

@ -56,21 +56,21 @@ func PyPiVersionFromNpmVersion(s string) (string, error) {
return b.String(), nil
case rcVersionRegex.MatchString(s):
capMap := captureToMap(rcVersionRegex, s)
mustFprintf(&b, "%s.rc%s", capMap["version"], capMap["rcN"])
mustFprintf(&b, "%src%s", capMap["version"], capMap["rcN"])
if capMap["dirty"] != "" {
mustFprintf(&b, "+dirty")
}
return b.String(), nil
case betaVersionRegex.MatchString(s):
capMap := captureToMap(betaVersionRegex, s)
mustFprintf(&b, "%s.b%s", capMap["version"], capMap["betaN"])
mustFprintf(&b, "%sb%s", capMap["version"], capMap["betaN"])
if capMap["dirty"] != "" {
mustFprintf(&b, "+dirty")
}
return b.String(), nil
case alphaVersionRegex.MatchString(s):
capMap := captureToMap(alphaVersionRegex, s)
mustFprintf(&b, "%s.a%s", capMap["version"], capMap["time"])
mustFprintf(&b, "%sa%s", capMap["version"], capMap["time"])
if capMap["dirty"] != "" {
mustFprintf(&b, "+dirty")
}

View file

@ -22,13 +22,12 @@ import (
func TestVersions(t *testing.T) {
cases := map[string]string{
"v0.12.0": "0.12.0",
"v0.12.0+dirty": "0.12.0+dirty",
"v0.12.0-rc.1": "0.12.0.rc1",
"v0.12.0-rc.1+dirty": "0.12.0.rc1+dirty",
"v0.12.1-dev.1524606809+gf2f1178b": "0.12.1.dev1524606809",
"v0.12.1-dev.1524606809+gf2f1178b.dirty": "0.12.1.dev1524606809+dirty",
"v1.14.0-alpha.1584648098+gce192898.dirty": "1.14.0.a1584648098+dirty",
"v0.12.0": "0.12.0",
"v0.12.0+dirty": "0.12.0+dirty",
"v0.12.0-rc.1": "0.12.0rc1",
"v0.12.0-rc.1+dirty": "0.12.0rc1+dirty",
"v0.12.1-dev.1524606809+gf2f1178b": "0.12.1.dev1524606809",
"v0.12.1-dev.1524606809+gf2f1178b.dirty": "0.12.1.dev1524606809+dirty",
}
for ver, expected := range cases {