33# MIT License
44# Copyright (c) 2017-2018 Jetsonhacks
55# Please see accompanying license information
6-
6+ from __future__ import print_function
77import os ,sys
88
9+
10+
911class terminalColors :
1012 WARNING = '\033 [93m'
1113 FAIL = '\033 [91m'
@@ -25,11 +27,11 @@ class terminalColors:
2527proc .communicate ()
2628
2729# Jetson Model
28- print " NVIDIA Jetson " + os .environ ["JETSON_BOARD" ].strip ()
30+ print ( " NVIDIA Jetson " + os .environ ["JETSON_BOARD" ].strip ())
2931
3032#L4T Version
3133if os .path .exists ('/etc/nv_tegra_release' ):
32- with open (" /etc/nv_tegra_release" , "r" ) as l4tVersionFile :
34+ with open (' /etc/nv_tegra_release' , 'r' ) as l4tVersionFile :
3335 l4tVersionFileText = l4tVersionFile .read ()
3436 textLines = l4tVersionFileText .splitlines ()
3537 l4tVersionInfo = textLines [0 ].split (',' )
@@ -44,35 +46,35 @@ class terminalColors:
4446 elif 'BOARD' in entry :
4547 # Example: 'BOARD: t210ref'
4648 board = entry .split (' ' )[2 ]
47- print ' L4T ' + l4tRelease + '.' + l4tRevision + " [ JetPack " + os .environ [" JETSON_JETPACK" ].strip ()+ " ]"
48- print ' Board: ' + board
49+ print ( ' L4T ' + l4tRelease + '.' + l4tRevision + ' [ JetPack ' + os .environ [' JETSON_JETPACK' ].strip ()+ ' ]' )
50+ print ( ' Board: ' + board )
4951else :
50- print terminalColors .FAIL + " Error: Unable to find L4T Version" + terminalColors .ENDC
51- print " Reason: Unable to find file /etc/nv_tegra_release"
52+ print ( terminalColors .FAIL + ' Error: Unable to find L4T Version' + terminalColors .ENDC )
53+ print ( ' Reason: Unable to find file /etc/nv_tegra_release' )
5254
5355# Ubuntu version
5456if os .path .exists ('/etc/os-release' ):
55- with open (" /etc/os-release" , "r" ) as ubuntuVersionFile :
57+ with open (' /etc/os-release' , 'r' ) as ubuntuVersionFile :
5658 ubuntuVersionFileText = ubuntuVersionFile .read ()
5759 for line in ubuntuVersionFileText .splitlines ():
5860 if 'PRETTY_NAME' in line :
5961 # PRETTY_NAME="Ubuntu 16.04 LTS"
6062 ubuntuRelease = line .split ('"' )[1 ]
61- print ' ' + ubuntuRelease
63+ print ( ' ' + ubuntuRelease )
6264else :
63- print terminalColors .FAIL + " Error: Unable to find Ubuntu Version" + terminalColors .ENDC
64- print " Reason: Unable to find file /etc/os-release"
65+ print ( terminalColors .FAIL + ' Error: Unable to find Ubuntu Version' + terminalColors .ENDC )
66+ print ( ' Reason: Unable to find file /etc/os-release' )
6567
6668
6769
6870# Kernel Release
6971if os .path .exists ('/proc/version' ):
70- with open (" /proc/version" , "r" ) as versionFile :
72+ with open (' /proc/version' , 'r' ) as versionFile :
7173 versionFileText = versionFile .read ()
72- kernelReleaseArray = versionFileText .split (" " )
73- print " Kernel Version: " + kernelReleaseArray [2 ]
74+ kernelReleaseArray = versionFileText .split (' ' )
75+ print ( ' Kernel Version: ' + kernelReleaseArray [2 ])
7476else :
75- print terminalColors .FAIL + " Error: Unable to find Linux kernel version" + terminalColors .ENDC
76- print " Reason: Unable to find file /proc/version"
77+ print ( terminalColors .FAIL + ' Error: Unable to find Linux kernel version' + terminalColors .ENDC )
78+ print ( ' Reason: Unable to find file /proc/version' )
7779
78- print " CUDA " + os .environ [" JETSON_CUDA" ].strip ()
80+ print ( ' CUDA ' + os .environ [' JETSON_CUDA' ].strip ())
0 commit comments