|
| 1 | +""" |
| 2 | +Helper script for installing `codeql_pack` targets. |
| 3 | +
|
| 4 | +This mainly wraps around a `pkg_install` script from `rules_pkg` adding: |
| 5 | +* resolving destination directory with respect to a provided `--build-file` |
| 6 | +* clean-up of target destination directory before a reinstall |
| 7 | +* installing imported zip files using a provided `--ripunzip` |
| 8 | +""" |
| 9 | + |
1 | 10 | import argparse |
2 | 11 | import pathlib |
3 | 12 | import shutil |
|
7 | 16 | runfiles = runfiles.Create() |
8 | 17 | assert runfiles, "Installer should be run with `bazel run`" |
9 | 18 |
|
10 | | -parser = argparse.ArgumentParser() |
11 | | -parser.add_argument("--destdir", type=pathlib.Path, required=True) |
12 | | -parser.add_argument("--script", required=True) |
13 | | -parser.add_argument("--build-file", required=True) |
14 | | -parser.add_argument("--ripunzip", required=True) |
15 | | -parser.add_argument("--zip-manifest", action="append", default=[], dest="zip_manifests") |
| 19 | +parser = argparse.ArgumentParser(description=__doc__) |
| 20 | +parser.add_argument("--destdir", type=pathlib.Path, required=True, |
| 21 | + help="Desination directory, relative to `--build-file`") |
| 22 | +parser.add_argument("--script", required=True, |
| 23 | + help="The wrapped `pkg_install` installation script rlocation") |
| 24 | +parser.add_argument("--build-file", required=True, |
| 25 | + help="BUILD.bazel rlocation relative to which the installation should take place") |
| 26 | +parser.add_argument("--ripunzip", required=True, |
| 27 | + help="ripunzip executable rlocation") |
| 28 | +parser.add_argument("--zip-manifest", action="append", default=[], dest="zip_manifests", |
| 29 | + help="The rlocation of a file containing newline-separated `prefix:zip_file` entries") |
16 | 30 | opts = parser.parse_args() |
17 | 31 |
|
18 | 32 | build_file = runfiles.Rlocation(opts.build_file) |
|
0 commit comments