mirror of
https://github.com/lilydjwg/archrepo2.git
synced 2025-03-10 12:02:43 +00:00
replace subprocess with pyalpm
This commit is contained in:
parent
9187984b6b
commit
668140131b
2 changed files with 3 additions and 5 deletions
|
@ -4,16 +4,14 @@ import subprocess
|
|||
import re
|
||||
from typing import List, Dict
|
||||
|
||||
from packaging.version import Version # type: ignore
|
||||
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:
|
||||
p = subprocess.Popen(["vercmp", self.version, other.version], stdout=subprocess.PIPE)
|
||||
output = p.stdout.read()
|
||||
return int(output) < 0
|
||||
return vercmp(self.version, other.version) < 0
|
||||
return float(self.release) < float(other.release)
|
||||
|
||||
def __gt__(self, other) -> bool:
|
||||
|
|
2
setup.py
2
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', 'setuptools'],
|
||||
entry_points = {
|
||||
'console_scripts': [
|
||||
'archreposrv = archrepo2.archreposrv:main',
|
||||
|
|
Loading…
Add table
Reference in a new issue