Passed
Push — master ( 98d3ad...65b0bc )
by Oleksandr
02:38
created

tabpy.models.deploy_models.install_dependencies()   A

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nop 1
1
import os
2
from pathlib import Path
3
import pip
4
import platform
5
import subprocess
6
import sys
7
from tabpy.models.utils import setup_utils
8
9
10
def main():
11
    # Determine if we run python or python3
12
    if platform.system() == "Windows":
13
        py = "python"
14
    else:
15
        py = "python3"
16
17
    if len(sys.argv) > 1:
18
        config_file_path = sys.argv[1]
19
    else:
20
        config_file_path = setup_utils.get_default_config_file_path()
21
    print(f"Using config file at {config_file_path}")
22
    port, auth_on, prefix = setup_utils.parse_config(config_file_path)
23
    if auth_on:
24
        auth_args = setup_utils.get_creds()
25
    else:
26
        auth_args = []
27
28
    directory = str(Path(__file__).resolve().parent / "scripts")
29
    # Deploy each model in the scripts directory
30
    for filename in os.listdir(directory):
31
        subprocess.run([py, f"{directory}/{filename}", config_file_path] + auth_args)
32
33
34
if __name__ == "__main__":
35
    main()
36