Exemplo n.º 1
0
    def set_properties(self):
        self._properties = SortedDict()
        if LSB:
            self.add_property(Property('is_lsb', _(u'LSB OS'), True))
            self.add_property(Property('distributor_id', _(u'Distributor ID'), lsb_release('-i','-s')))
            self.add_property(Property('description', _(u'Description'), lsb_release('-d','-s')))
            self.add_property(Property('release', _(u'Release'), lsb_release('-r','-s')))
            self.add_property(Property('codename', _(u'Codename'), lsb_release('-c','-s')))
            self.add_property(Property('sysinfo', _(u'System info'), uname('-a')))
        else:
            self.add_property(Property('is_posix', _(u'POSIX OS'), False))

        self.add_property(Property('architecture', _(u'OS architecture'), platform.architecture()))
        self.add_property(Property('python_version', _(u'Python version'), platform.python_version()))
        self.add_property(Property('hostname', _(u'Hostname'), platform.node()))
        self.add_property(Property('platform', _(u'Platform'), sys.platform))
        self.add_property(Property('machine', _(u'Machine'), platform.machine()))
        self.add_property(Property('processor', _(u'Processor'), platform.processor()))
        self.add_property(Property('cpus', _(u'Number of CPUs'), psutil.NUM_CPUS))
        self.add_property(Property('total_phymem', _(u'Total physical memory'), pretty_size(psutil.TOTAL_PHYMEM)))
        self.add_property(Property('disk_partitions', _(u'Disk partitions'), '; '.join(['%s %s %s %s' % (partition.device, partition.mountpoint, partition.fstype, partition.opts) for partition in psutil.disk_partitions()])))
        
        try:
            self.add_property(Property('tesseract', _(u'tesseract version'), pbs.tesseract('-v').stderr))
        except pbs.CommandNotFound:
            self.add_property(Property('tesseract', _(u'tesseract version'), _(u'not found')))

        try:
            self.add_property(Property('unpaper', _(u'unpaper version'), pbs.unpaper('-V').stdout))
        except pbs.CommandNotFound:
            self.add_property(Property('unpaper', _(u'unpaper version'), _(u'not found')))
Exemplo n.º 2
0
    def os_properties(self):
        namespace = PropertyNamespace('os', _(u'Operating system'))
        if LSB:
            namespace.add_property('is_lsb', _(u'LSB OS'), True, True)
            namespace.add_property('distributor_id', _(u'Distributor ID'),
                                   lsb_release('-i', '-s'), True)
            namespace.add_property('description', _(u'Description'),
                                   lsb_release('-d', '-s'), True)
            namespace.add_property('release', _(u'Release'),
                                   lsb_release('-r', '-s'), True)
            namespace.add_property('codename', _(u'Codename'),
                                   lsb_release('-c', '-s'), True)
            namespace.add_property('sysinfo', _(u'System info'), uname('-a'),
                                   True)
        else:
            namespace.add_property('is_lsb', _(u'LSB OS'), False)

        namespace.add_property('architecture',
                               _(u'OS architecture'),
                               platform.architecture(),
                               report=True)
        namespace.add_property('python_version',
                               _(u'Python version'),
                               platform.python_version(),
                               report=True)
        namespace.add_property('hostname', _(u'Hostname'), platform.node())
        namespace.add_property('platform',
                               _(u'Platform'),
                               sys.platform,
                               report=True)
        namespace.add_property('machine',
                               _(u'Machine'),
                               platform.machine(),
                               report=True)
        namespace.add_property('processor',
                               _(u'Processor'),
                               platform.processor(),
                               report=True)
        namespace.add_property('cpus',
                               _(u'Number of CPUs'),
                               psutil.NUM_CPUS,
                               report=True)
        namespace.add_property('total_phymem',
                               _(u'Total physical memory'),
                               pretty_size(psutil.TOTAL_PHYMEM),
                               report=True)
        namespace.add_property(
            'disk_partitions', _(u'Disk partitions'), '; '.join([
                '%s %s %s %s' % (partition.device, partition.mountpoint,
                                 partition.fstype, partition.opts)
                for partition in psutil.disk_partitions()
            ]))
