mirror of
https://github.com/google/go-jsonnet.git
synced 2025-09-28 17:01:02 +02:00
Implemented python gojsonnet get_version
This commit is contained in:
parent
741eec05fe
commit
d8f0505fc9
13
setup.py
13
setup.py
@ -23,8 +23,17 @@ LIB_DIR = DIR + '/c-bindings'
|
||||
MODULE_SOURCES = ['cpp-jsonnet/python/_jsonnet.c']
|
||||
|
||||
def get_version():
|
||||
# TODO think about it (how to get the version)
|
||||
return '0.14.0'
|
||||
"""
|
||||
Parses the version out of libjsonnet.h
|
||||
"""
|
||||
with open(os.path.join(DIR, 'vm.go')) as f:
|
||||
for line in f:
|
||||
if 'const' in line and 'version' in line:
|
||||
v_code = line.partition('=')[2].strip('\n "')
|
||||
if v_code[0] == 'v':
|
||||
return v_code[1:]
|
||||
|
||||
return None
|
||||
|
||||
class BuildJsonnetExt(BuildExt):
|
||||
def run(self):
|
||||
|
5
vm.go
5
vm.go
@ -124,6 +124,9 @@ const (
|
||||
evalKindStream = iota
|
||||
)
|
||||
|
||||
// version is the current gojsonnet's version
|
||||
const version = "v0.14.0"
|
||||
|
||||
// Evaluate evaluates a Jsonnet program given by an Abstract Syntax Tree
|
||||
// and returns serialized JSON as string.
|
||||
// TODO(sbarzowski) perhaps is should return JSON in standard Go representation
|
||||
@ -253,5 +256,5 @@ func SnippetToAST(filename string, snippet string) (ast.Node, error) {
|
||||
|
||||
// Version returns the Jsonnet version number.
|
||||
func Version() string {
|
||||
return "v0.14.0"
|
||||
return version
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user