aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2020-05-29 20:38:41 -0700
committerMike Crute <mike@crute.us>2020-05-29 20:58:11 -0700
commit5b2f32c9c854ab30178cb78bc2272f2c71d0a60e (patch)
treeaccc1914d436e669f1bfe9e2b5d8a2acdf13a8e6
parent41f127d77b8d386244bf5f617711ed884df5df4f (diff)
downloadalpine-ec2-ami-5b2f32c9c854ab30178cb78bc2272f2c71d0a60e.tar.bz2
alpine-ec2-ami-5b2f32c9c854ab30178cb78bc2272f2c71d0a60e.tar.xz
alpine-ec2-ami-5b2f32c9c854ab30178cb78bc2272f2c71d0a60e.zip
Allow builder to be run by itself
-rwxr-xr-x[-rw-r--r--]scripts/builder.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/builder.py b/scripts/builder.py
index de95bdb..7491e25 100644..100755
--- a/scripts/builder.py
+++ b/scripts/builder.py
@@ -1,3 +1,34 @@
1#!/usr/bin/env python3.8
2
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
5# our dependencies installed. If will create that environment if it doesn't
6# exist.
7import os
8import sys
9import subprocess
10
11args = [os.path.join("build", "bin", "python3.8")] + sys.argv
12
13# Create the build root if it doesn't exist
14if not os.path.exists("build"):
15 import venv
16
17 print("Build environment does not exist, creating...", file=sys.stderr)
18 venv.create("build", with_pip=True)
19 subprocess.run(["build/bin/pip", "install", "-U", "pip",
20 "pyhocon", "boto3", "PyYAML"])
21
22 print("Re-executing with builder python...", file=sys.stderr)
23 os.execv(args[0], args)
24else:
25 # If the build root python is not running this script re-execute it with
26 # that python instead to ensure all of our dependencies exist.
27 if os.path.join(os.getcwd(), args[0]) != sys.executable:
28 print("Re-executing with builder python...", file=sys.stderr)
29 os.execv(args[0], args)
30
31# Below here is the real script
1import io 32import io
2import os 33import os
3import re 34import re