]> granicus.if.org Git - graphviz/commitdiff
deploy.py: outline functionality for deriving the 'format' field of JSON output
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 23 Nov 2021 02:25:51 +0000 (18:25 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 27 Nov 2021 16:09:43 +0000 (08:09 -0800)
This will be used in a future commit to add Windows entries to the JSON data.

ci/deploy.py

index 8e0d4f5009f743de49beacdea44c06bf027fe840..be6473cd830999900cb73d052acec32a6a96f840 100644 (file)
@@ -83,6 +83,14 @@ def is_windows_artifact(path: Path) -> bool:
   """is this a deployment artifact for Windows?"""
   return re.search(r"\bwindows\b", str(path)) is not None
 
+def get_format(path: Path) -> str:
+  """a human readable description of the format of this file"""
+  if path.suffix[1:].lower() == "exe":
+    return "EXE installer"
+  if path.suffix[1:].lower() == "zip":
+    return "ZIP installer"
+  return path.suffix[1:].lower()
+
 def main(args: List[str]) -> int: # pylint: disable=missing-function-docstring
 
   # setup logging to print to stderr
@@ -167,7 +175,7 @@ def main(args: List[str]) -> int: # pylint: disable=missing-function-docstring
     url = upload(package_version, tarball)
     assets.append(url)
     webentry = {
-      "format": tarball.suffix[1:],
+      "format": get_format(tarball),
       "url": url
     }
     for check in checksum(tarball):