forked from viennacl/pyviennacl-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyversions.py
43 lines (36 loc) · 1.17 KB
/
pyversions.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
import os
import platform
import sys
def do_help():
print("Requires one argument:")
print(" python -- to get the Python version")
print(" boost -- to get the Boost Python component name")
def main(argv):
if len(argv) < 2:
do_help()
return os.EX_CONFIG
if argv[1] == "python":
print("%d.%d.%d" % (sys.version_info.major,
sys.version_info.minor,
sys.version_info.micro))
elif argv[1] == "boost":
if 'linux' in platform.system().lower():
if platform.linux_distribution()[0] == 'Ubuntu':
print("python-py%d%d" %
(sys.version_info.major,
sys.version_info.minor))
return os.EX_OK
if sys.version_info == 3:
print("python3")
else:
print("python")
elif 'windows' in platform.system().lower():
print("python")
elif 'darwin' in platform.system().lower():
print("python")
else:
do_help()
return os.EX_CONFIG
return os.EX_OK
if __name__ == "__main__":
sys.exit(main(sys.argv))