root/branch/InterfaceEditor/source-plugins/system-info/sources/main.py @ 4266

Revision 4266, 1.5 kB (checked in by luis, 4 years ago)

Merged revisions 4248,4253,4255 via svnmerge from
http://svn.umitproject.org/svnroot/umit/trunk

........

r4248 | gpolo | 2009-03-02 19:06:01 +0000 (Mon, 02 Mar 2009) | 1 line


test_paths.sh has been abandoned too, gone now.

........

r4253 | gpolo | 2009-03-02 21:09:01 +0000 (Mon, 02 Mar 2009) | 1 line


Fixed ticket #234: Do not install the utils package in site-packages.

........

r4255 | gpolo | 2009-03-02 22:54:54 +0000 (Mon, 02 Mar 2009) | 1 line


Ran something to fix the still remaining old imports.

........

Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# Copyright (C) 2008 Adriano Monteiro Marques
4#
5# Author: Francesco Piccinno <stack.box@gmail.com>
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
21import os, sys
22from umit.plugin.Engine import Plugin
23from functools import update_wrapper
24
25if os.name != "posix":
26    raise Exception("I need Linux to work")
27
28def trace(f):
29    def newf(*args, **kw):
30        print "calling %s with args %s, %s" % (f.__name__, args, kw)
31        return f(*args, **kw)
32    return update_wrapper(newf, f)
33
34class SystemInfo(Plugin):
35    def start(self, reader):
36        pass
37
38    def stop(self):
39        pass
40
41    @trace
42    def get_routes(self):
43        return "".join(os.popen("route -n").readlines())
44
45    @trace
46    def get_ifaces(self):
47        return "".join(os.popen("ifconfig -a").readlines())
48
49    @trace
50    def get_name(self):
51        return " ".join(os.uname())
52
53__plugins__ = [SystemInfo]
Note: See TracBrowser for help on using the browser.