From e4c98626fa0306b723719539d3214e829f9b2d76 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 9 Jan 2020 16:19:54 +0100 Subject: Start working on actors --- dlpcvp.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/dlpcvp.py b/dlpcvp.py index 259a891..4ea8b55 100755 --- a/dlpcvp.py +++ b/dlpcvp.py @@ -13,6 +13,7 @@ from distutils.version import LooseVersion from typing import Iterable, List, Optional, Tuple, Union from urllib.error import URLError, HTTPError from urllib.request import Request, urlopen +import thespian # PyPI API documentation https://warehouse.readthedocs.io/api-reference/ PyPI_base = "https://pypi.org/pypi/{}/json" @@ -278,6 +279,11 @@ def package_version(proj: str, pkgn: str, return None +class SUSEPkgVerifier(thespian.actors.Actor): + def receiveMessage(self, message, sender): + pass + + def main(prj): db_name = osp.splitext(osp.basename(osp.realpath(__file__)))[0] + ".db" to_be_upgraded = [] # type: List[Tuple[str, LooseVersion, LooseVersion]] @@ -288,7 +294,7 @@ def main(prj): conn.execute(TB_CREATE_IDX) for pkg in suse_packages(prj): - log.debug(f'pkg = {pkg}') + log.debug('pkg = %s', pkg) print(pkg[0], file=sys.stderr, end='', flush=True) if pkg.startswith('python-'): pypi_name = pkg[CUTCHARS:] @@ -302,7 +308,7 @@ def main(prj): if pypi_ver is None: raise RuntimeError('not in PyPI') except RuntimeError as ex: - log.warning(f'Package {pkg} cannot be found: {ex}') + log.warning('Package %s cannot be found: %s', pkg, ex) continue except URLError as ex: log.warning( @@ -314,8 +320,8 @@ def main(prj): if pypi_ver > suse_ver: to_be_upgraded.append((pkg, suse_ver, pypi_ver)) except TypeError: - log.warning(f'{pkg} pypi_ver = {pypi_ver}') - log.warning(f'{pkg} suse_ver = {suse_ver}') + log.warning('%s pypi_ver = %s', pkg, pypi_ver) + log.warning('%s suse_ver = %s', pkg, suse_ver) continue else: missing_on_PyPI.append(pkg) @@ -323,7 +329,7 @@ def main(prj): sys.stdout.flush() if missing_on_PyPI: print("\nThese packages don't seem to be available on PyPI:") - print("{}\n".format('\n'.join(missing_on_PyPI))) + print('{}\n'.format('\n'.join(missing_on_PyPI))) if to_be_upgraded: print('These packages need to be upgraded:') -- cgit