]> git.ipfire.org Git - people/arne_f/ipfire-3.x.git/blob - pkgs/pyfire/src/__init__.py
4bd81a63e0e68921f6a16ec84d96c41476f78f45
[people/arne_f/ipfire-3.x.git] / pkgs / pyfire / src / __init__.py
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
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 3 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, see <http://www.gnu.org/licenses/>. #
18 # #
19 ###############################################################################
20
21 __all__ = [ "config", "executil", "hal", "net", "translate", "web", ]
22
23 import os
24
25 import hal
26
27 class System:
28 def __init__(self):
29 self.dbus = hal.get_device("/org/freedesktop/Hal/devices/computer")
30
31 def getKernelVersion(self):
32 ret = None
33 try:
34 ret = self.dbus["system.kernel.version"]
35 except KeyError:
36 pass
37 return ret
38
39 def getFormfactor(self):
40 return self.dbus["system.formfactor"]
41
42 def getVendor(self):
43 ret = None
44 try:
45 ret = self.dbus["system.vendor"]
46 except KeyError:
47 pass
48 return ret
49
50 def getProduct(self):
51 ret = None
52 try:
53 ret = self.dbus["system.product"]
54 except KeyError:
55 pass
56 return ret
57
58
59 if __name__ == "__main__":
60 system = System()
61 print "Kernel Version : %s" % system.getKernelVersion()
62 print "System Formfactor : %s" % system.getFormfactor()
63 print "System Vendor : %s" % system.getVendor()
64 print "System Product : %s" % system.getProduct()