-
-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathinspect_artifacts.py
50 lines (45 loc) · 1.41 KB
/
inspect_artifacts.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from pathlib import Path
import click
import conda_build.config
from conda_package_handling.api import list_contents
from .utils import (
built_distributions,
built_distributions_from_recipe_variant,
compute_sha256sum,
human_readable_bytes,
)
@click.command()
@click.option(
'--all-packages',
is_flag=True,
help='inspect all packages found in the conda-build root directory'
)
@click.option(
'--recipe-dir',
type=click.Path(exists=False, file_okay=False, dir_okay=True),
default=None,
help='the conda recipe directory'
)
@click.option(
'--variant',
'-m',
multiple=True,
type=click.Path(exists=False, file_okay=True, dir_okay=False),
default=(),
help="path to conda_build_config.yaml defining your base matrix",
)
def main(all_packages, recipe_dir, variant):
if all_packages:
distributions = built_distributions()
else:
distributions = built_distributions_from_recipe_variant(recipe_dir=recipe_dir, variant=variant)
for artifact in sorted(distributions):
path = Path(artifact)
relpath = path.relative_to(conda_build.config.croot)
print("-" * len(str(relpath)))
print(relpath)
print("-" * len(str(relpath)))
print("-- Size:", human_readable_bytes(path.stat().st_size))
print("-- SHA256:", compute_sha256sum(path))
print("-- Contents:")
list_contents(artifact, verbose=True)