1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-26 16:09:27 -05:00
denoland-deno/build_extra/rust/get_cargo_info.py
2019-01-21 13:03:30 -06:00

14 lines
378 B
Python
Executable file

#!/usr/bin/env python
# Copyright 2018-2019 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