-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathenv.py
60 lines (45 loc) · 1.63 KB
/
env.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from faasmtools.env import get_version as get_cpp_version
from os.path import dirname, abspath, join
PROJ_ROOT = dirname(dirname(abspath(__file__)))
DOCKER_ROOT = join(PROJ_ROOT, "docker")
EXAMPLES_DIR = join(PROJ_ROOT, "examples")
DEV_FAASM_LOCAL = join(PROJ_ROOT, "dev", "faasm-local")
WASM_DIR = join(PROJ_ROOT, "wasm")
# Docker variables
EXAMPLES_BUILD_IMAGE_NAME = "faasm/examples-build"
EXAMPLES_BUILD_DOCKERFILE = join(DOCKER_ROOT, "build.dockerfile")
EXAMPLES_RUN_IMAGE_NAME = "faasm/examples-run"
EXAMPLES_RUN_DOCKERFILE = join(DOCKER_ROOT, "run.dockerfile")
def get_submodule_version(submodule):
"""
Get the version of a submodule as indicated in the VERSION file
"""
ver_file = join(PROJ_ROOT, submodule, "VERSION")
with open(ver_file, "r") as fh:
version = fh.read()
version = version.strip()
return version
def get_python_version():
"""
Get the version of the python submodule
"""
return get_submodule_version("python")
def get_faasm_version():
"""
Get the version of the python submodule
"""
ver_file = join(PROJ_ROOT, "FAASM_VERSION")
with open(ver_file, "r") as fh:
version = fh.read()
version = version.strip()
return version
def get_version(name="build"):
"""
Get version for the examples repository
The version depends only on the version of the different cross-compilation
toolchains we use, in this case CPP and Python, and Faasm
"""
if name == "build":
return "{}_{}".format(get_cpp_version(), get_python_version())
if name == "run" or name == "run-sgx-sim":
return "{}".format(get_faasm_version())