summaryrefslogtreecommitdiff
path: root/build_extra/rust/get_cargo_info.py
blob: 26e4c6e3cc2e59cd46eea9ad63bdb507fb0a7825 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/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