MythTV master
software.py
Go to the documentation of this file.
1# smolt - Fedora hardware profiler
2#
3# Copyright (C) 2007 Mike McGrath
4# Copyright (C) 2009 Sebastian Pipping <sebastian@pipping.org>
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19
20import os
21import subprocess
22import re
23import sys
24import smolt_config
25from i18n import _
26
27
29 if os.access('/usr/bin/lsb_release', os.X_OK):
30 return subprocess.getstatusoutput('/usr/bin/lsb_release')[1].strip()
31 return ''
32
33initdefault_re = re.compile(r':(\d+):initdefault:')
34
36 defaultRunlevel = '9'
37 try:
38 with open('/etc/inittab') as i_tab:
39 inittab = i_tab.read()
40 match = initdefault_re.search(inittab)
41 if match:
42 defaultRunlevel = match.group(1)
43 except IOError:
44 try:
45 defaultRunlevel = subprocess.getstatusoutput('/sbin/runlevel')[1].split()[1].strip()
46 except:
47 sys.stderr.write(_('Cannot Determine Runlevel'))
48 return defaultRunlevel.strip()
49
50def read_os():
51 return smolt_config.get_config_attr("OS", "Calvin and Hobbes")
52
53if __name__ == '__main__':
54 dict = {
55 'LSB release':read_lsb_release(),
56 'Run level':read_runlevel(),
57 'OS':read_os(),
58 }
59 for k, v in list(dict.items()):
60 print('%s: "%s"' % (k, v))
static void print(const QList< uint > &raw_minimas, const QList< uint > &raw_maximas, const QList< float > &minimas, const QList< float > &maximas)