]> granicus.if.org Git - graphviz/commitdiff
CI: remove command line argument parsing from the deploy script
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 10 Nov 2022 01:15:07 +0000 (17:15 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 10 Nov 2022 01:15:07 +0000 (17:15 -0800)
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.

.gitlab-ci.yml
ci/deploy.py

index 8fb9c4d37340917bbe399c4150a9c08bbbcdc43a..ea843e1a5fbe7c32d40d35204f73250f9b94cbce 100644 (file)
@@ -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
index d18ca5a82c6a12619afb666ddc76945465bb969b..5ad364dcdd226496279aaf931e1d36f71a6f735c 100644 (file)
@@ -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())