diff options
author | Goffert van Gool <ruphin@ruphin.net> | 2018-12-13 22:16:58 +0100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-12-13 16:16:58 -0500 |
commit | 40d6daf8240f9dc090c23f975488c424b88f120f (patch) | |
tree | 5b502de7a3d286861fb826f4242004a2e8218b25 /build_extra/rust/get_cargo_info.py | |
parent | 07369a6270473a2e4eb74d0c1936284d3b9558f3 (diff) |
Read version from Cargo.toml (#1267)
Diffstat (limited to 'build_extra/rust/get_cargo_info.py')
-rwxr-xr-x | build_extra/rust/get_cargo_info.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/build_extra/rust/get_cargo_info.py b/build_extra/rust/get_cargo_info.py new file mode 100755 index 000000000..43c964ab7 --- /dev/null +++ b/build_extra/rust/get_cargo_info.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# Copyright 2018 the Deno authors. All rights reserved. MIT license. + +import sys +import re + +# Read the package version from Cargo.toml and output as json +cargo_toml_path = sys.argv[1] + +for line in open(cargo_toml_path): + match = re.search('version = "(.*)"', line) + if match: + print('{"version": "' + match.group(1) + '"}') + break |