aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2020-05-30 14:29:18 -0700
committerMike Crute <mike@crute.us>2020-05-30 15:07:45 -0700
commitb804661ffd8fc6bd30204100606e4150bbd79bf9 (patch)
tree1e72fd11718632589dc86b8ce9da9b44c7f57220
parent83d07e4b9a9cb9b2a79889fc81f1e66486f744ee (diff)
downloadalpine-ec2-ami-b804661ffd8fc6bd30204100606e4150bbd79bf9.tar.bz2
alpine-ec2-ami-b804661ffd8fc6bd30204100606e4150bbd79bf9.tar.xz
alpine-ec2-ami-b804661ffd8fc6bd30204100606e4150bbd79bf9.zip
Remove python3.8 dependency
-rwxr-xr-xscripts/builder.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/builder.py b/scripts/builder.py
index bfbd5d4..1bc4642 100755
--- a/scripts/builder.py
+++ b/scripts/builder.py
@@ -1,4 +1,4 @@
1#!/usr/bin/env python3.8 1#!/usr/bin/env python3
2 2
3# This bit has to stay at the very top of the script. It exists to ensure that 3# This bit has to stay at the very top of the script. It exists to ensure that
4# running this script all by itself uses the python virtual environment with 4# running this script all by itself uses the python virtual environment with
@@ -8,7 +8,7 @@ import os
8import sys 8import sys
9import subprocess 9import subprocess
10 10
11args = [os.path.join("build", "bin", "python3.8")] + sys.argv 11args = [os.path.join("build", "bin", "python3")] + sys.argv
12 12
13# Create the build root if it doesn't exist 13# Create the build root if it doesn't exist
14if not os.path.exists("build"): 14if not os.path.exists("build"):
@@ -64,7 +64,8 @@ class IdentityBrokerClient:
64 self.key = key 64 self.key = key
65 self._logger = logging.getLogger(__class__.__name__) 65 self._logger = logging.getLogger(__class__.__name__)
66 66
67 if override_endpoint := os.environ.get("IDENTITY_BROKER_ENDPOINT"): 67 override_endpoint = os.environ.get("IDENTITY_BROKER_ENDPOINT")
68 if override_endpoint:
68 self.endpoint = override_endpoint 69 self.endpoint = override_endpoint
69 70
70 if not self.key: 71 if not self.key:
@@ -364,7 +365,8 @@ class PruneAMIs:
364 version = info["version"] 365 version = info["version"]
365 built = info["build_time"] 366 built = info["build_time"]
366 367
367 if eol := info.get("end_of_life"): 368 eol = info.get("end_of_life")
369 if eol:
368 eol = datetime.fromisoformat(info["end_of_life"]) 370 eol = datetime.fromisoformat(info["end_of_life"])
369 371
370 for region, ami_id in info["artifacts"].items(): 372 for region, ami_id in info["artifacts"].items():
@@ -392,7 +394,8 @@ class PruneAMIs:
392 for ami_name, info in amis.items(): 394 for ami_name, info in amis.items():
393 version = info["version"] 395 version = info["version"]
394 396
395 if eol := info.get("end_of_life"): 397 eol = info.get("end_of_life")
398 if eol:
396 eol = datetime.fromisoformat(info["end_of_life"]) 399 eol = datetime.fromisoformat(info["end_of_life"])
397 400
398 if args.level == "revision": 401 if args.level == "revision":
@@ -725,7 +728,8 @@ def main():
725 subparser = subs.add_parser( 728 subparser = subs.add_parser(
726 command.command_name, help=doc, description=doc) 729 command.command_name, help=doc, description=doc)
727 730
728 if add_args := getattr(command, "add_args", None): 731 add_args = getattr(command, "add_args", None)
732 if add_args:
729 command.add_args(subparser) 733 command.add_args(subparser)
730 734
731 args = parser.parse_args() 735 args = parser.parse_args()