-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
executable file
·56 lines (39 loc) · 1.19 KB
/
main.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
#!/usr/bin/env python
# @Author: Joe Iannone <josephiannone>
# @Date: 2019-01-22T21:22:57-05:00
# @Filename: main.py
# @Last modified by: josephiannone
# @Last modified time: 2019-05-13T19:35:05-04:00
import sys, signal
from yaspin import yaspin
def main():
# spinner before dependency / version check
spinner = yaspin()
spinner.start()
# Python version check and warning
pyv = sys.version_info
pyv_str = str(pyv[0]) + '.' + str(pyv[1])
if float(pyv_str) < 3.0:
print('\nERROR: You must use python version 3 or higher.')
print('This is version ' + pyv_str + '\n')
spinner.stop()
sys.exit(1)
# Check dependencies
try:
from src.cli import swellCLI
except ImportError:
print('\nDependencies not installed.')
print('\nrun:\n\tpip install -r requirements.txt\n')
spinner.stop()
sys.exit(1)
# listener to catch SIGINT and exit gracefully
signal.signal(signal.SIGINT, signal_int_handler)
# stop spinner now
spinner.stop()
cli = swellCLI()
cli.run()
# handler for SIGINT
def signal_int_handler(sig, frame):
sys.exit('\n\nGoodbye.\n')
if __name__ == '__main__':
main()