Remove usage of python-packaging, minor fixes
This commit is contained in:
parent
63928cf9ee
commit
913a3c2f5c
2 changed files with 5 additions and 38 deletions
|
@ -47,8 +47,7 @@ The AUR Helper requires several things:
|
||||||
|
|
||||||
The `devtools` package is required.
|
The `devtools` package is required.
|
||||||
|
|
||||||
The `python-packaging` and `python-toml` packages are required for the Python
|
The `python-toml` package is required for the Python script to run.
|
||||||
script to run.
|
|
||||||
|
|
||||||
## Create the CHROOT
|
## Create the CHROOT
|
||||||
|
|
||||||
|
|
40
update.py
40
update.py
|
@ -6,7 +6,6 @@ import sys
|
||||||
import argparse
|
import argparse
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
from packaging import version
|
|
||||||
import atexit
|
import atexit
|
||||||
import glob
|
import glob
|
||||||
import toml
|
import toml
|
||||||
|
@ -147,58 +146,38 @@ class ArchPkgVersion:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
if isinstance(other, version.Version):
|
|
||||||
other = ArchPkgVersion(str(other))
|
|
||||||
|
|
||||||
if isinstance(other, ArchPkgVersion):
|
if isinstance(other, ArchPkgVersion):
|
||||||
return self.compare_with(other) == 0
|
return self.compare_with(other) == 0
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
if isinstance(other, version.Version):
|
|
||||||
other = ArchPkgVersion(str(other))
|
|
||||||
|
|
||||||
if isinstance(other, ArchPkgVersion):
|
if isinstance(other, ArchPkgVersion):
|
||||||
return self.compare_with(other) != 0
|
return self.compare_with(other) != 0
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
if isinstance(other, version.Version):
|
|
||||||
other = ArchPkgVersion(str(other))
|
|
||||||
|
|
||||||
if isinstance(other, ArchPkgVersion):
|
if isinstance(other, ArchPkgVersion):
|
||||||
return self.compare_with(other) < 0
|
return self.compare_with(other) < 0
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __le__(self, other):
|
def __le__(self, other):
|
||||||
if isinstance(other, version.Version):
|
|
||||||
other = ArchPkgVersion(str(other))
|
|
||||||
|
|
||||||
if isinstance(other, ArchPkgVersion):
|
if isinstance(other, ArchPkgVersion):
|
||||||
result = self.compare_with(other)
|
return self.compare_with(other) <= 0
|
||||||
return result <= 0
|
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __gt__(self, other):
|
def __gt__(self, other):
|
||||||
if isinstance(other, version.Version):
|
|
||||||
other = ArchPkgVersion(str(other))
|
|
||||||
|
|
||||||
if isinstance(other, ArchPkgVersion):
|
if isinstance(other, ArchPkgVersion):
|
||||||
return self.compare_with(other) > 0
|
return self.compare_with(other) > 0
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __ge__(self, other):
|
def __ge__(self, other):
|
||||||
if isinstance(other, version.Version):
|
|
||||||
other = ArchPkgVersion(str(other))
|
|
||||||
|
|
||||||
if isinstance(other, ArchPkgVersion):
|
if isinstance(other, ArchPkgVersion):
|
||||||
result = self.compare_with(other)
|
return self.compare_with(other) >= 0
|
||||||
return result >= 0
|
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -696,17 +675,6 @@ def get_pkgbuild_version(
|
||||||
return False, None, None, None
|
return False, None, None, None
|
||||||
|
|
||||||
|
|
||||||
def version_parse_checked(version_str: str):
|
|
||||||
try:
|
|
||||||
return version.parse(version_str)
|
|
||||||
except version.InvalidVersion:
|
|
||||||
self_version = ArchPkgVersion(version_str)
|
|
||||||
log_print(
|
|
||||||
f'WARNING: version.parse("{version_str}") failed to parse! Defaulting to self-defined version "{self_version}".'
|
|
||||||
)
|
|
||||||
return self_version
|
|
||||||
|
|
||||||
|
|
||||||
def get_srcinfo_check_result(
|
def get_srcinfo_check_result(
|
||||||
current_epoch: Union[str, None],
|
current_epoch: Union[str, None],
|
||||||
current_version: str,
|
current_version: str,
|
||||||
|
@ -755,8 +723,8 @@ def get_srcinfo_check_result(
|
||||||
elif (
|
elif (
|
||||||
pkgver is not None
|
pkgver is not None
|
||||||
and pkgrel is not None
|
and pkgrel is not None
|
||||||
and version_parse_checked(current_version)
|
and ArchPkgVersion(current_version)
|
||||||
< version_parse_checked(pkgver + "-" + pkgrel)
|
< ArchPkgVersion(pkgver + "-" + pkgrel)
|
||||||
):
|
):
|
||||||
log_print(
|
log_print(
|
||||||
'Current installed version of "{}" is out of date (older version).'.format(
|
'Current installed version of "{}" is out of date (older version).'.format(
|
||||||
|
|
Loading…
Reference in a new issue