コード例 #1
0
ファイル: controller.py プロジェクト: jayvdb/bauh
 def list_updates(self, internet_available: bool) -> List[PackageUpdate]:
     installed = self.read_installed(
         disk_loader=None, internet_available=internet_available).installed
     return [
         PackageUpdate(p.id, p.latest_version, 'aur') for p in installed
         if p.update
     ]
コード例 #2
0
    def list_updates(self, internet_available: bool) -> List[PackageUpdate]:
        updates = []
        installed = self.read_installed(
            None, internet_available=internet_available).installed

        to_update = [
            p for p in installed if p.update and not p.is_update_ignored()
        ]

        if to_update:
            loaders = []

            for app in to_update:
                if app.is_application():
                    loader = FlatpakUpdateLoader(
                        app=app, http_client=self.context.http_client)
                    loader.start()
                    loaders.append(loader)

            for loader in loaders:
                loader.join()

            for app in to_update:
                updates.append(
                    PackageUpdate(pkg_id='{}:{}:{}'.format(
                        app.id, app.branch, app.installation),
                                  pkg_type='Flatpak',
                                  name=app.name,
                                  version=app.version))

        return updates
コード例 #3
0
    def list_updates(self, internet_available: bool) -> List[PackageUpdate]:
        res = self.read_installed(disk_loader=None, internet_available=internet_available)

        updates = []
        if res.installed:
            for app in res.installed:
                if app.update and not app.is_update_ignored():
                    updates.append(PackageUpdate(pkg_id=app.name, pkg_type='AppImage', version=app.latest_version, name=app.name))

        return updates
コード例 #4
0
ファイル: controller.py プロジェクト: vinifmor/bauh
    def list_updates(self, internet_available: bool) -> List[PackageUpdate]:
        updates = []
        installed = self.read_installed(None, internet_available=internet_available, wait_async_data=True).installed

        if installed:
            for p in installed:
                if isinstance(p, FlatpakApplication) and p.update and not p.is_update_ignored():
                    updates.append(PackageUpdate(pkg_id=f'{p.id}:{p.branch}:{p.installation}',
                                                 pkg_type='Flatpak',
                                                 name=p.name,
                                                 version=p.latest_version))

        return updates
コード例 #5
0
ファイル: controller.py プロジェクト: vinifmor/bauh
    def list_updates(self, internet_available: bool) -> List[PackageUpdate]:
        ignored_updates = set()
        fill_ignored_updates = Thread(target=self._fill_ignored_updates, args=(ignored_updates,))
        fill_ignored_updates.start()

        updates = list()
        for name, version in self.aptitude.read_updates():
            if fill_ignored_updates.is_alive():
                fill_ignored_updates.join()

            if name not in ignored_updates:
                updates.append(PackageUpdate(pkg_id=name, name=name, version=version, pkg_type='debian'))

        return updates
コード例 #6
0
def list_updates(logger: logging.Logger) -> List[PackageUpdate]:
    cli_path = get_cli_path()
    if cli_path:
        output = run_cmd('{} updates -f json'.format(cli_path))

        if output:
            return [
                PackageUpdate(pkg_id=o['id'],
                              name=o['name'],
                              version=o['version'],
                              pkg_type=o['type']) for o in json.loads(output)
            ]
        else:
            logger.info("No updates found")

    else:
        logger.warning('bauh-cli seems not to be installed')

    return []
コード例 #7
0
def list_updates(logger: logging.Logger) -> List[PackageUpdate]:
    if os.path.exists(CLI_PATH):
        output = run_cmd('{} updates -f json'.format(CLI_PATH))

        if output:
            return [
                PackageUpdate(pkg_id=o['id'],
                              name=o['name'],
                              version=o['version'],
                              pkg_type=o['type']) for o in json.loads(output)
            ]
        else:
            logger.info("No updates found")

    else:
        logger.warning(
            'bauh-cli seems not to be installed ({})'.format(CLI_PATH))

    return []
コード例 #8
0
ファイル: systray.py プロジェクト: vinifmor/bauh
def list_updates(logger: logging.Logger) -> List[PackageUpdate]:
    cli_path = get_cli_path()
    if cli_path:
        exitcode, output = system.execute(f'{cli_path} updates -f json')

        if exitcode != 0:
            output_log = output.replace('\n', ' ') if output else ' '
            logger.warning(
                f'Command "{CLI_NAME} updates" returned an unexpected exitcode ({exitcode}). Output: {output_log}'
            )
        elif output:
            return [
                PackageUpdate(pkg_id=o['id'],
                              name=o['name'],
                              version=o['version'],
                              pkg_type=o['type']) for o in json.loads(output)
            ]
        else:
            logger.info("No updates found")

    else:
        logger.warning(f'"{CLI_NAME}" seems not to be installed')

    return []
コード例 #9
0
ファイル: test_model.py プロジェクト: vinifmor/bauh
 def test__hash__return_same_hash_for_equal_packages(self):
     a = PackageUpdate(pkg_id='a', name='b', version='c', pkg_type='d')
     b = PackageUpdate(pkg_id='a', name='b', version='c', pkg_type='d')
     self.assertEqual(a, b)
     self.assertEqual(hash(a), hash(b))