This repository has been archived by the owner on Dec 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathinstall.py
83 lines (67 loc) · 2.29 KB
/
install.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
''' Install Lyndor software and dependencies '''
import os, sys, shutil, json, zipfile
real_path = os.path.realpath(__file__)
LYNDOR_PATH = real_path[:real_path.find('install.py')]
def check_os():
'''Check operating system'''
platform = sys.platform.lower()
if platform == 'darwin':
return 'macos'
elif platform == 'win32':
return 'windows'
elif platform == 'linux2' or platform == 'linux':
return 'linux'
else:
print('operating system not supported:', platform)
sys.exit('unknown operating system.')
def set_path():
'''Set path for saving lynda folder'''
if check_os() == 'macos':
os.chdir(os.path.expanduser('~/Movies'))
return os.getcwd()
elif check_os() == 'windows' or check_os() == 'linux':
directory = os.path.expanduser('~/')
if file_found('Videos', directory):
os.chdir(os.path.expanduser('~/Videos'))
else:
os.mkdir(os.path.expanduser('~/Videos'))
os.chdir(os.path.expanduser('~/Videos'))
return os.getcwd()
def get_path(folder):
'''Set path for desktop folder'''
if check_os() == 'macos':
os.chdir(os.path.expanduser('~/' + folder))
return os.getcwd()
elif check_os() == 'windows':
os.chdir(os.path.expanduser('~/' + folder))
return os.getcwd()
elif check_os() == 'linux':
os.chdir(os.path.expanduser('~/' + folder))
return os.getcwd()
def file_found(folder, directory):
''' find a file in a directory '''
for pointer in os.listdir(directory):
if pointer == folder:
return True
return False
def install_dependencies():
'''install required softwares'''
os.chdir(LYNDOR_PATH)
print('lyndor path:', LYNDOR_PATH)
requirements = os.path.join(LYNDOR_PATH, 'requirements.txt')
os.system('pip3 install -r ' + requirements)
if __name__ == '__main__':
try:
from module import save
install_dependencies()
save.settings_json()
save.lynda_folder()
save.aliases_bat()
save.run_lyndor_bat()
save.aria2()
save.webdriver()
except KeyboardInterrupt:
print("Program execution cancelled through keyboard!")
sys.exit(0)