-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
84 lines (73 loc) · 3.31 KB
/
setup.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
from defaults import * # Import everything from the defaults module, which likely includes default settings and paths.
import os # Import the os module for interacting with the operating system.
import subprocess # Import the subprocess module to run external commands.
def setupProject():
"""
Sets up the project by creating necessary folders and installing required packages.
"""
print(
"Setting up the project..."
) # Inform the user that the project setup is starting.
if not os.path.exists(
DATA_PATH
): # Check if the data folder path defined in defaults does not exist.
os.mkdir(DATA_PATH) # Create the data folder.
print(
"Data folder created!"
) # Inform the user that the data folder has been created.
else:
print(
"Data folder already exists!"
) # Inform the user that the data folder already exists.
if not os.path.exists(
OBJECT_IMAGES_PATH
): # Check if the {OBJECT_NAME} images folder path does not exist.
os.mkdir(OBJECT_IMAGES_PATH) # Create the {OBJECT_NAME} images folder.
print(
f"{OBJECT_NAME} images folder created!"
) # Inform the user that the {OBJECT_NAME} images folder has been created.
else:
print(
f"{OBJECT_NAME} images folder already exists!"
) # Inform the user that the {OBJECT_NAME} images folder already exists.
if not os.path.exists(
NOT_OBJECT_IMAGES_PATH
): # Check if the {NOT_OBJECT_NAME} images folder path does not exist.
os.mkdir(NOT_OBJECT_IMAGES_PATH) # Create the {NOT_OBJECT_NAME} images folder.
print(
f"{NOT_OBJECT_NAME} images folder created!"
) # Inform the user that the {NOT_OBJECT_NAME} images folder has been created.
else:
print(
f"{NOT_OBJECT_NAME} images folder already exists!"
) # Inform the user that the {NOT_OBJECT_NAME} images folder already exists.
if not os.path.exists(
TEST_IMAGES_PATH
): # Check if the test images folder path does not exist.
os.mkdir(TEST_IMAGES_PATH) # Create the test images folder.
print(
"Test images folder created!"
) # Inform the user that the test images folder has been created.
else:
print(
"Test images folder already exists!"
) # Inform the user that the test images folder already exists.
if not os.path.exists(
PKL_FILE_PATH
): # Check if the pkl folder path does not exist.
os.mkdir(PKL_FILE_PATH) # Create the pkl folder.
print(
"PKL folder created!"
) # Inform the user that the pkl folder has been created.
else:
print(
"PKL folder already exists!"
) # Inform the user that the pkl folder already exists.
subprocess.call(
["pip3", "install", "-r", "requirements.txt"]
) # Run the command to install all required packages from requirements.txt.
if (
__name__ == "__main__"
): # Check if the script is being run directly (not imported as a module).
print("Setup complete!") # Inform the user that the setup is complete.
setupProject() # Call the setupProject function to set up the project. (This line is necessary to run the setup when the script is executed.)