-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinstall.py
executable file
·41 lines (33 loc) · 1.19 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
#!/usr/bin/env python
import sys
if sys.version < (3, 6):
print(sys.version_info[0])
print('You must have Python 3 installed to use hapiest - current version is ' + str(sys.version))
sys.exit(0)
## Dependencies required to install
REQUIREMENTS = ['PyQt5', 'PyQtChart', 'toml', 'parsy']
try:
import PyQt5
import PyQt5.QtChart
import toml
import parsy
print('All required packages are already installed!')
except Exception as e:
print("Missing dependency:\n" + str(e))
finally:
from urllib.request import urlretrieve
try:
response = urlretrieve('https://github.com/hitranonline/hapiest/archive/master.zip', 'hapiest.zip')
except Exception as e:
print('Encountered error \'' + str(e) + '\' while trying to download hapiest.')
sys.exit(0)
finally:
import zipfile
try:
zip = zipfile.ZipFile('hapiest.zip', 'r')
zip.extractall('hapiest')
zip.close()
print('Hapiest has successfully been installed in the directory \'hapiest\'')
except Exception as e:
print('Encountered error \'' + str(e) + '\' when attempting to extract hapiest.zip')
sys.exit(0)