-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstallation_test.py
95 lines (73 loc) · 2.36 KB
/
installation_test.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
"""This script is used to test installations of the aalibrary on various
systems and platforms."""
import sys
import platform
import subprocess
def determine_os():
return platform.system()
def check_and_install_on_windows():
system_name = determine_os()
assert system_name == "Windows", (
"The system specified was `Windows` however, we have determined that"
f" the system is `{system_name}`"
)
# Install the library using the current directory.
subprocess.check_call(
[
sys.executable,
"-m",
"pip",
"install",
"aalibrary@git+https://github.com/nmfs-ost/AA-SI_aalibrary.git",
]
)
def check_and_install_on_linux():
system_name = determine_os()
assert system_name == "Linux", (
"The system specified was `Linux` however, we have determined that "
f"the system is `{system_name}`"
)
# Install the library using the current directory.
subprocess.check_call(
[
sys.executable,
"-m",
"pip",
"install",
"aalibrary@git+https://github.com/nmfs-ost/AA-SI_aalibrary.git",
]
)
def check_and_install_on_mac():
system_name = determine_os()
assert system_name == "Darwin", (
"The system specified was `Darwin` however, we have determined that "
f"the system is `{system_name}`"
)
# Install the library using the current directory.
subprocess.check_call(
[
sys.executable,
"-m",
"pip",
"install",
"aalibrary@git+https://github.com/nmfs-ost/AA-SI_aalibrary.git",
]
)
def install(system_name: str = ""):
"""Installs the package on the current system after determining the
current system.
Args:
system_name (str, optional): The name of the system you are using. Can
be one of ['Windows', 'Linux', 'Darwin' (for MacOS)]. Will
determine automatically if not specified. Defaults to "".
"""
if system_name == "":
system_name = determine_os()
if system_name == "Windows":
check_and_install_on_windows()
elif system_name == "Linux":
check_and_install_on_linux()
elif system_name == "Darwin": # Covers MacOS
check_and_install_on_mac()
if __name__ == "__main__":
install()