mirror of
https://github.com/lilydjwg/archrepo2.git
synced 2025-03-10 12:02:43 +00:00
commit
fa4f743045
3 changed files with 5 additions and 12 deletions
|
@ -15,6 +15,7 @@ DEPENDENCIES
|
||||||
- setuptools
|
- setuptools
|
||||||
- tornado, > 3.1
|
- tornado, > 3.1
|
||||||
- pyinotify, tested with 0.9.4
|
- pyinotify, tested with 0.9.4
|
||||||
|
- pyalpm, tested with 0.10.6
|
||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
====
|
====
|
||||||
|
|
|
@ -2,24 +2,16 @@ import os
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
from typing import Tuple, List, Dict
|
from typing import List, Dict
|
||||||
|
|
||||||
from pkg_resources import parse_version as _parse_version
|
from pyalpm import vercmp
|
||||||
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)
|
|
||||||
|
|
||||||
class PkgNameInfo(namedtuple('PkgNameInfo', 'name, version, release, arch')):
|
class PkgNameInfo(namedtuple('PkgNameInfo', 'name, version, release, arch')):
|
||||||
def __lt__(self, other) -> bool:
|
def __lt__(self, other) -> bool:
|
||||||
if self.name != other.name or self.arch != other.arch:
|
if self.name != other.name or self.arch != other.arch:
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
if self.version != other.version:
|
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)
|
return float(self.release) < float(other.release)
|
||||||
|
|
||||||
def __gt__(self, other) -> bool:
|
def __gt__(self, other) -> bool:
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -7,7 +7,7 @@ setup(
|
||||||
name = 'archrepo2',
|
name = 'archrepo2',
|
||||||
version = archrepo2.__version__,
|
version = archrepo2.__version__,
|
||||||
packages = find_packages(),
|
packages = find_packages(),
|
||||||
install_requires = ['tornado>2.4.1', 'pyinotify', 'setuptools'],
|
install_requires = ['tornado>2.4.1', 'pyinotify', 'pyalpm'],
|
||||||
entry_points = {
|
entry_points = {
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
'archreposrv = archrepo2.archreposrv:main',
|
'archreposrv = archrepo2.archreposrv:main',
|
||||||
|
|
Loading…
Add table
Reference in a new issue