MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / main

Function main

misc/python/materialize/cli/mzimage.py:19–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17
18
19def main() -> int:
20 args = _parse_args()
21 ui.Verbosity.init_from_env(explicit=None)
22 repo = mzbuild.Repository.from_arguments(MZ_ROOT, args)
23
24 if args.command == "list":
25 for image in repo:
26 print(image.name)
27 else:
28 if args.image not in repo.images:
29 print(f"fatal: unknown image: {args.image}", file=sys.stderr)
30 return 1
31 deps = repo.resolve_dependencies([repo.images[args.image]])
32 rimage = deps[args.image]
33 if args.command == "run":
34 deps.acquire()
35 rimage.run(args.image_args)
36 elif args.command == "acquire":
37 deps.acquire()
38 elif args.command == "ensure":
39 deps.ensure()
40 elif args.command == "fingerprint":
41 print(rimage.fingerprint())
42 elif args.command == "spec":
43 print(rimage.spec())
44 elif args.command == "describe":
45 inputs = sorted(rimage.inputs(args.transitive))
46 dependencies = sorted(rimage.list_dependencies(args.transitive))
47
48 print(f"Image: {rimage.name}")
49 print(f"Fingerprint: {rimage.fingerprint()}")
50
51 print("Input files:")
52 for inp in inputs:
53 print(f" {inp}")
54
55 print("Dependencies:")
56 for d in dependencies:
57 print(f" {d}")
58 if not dependencies:
59 print(" (none)")
60 else:
61 raise RuntimeError("unreachable")
62 return 0
63
64
65def _parse_args() -> argparse.Namespace:

Callers 1

mzimage.pyFile · 0.70

Calls 11

_parse_argsFunction · 0.85
init_from_envMethod · 0.80
from_argumentsMethod · 0.80
resolve_dependenciesMethod · 0.80
acquireMethod · 0.80
specMethod · 0.80
list_dependenciesMethod · 0.80
runMethod · 0.45
ensureMethod · 0.45
fingerprintMethod · 0.45
inputsMethod · 0.45

Tested by

no test coverage detected