Exemplo n.º 3
0
 def os_properties(self):
     namespace = PropertyNamespace('os', _(u'Operating system'))
     if LSB:
         namespace.add_property('is_lsb', _(u'LSB OS'), True, True)
         namespace.add_property('distributor_id', _(u'Distributor ID'), lsb_release('-i', '-s'), True)
         namespace.add_property('description', _(u'Description'), lsb_release('-d', '-s'), True)
         namespace.add_property('release', _(u'Release'), lsb_release('-r', '-s'), True)
         namespace.add_property('codename', _(u'Codename'), lsb_release('-c', '-s'), True)
         namespace.add_property('sysinfo', _(u'System info'), uname('-a'), True)
     else:
         namespace.add_property('is_lsb', _(u'LSB OS'), False)
                         
     namespace.add_property('architecture', _(u'OS architecture'), platform.architecture(), report=True)
     namespace.add_property('python_version', _(u'Python version'), platform.python_version(), report=True)
     namespace.add_property('hostname', _(u'Hostname'), platform.node())
     namespace.add_property('platform', _(u'Platform'), sys.platform, report=True)
     namespace.add_property('machine', _(u'Machine'), platform.machine(), report=True)
     namespace.add_property('processor', _(u'Processor'), platform.processor(), report=True)
     namespace.add_property('cpus', _(u'Number of CPUs'), psutil.NUM_CPUS, report=True)
     namespace.add_property('total_phymem', _(u'Total physical memory'), pretty_size(psutil.TOTAL_PHYMEM), report=True)
     namespace.add_property('disk_partitions', _(u'Disk partitions'), '; '.join(['%s %s %s %s' % (partition.device, partition.mountpoint, partition.fstype, partition.opts) for partition in psutil.disk_partitions()]))
Exemplo n.º 4
0
    def set_properties(self):
        self._properties = SortedDict()
        if LSB:
            self.add_property(Property('is_lsb', _(u'LSB OS'), True))
            self.add_property(
                Property('distributor_id', _(u'Distributor ID'),
                         lsb_release('-i', '-s')))
            self.add_property(
                Property('description', _(u'Description'),
                         lsb_release('-d', '-s')))
            self.add_property(
                Property('release', _(u'Release'), lsb_release('-r', '-s')))
            self.add_property(
                Property('codename', _(u'Codename'), lsb_release('-c', '-s')))
            self.add_property(
                Property('sysinfo', _(u'System info'), uname('-a')))
        else:
            self.add_property(Property('is_posix', _(u'POSIX OS'), False))

        self.add_property(
            Property('architecture', _(u'OS architecture'),
                     platform.architecture()))
        self.add_property(
            Property('python_version', _(u'Python version'),
                     platform.python_version()))
        self.add_property(Property('hostname', _(u'Hostname'),
                                   platform.node()))
        self.add_property(Property('platform', _(u'Platform'), sys.platform))
        self.add_property(
            Property('machine', _(u'Machine'), platform.machine()))
        self.add_property(
            Property('processor', _(u'Processor'), platform.processor()))
        self.add_property(
            Property('cpus', _(u'Number of CPUs'), psutil.NUM_CPUS))
        self.add_property(
            Property('total_phymem', _(u'Total physical memory'),
                     pretty_size(psutil.TOTAL_PHYMEM)))
        self.add_property(
            Property(
                'disk_partitions', _(u'Disk partitions'), '; '.join([
                    '%s %s %s %s' % (partition.device, partition.mountpoint,
                                     partition.fstype, partition.opts)
                    for partition in psutil.disk_partitions()
                ])))

        try:
            self.add_property(
                Property('tesseract', _(u'tesseract version'),
                         pbs.tesseract('-v').stderr))
        except pbs.CommandNotFound:
            self.add_property(
                Property('tesseract', _(u'tesseract version'),
                         _(u'not found')))

        try:
            self.add_property(
                Property('unpaper', _(u'unpaper version'),
                         pbs.unpaper('-V').stdout))
        except pbs.CommandNotFound:
            self.add_property(
                Property('unpaper', _(u'unpaper version'), _(u'not found')))
