~jocave/checkbox/hybrid-amd-gpu-mods

« back to all changes in this revision

Viewing changes to providers/plainbox-provider-resource-generic/bin/dmi_resource

  • Committer: Zygmunt Krynicki
  • Date: 2013-05-29 07:50:30 UTC
  • mto: This revision was merged to the branch mainline in revision 2153.
  • Revision ID: zygmunt.krynicki@canonical.com-20130529075030-ngwz245hs2u3y6us
checkbox: move current checkbox code into checkbox-old

This patch cleans up the top-level directory of the project into dedicated
sub-project directories. One for checkbox-old (the current checkbox and all the
associated stuff), one for plainbox and another for checkbox-ng.

There are some associated changes, such as updating the 'source' mode of
checkbox provider in plainbox, and fixing paths in various test scripts that we
have.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python3
2
 
#
3
 
# This file is part of Checkbox.
4
 
#
5
 
# Copyright 2011 Canonical Ltd.
6
 
#
7
 
# Checkbox is free software: you can redistribute it and/or modify
8
 
# it under the terms of the GNU General Public License version 3,
9
 
# as published by the Free Software Foundation.
10
 
 
11
 
#
12
 
# Checkbox 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 Checkbox.  If not, see <http://www.gnu.org/licenses/>.
19
 
#
20
 
import os
21
 
import sys
22
 
 
23
 
from checkbox_support.parsers.dmidecode import DmidecodeParser
24
 
 
25
 
 
26
 
# Command to retrieve dmi information.
27
 
COMMAND = "dmidecode"
28
 
 
29
 
 
30
 
class DmiResult:
31
 
 
32
 
    attributes = ("path", "category", "product", "vendor", "serial",
33
 
        "version", "size", "form",)
34
 
 
35
 
    def addDmiDevice(self, device):
36
 
        for attribute in self.attributes:
37
 
            value = getattr(device, attribute, None)
38
 
            if value is not None:
39
 
                print("%s: %s" % (attribute, value))
40
 
 
41
 
        print()
42
 
 
43
 
 
44
 
def main():
45
 
    stream = os.popen(COMMAND)
46
 
    dmi = DmidecodeParser(stream)
47
 
 
48
 
    result = DmiResult()
49
 
    dmi.run(result)
50
 
 
51
 
    return 0
52
 
 
53
 
 
54
 
if __name__ == "__main__":
55
 
    sys.exit(main())