File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ #Sysinfo.py - Get info about computer and OS
2+ #Only works if you run this program on Linux since this program calls a bash script
3+ #Ubuntu, Debian, and Linux Mint only
4+
5+ #Import all required libraries/modules
6+ import subprocess as sp
7+ import platform
8+ import os
9+ import sys
10+ import time
11+
12+ #Create timer to get execution time
13+ start = time .time ()
14+
15+ #Display Python version
16+ print ("Python version: %s" % (platform .python_version ()))
17+
18+ #If not already installed, install figlet and also clear screen
19+ figlet_install = input ("Do you have figlet installed on your linux terminal (Y/N)? " )
20+
21+ os .system ("clear" )
22+
23+ if figlet_install .upper () == "Y" :
24+ pass
25+
26+ elif figlet_install .upper () == "N" :
27+ print ("Installing figlet..." )
28+ os .system ("sudo apt-get install figlet" )
29+
30+ elif figlet_install .upper () != "Y" and "N" :
31+ sys .exit ("Invalid input. Your input must either be Y or N (uppercase is not mandatory)." )
32+
33+ #Run figlet and get the name of the user's computer
34+ os .system ("figlet %s" % (platform .node ()))
35+
36+ #Execute bash script sysinfo.sh
37+ sp .call ("./sysinfo.sh" )
38+
39+ #End timer for finding execution time of program
40+ end = time .time ()
41+
42+ #Display execution time - Important: Sometimes the execution time might be a bit big but that would be because the user takes long to enter input
43+ print ("Program execution time: %s seconds" % (end - start ))
You can’t perform that action at this time.
0 commit comments