-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.py
More file actions
40 lines (33 loc) · 1.06 KB
/
install.py
File metadata and controls
40 lines (33 loc) · 1.06 KB
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
import os
import argparse
import shutil
import sys
VENV_PATH = ".POKER"
PYTHON_BIN = sys.executable
def getBinPath():
if os.name == "posix":
return rf"{VENV_PATH}/bin"
else:
return rf"{VENV_PATH}\Scripts"
def main():
if args.reinstall or args.clean:
shutil.rmtree(VENV_PATH)
print(f"Removed {VENV_PATH}")
if args.clean:
return
if not os.path.exists(VENV_PATH):
if os.name == "posix":
os.system(f"sudo apt install {PYTHON_BIN}-venv")
os.system(f"{PYTHON_BIN} -m venv {VENV_PATH}")
print(f"Created {VENV_PATH}")
print("Installing dependencies")
os.system(f"{os.path.join(getBinPath(), 'pip')} install -r requirements.txt")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Setup script.")
parser.add_argument("--reinstall", action="store_true", help="Force clean install.")
parser.add_argument(
"--clean", action="store_true", help="Removes all dependencies."
)
args = parser.parse_args()
main()
print("Done")