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

Method install_arguments

misc/python/materialize/mzbuild.py:1582–1650  ·  view source on GitHub ↗

Install options to configure a repository into an argparse parser. This function installs the following options: * The mutually-exclusive `--dev`/`--optimized`/`--release` options to control the `profile` repository attribute. * The `--coverage` boolean opti

(parser: argparse.ArgumentParser)

Source from the content-addressed store, hash-verified

1580
1581 @staticmethod
1582 def install_arguments(parser: argparse.ArgumentParser) -> None:
1583 """Install options to configure a repository into an argparse parser.
1584
1585 This function installs the following options:
1586
1587 * The mutually-exclusive `--dev`/`--optimized`/`--release` options to control the
1588 `profile` repository attribute.
1589 * The `--coverage` boolean option to control the `coverage` repository
1590 attribute.
1591
1592 Use `Repository.from_arguments` to construct a repository from the
1593 parsed command-line arguments.
1594 """
1595 build_mode = parser.add_mutually_exclusive_group()
1596 build_mode.add_argument(
1597 "--dev",
1598 action="store_true",
1599 help="build Rust binaries with the dev profile",
1600 )
1601 build_mode.add_argument(
1602 "--release",
1603 action="store_true",
1604 help="build Rust binaries with the release profile (default)",
1605 )
1606 build_mode.add_argument(
1607 "--optimized",
1608 action="store_true",
1609 help="build Rust binaries with the optimized profile (optimizations, no LTO, no debug symbols)",
1610 )
1611 parser.add_argument(
1612 "--coverage",
1613 help="whether to enable code coverage compilation flags",
1614 default=ui.env_is_truthy("CI_COVERAGE_ENABLED"),
1615 action="store_true",
1616 )
1617 parser.add_argument(
1618 "--sanitizer",
1619 help="whether to enable a sanitizer",
1620 default=Sanitizer[os.getenv("CI_SANITIZER", "none")],
1621 type=Sanitizer,
1622 choices=Sanitizer,
1623 )
1624
1625 def _parse_arch(s: str) -> Arch:
1626 try:
1627 return Arch(s)
1628 except ValueError:
1629 valid = ", ".join(m.value for m in Arch)
1630 raise argparse.ArgumentTypeError(
1631 f"invalid arch: {s!r} (choose from {valid})"
1632 )
1633
1634 parser.add_argument(
1635 "--arch",
1636 default=Arch.host(),
1637 help="the CPU architecture to build for",
1638 type=_parse_arch,
1639 metavar="{" + ",".join(m.value for m in Arch) + "}",

Callers 2

add_subcommandFunction · 0.80
mainFunction · 0.80

Calls 3

image_registryFunction · 0.90
hostMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected