| #!/usr/bin/env python3 |
| # Copyright 2020 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| """Download web fonts to bundle with nassh. See ../docs/fonts.md""" |
| |
| import sys |
| |
| import nassh # pylint: disable=wrong-import-order |
| import libdot |
| |
| |
| # The hash of the fonts that we maintain. |
| # Allow a long line for easy automated updating. |
| # pylint: disable=line-too-long |
| FONTS_HASH = "d6dc5eaf459abd058cd3aef1e25963fde893f9d87f5f55f340431697ce4b3506" |
| # pylint: enable=line-too-long |
| |
| # Bucket maintained by us. |
| FONTS_GS_FRAGMENT = "chromeos-localmirror/secureshell/distfiles" |
| FONTS_GS_URI = f"gs://{FONTS_GS_FRAGMENT}" |
| FONTS_BASE_URI = f"https://storage.googleapis.com/{FONTS_GS_FRAGMENT}" |
| |
| # The nassh fonts path. |
| FONTS_DIR = nassh.DIR / "fonts" |
| |
| |
| def fonts_update(): |
| """Download & update our copy of fonts.""" |
| libdot.download_tarball( |
| f"fonts-{FONTS_HASH}.tar.xz", FONTS_BASE_URI, FONTS_DIR, FONTS_HASH |
| ) |
| |
| |
| def get_parser(): |
| """Get a command line parser.""" |
| parser = libdot.ArgumentParser(description=__doc__) |
| return parser |
| |
| |
| def main(argv): |
| """The main func!""" |
| parser = get_parser() |
| _opts = parser.parse_args(argv) |
| |
| fonts_update() |
| |
| |
| if __name__ == "__main__": |
| sys.exit(main(sys.argv[1:])) |