pulumi/scripts/get-py-version.go
Matt Ellis 7b27f00602 Fix python package versions
Our logic for converting npm style versions to PEP-440 style versions
was not correct in some cases. This change fixes this.

As part of this change we no longer produce a NPM version that would
be just X.Y.Z-dev, instead for development versions we always include
both the timestamp of the commit and the commit hash.

Instead of trying to use a bunch of sed logic to do our conversions,
we now have a small go program that uses a newly added library in
pkg/util. A side effect of this is that we can more easily write tests
to ensure the conversion works as expected.

Fixes #1243
2018-05-07 12:38:08 -07:00

24 lines
363 B
Go

package main
import (
"fmt"
"os"
"github.com/pulumi/pulumi/pkg/util/buildutil"
)
func main() {
if len(os.Args) != 2 {
fmt.Fprintf(os.Stderr, "error: need exactly one argument\n")
os.Exit(-1)
}
p, err := buildutil.PyPiVersionFromNpmVersion(os.Args[1])
if err != nil {
fmt.Fprintf(os.Stderr, "error: %s\n", err)
os.Exit(-1)
}
fmt.Println(p)
}