diff --git a/README.rst b/README.rst index be0040b..f63edf8 100644 --- a/README.rst +++ b/README.rst @@ -15,6 +15,7 @@ DEPENDENCIES - setuptools - tornado, > 3.1 - pyinotify, tested with 0.9.4 +- pyalpm, tested with 0.10.6 NOTE ==== diff --git a/archrepo2/lib/archpkg.py b/archrepo2/lib/archpkg.py index f2f9aee..b0bdaf9 100644 --- a/archrepo2/lib/archpkg.py +++ b/archrepo2/lib/archpkg.py @@ -2,24 +2,16 @@ import os from collections import namedtuple import subprocess import re -from typing import Tuple, List, Dict +from typing import List, Dict -from pkg_resources import parse_version as _parse_version -from packaging.version import Version # type: ignore - -def parse_arch_version(v: str) -> Tuple[int, Version]: - if ':' in v: - epoch = int(v.split(':', 1)[0]) - else: - epoch = 0 - return epoch, _parse_version(v) +from pyalpm import vercmp class PkgNameInfo(namedtuple('PkgNameInfo', 'name, version, release, arch')): def __lt__(self, other) -> bool: if self.name != other.name or self.arch != other.arch: return NotImplemented if self.version != other.version: - return parse_arch_version(self.version) < parse_arch_version(other.version) + return vercmp(self.version, other.version) < 0 return float(self.release) < float(other.release) def __gt__(self, other) -> bool: diff --git a/setup.py b/setup.py index eb6fdb4..9860ded 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name = 'archrepo2', version = archrepo2.__version__, packages = find_packages(), - install_requires = ['tornado>2.4.1', 'pyinotify', 'setuptools'], + install_requires = ['tornado>2.4.1', 'pyinotify', 'pyalpm'], entry_points = { 'console_scripts': [ 'archreposrv = archrepo2.archreposrv:main',