forked from geekcomputers/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
osinfo.py
36 lines (30 loc) · 1.17 KB
/
osinfo.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
# Script Name : osinfo.py
# Author : Craig Richards
# Created : 5th April 2012
# Last Modified : April 02 2016
# Version : 1.0
# Modifications : Changed the list to a dictionary. Although the order is lost, the info is with its label.
# Description : Displays some information about the OS you are running this script on
import platform
profile = {
'Architecture: ': platform.architecture(),
#'Linux Distribution: ': platform.linux_distribution(),
'mac_ver: ': platform.mac_ver(),
'machine: ': platform.machine(),
'node: ': platform.node(),
'platform: ': platform.platform(),
'processor: ': platform.processor(),
'python build: ': platform.python_build(),
'python compiler: ': platform.python_compiler(),
'python version: ': platform.python_version(),
'release: ': platform.release(),
'system: ': platform.system(),
'uname: ': platform.uname(),
'version: ': platform.version(),
}
if hasattr(platform, 'linux_distribution'):
#to avoid AttributeError exception in some old versions of the module
profile['linux_distribution'] = platform.linux_distribution()
#FIXME: do this for all properties but in a loop
for key in profile:
print(key + str(profile[key]))