Exemplo n.º 5
0
    def set_properties(self):
        self._properties = SortedDict()
        if LSB:
            self.add_property(Property('is_lsb', _(u'LSB OS'), True))
            self.add_property(Property('distributor_id', _(u'Distributor ID'), lsb_release('-i', '-s')))
            self.add_property(Property('description', _(u'Description'), lsb_release('-d', '-s')))
            self.add_property(Property('release', _(u'Release'), lsb_release('-r', '-s')))
            self.add_property(Property('codename', _(u'Codename'), lsb_release('-c', '-s')))
            self.add_property(Property('sysinfo', _(u'System info'), uname('-a')))
        else:
            self.add_property(Property('is_lsb', _(u'LSB OS'), False))

        self.add_property(Property('architecture', _(u'OS architecture'), platform.architecture()))
        self.add_property(Property('python_version', _(u'Python version'), platform.python_version()))
        self.add_property(Property('hostname', _(u'Hostname'), platform.node()))
        self.add_property(Property('platform', _(u'Platform'), sys.platform))
        self.add_property(Property('machine', _(u'Machine'), platform.machine()))
        self.add_property(Property('processor', _(u'Processor'), platform.processor()))
        self.add_property(Property('cpus', _(u'Number of CPUs'), psutil.NUM_CPUS))
        self.add_property(Property('total_phymem', _(u'Total physical memory'), pretty_size(psutil.TOTAL_PHYMEM)))
        self.add_property(Property('disk_partitions', _(u'Disk partitions'), '; '.join(['%s %s %s %s' % (partition.device, partition.mountpoint, partition.fstype, partition.opts) for partition in psutil.disk_partitions()])))

        tesseract = pbs.Command(TESSERACT_PATH)
        try:
            self.add_property(Property('tesseract', _(u'tesseract version'), tesseract('-v').stderr))
        except pbs.CommandNotFound:
            self.add_property(Property('tesseract', _(u'tesseract version'), _(u'not found')))
        except Exception:
            self.add_property(Property('tesseract', _(u'tesseract version'), _(u'error getting version')))

        unpaper = pbs.Command(UNPAPER_PATH)
        try:
            self.add_property(Property('unpaper', _(u'unpaper version'), unpaper('-V').stdout))
        except pbs.CommandNotFound:
            self.add_property(Property('unpaper', _(u'unpaper version'), _(u'not found')))
        except Exception:
            self.add_property(Property('unpaper', _(u'unpaper version'), _(u'error getting version')))

        pdftotext = pbs.Command(PDFTOTEXT_PATH)
        try:
            self.add_property(Property('pdftotext', _(u'pdftotext version'), pdftotext('-v').stderr))
        except pbs.CommandNotFound:
            self.add_property(Property('pdftotext', _(u'pdftotext version'), _(u'not found')))
        except Exception:
            self.add_property(Property('pdftotext', _(u'pdftotext version'), _(u'error getting version')))

        self.add_property(Property('mayan_version', _(u'Mayan EDMS version'), mayan_version))
        self.add_property(Property('fabfile', _(u'Installed via fabfile'), os.path.exists(FABFILE_MARKER)))

        try:
            repo = Repo(settings.PROJECT_ROOT)
        except:
            self.add_property(Property('is_git_repo', _(u'Running from a Git repository'), False))
        else:
            repo.config_reader()
            headcommit = repo.head.commit
            self.add_property(Property('is_git_repo', _(u'Running from a Git repository'), True))
            self.add_property(Property('repo_remotes', _(u'Repository remotes'), ', '.join([unicode(remote) for remote in repo.remotes])))
            self.add_property(Property('repo_remotes_urls', _(u'Repository remotes URLs'), ', '.join([unicode(remote.url) for remote in repo.remotes])))
            self.add_property(Property('repo_head_reference', _(u'Branch'), repo.head.reference))
            self.add_property(Property('headcommit_hexsha', _(u'HEAD commit hex SHA'), headcommit.hexsha))
            self.add_property(Property('headcommit_author', _(u'HEAD commit author'), headcommit.author))
            self.add_property(Property('headcommit_authored_date', _(u'HEAD commit authored date'), time.asctime(time.gmtime(headcommit.authored_date))))
            self.add_property(Property('headcommit_committer', _(u'HEAD commit committer'), headcommit.committer))
            self.add_property(Property('headcommit_committed_date', _(u'HEAD commit committed date'), time.asctime(time.gmtime(headcommit.committed_date))))
            self.add_property(Property('headcommit_message', _(u'HEAD commit message'), headcommit.message))