blob: 54006922e034023fd455a5f7da0992f0d92b96ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import json
import os
def install_rust_program(ctx):
runcmd_prepend_to_path = globals()["runcmd_prepend_to_path"]
srcdir = globals()["srcdir"]
# Add the directory with built Rust binaries to the path.
default_target = os.path.join(srcdir, "target")
target = os.environ.get("CARGO_TARGET_DIR", default_target)
runcmd_prepend_to_path(ctx, dirname=os.path.join(target, "debug"))
def file_is_at_least_this_long(ctx, filename=None, number=None):
st = os.lstat(filename)
assert st.st_size >= int(number)
def json_files_match(ctx, first=None, second=None):
assert_eq = globals()["assert_eq"]
first = json.load(open(first))
second = json.load(open(second))
assert_eq(first, second)
def file_is_valid_json(ctx, filename=None):
json.load(open(filename))
|