From: Matthew Fernandez Date: Thu, 10 Nov 2022 01:15:07 +0000 (-0800) Subject: CI: remove command line argument parsing from the deploy script X-Git-Tag: 7.0.2~20^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2babd9422309d25afbc0f0cd2f5e0ba0ebd95244;p=graphviz CI: remove command line argument parsing from the deploy script This script is called in exactly one place and always passed the `--verbose` option. This change removes this only remaining option from the script and unconditionally applies its effect, for a minor simplification. --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8fb9c4d37..ea843e1a5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1305,7 +1305,7 @@ deployment: - apk add --update-cache curl - apk add --update-cache python3 script: - - python3 ci/deploy.py --verbose + - python3 ci/deploy.py # do not run this job for MRs, developer’s forks, etc. only: - main@graphviz/graphviz diff --git a/ci/deploy.py b/ci/deploy.py index d18ca5a82..5ad364dcd 100644 --- a/ci/deploy.py +++ b/ci/deploy.py @@ -7,7 +7,6 @@ This is based on Gitlab’s generic package example, https://gitlab.com/gitlab-org/release-cli/-/tree/master/docs/examples/release-assets-as-generic-package """ -import argparse import hashlib import json import logging @@ -91,22 +90,14 @@ def get_format(path: Path) -> str: return "ZIP archive" return path.suffix[1:].lower() -def main(args: List[str]) -> int: # pylint: disable=missing-function-docstring +def main() -> int: # pylint: disable=missing-function-docstring # setup logging to print to stderr global log ch = logging.StreamHandler() log = logging.getLogger("deploy.py") log.addHandler(ch) - - # parse command line arguments - parser = argparse.ArgumentParser(description="Graphviz deployment script") - parser.add_argument("--verbose", action="store_true", help="Print more " - "diagnostic information.") - options = parser.parse_args(args[1:]) - - if options.verbose: - log.setLevel(logging.INFO) + log.setLevel(logging.INFO) if os.environ.get("CI") is None: log.error("CI environment variable unset; refusing to run") @@ -240,4 +231,4 @@ def main(args: List[str]) -> int: # pylint: disable=missing-function-docstring return 0 if __name__ == "__main__": - sys.exit(main(sys.argv)) + sys.exit(main())