summaryrefslogtreecommitdiff
path: root/build_extra/rust/get_cargo_info.py
diff options
context:
space:
mode:
Diffstat (limited to 'build_extra/rust/get_cargo_info.py')
-rwxr-xr-xbuild_extra/rust/get_cargo_info.py14
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