~pieq/checkbox/add-30suspend-1reboot-cycles-support

« back to all changes in this revision

Viewing changes to plugins/architecture_info.py

  • Committer: Marc Tardif
  • Date: 2007-10-01 01:51:29 UTC
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: marc.tardif@canonical.com-20071001015129-rf1g8x0o0gimos4q
Separated architecture from distribution info.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import os.path
 
2
 
 
3
from commands import getoutput
 
4
 
 
5
from hwtest.plugin import Plugin
 
6
from hwtest.report_helpers import createTypedElement
 
7
 
 
8
 
 
9
class ArchitectureInfo(Plugin):
 
10
 
 
11
    dpkg_path = "/usr/bin/dpkg"
 
12
    dpkg_command = "%s --print-architecture" % dpkg_path
 
13
 
 
14
    def __init__(self):
 
15
        super(ArchitectureInfo, self).__init__()
 
16
        self._architecture_info = ''
 
17
        
 
18
    def gather(self):
 
19
        report = self._manager.report
 
20
        if not report.finalised:
 
21
            report.info['architecture'] = self._architecture_info
 
22
 
 
23
    def run(self):
 
24
        self._architecture_info = 'Unknown'
 
25
 
 
26
        # Debian and derivatives
 
27
        if os.path.exists(self.dpkg_path):
 
28
            self._architecture_info = getoutput(self.dpkg_command)
 
29
 
 
30
 
 
31
factory = ArchitectureInfo