1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2024-12-21 23:33:13 +00:00

Remove pkg_resources use (#2098)

This commit is contained in:
Manu 2024-10-20 14:04:25 +01:00 committed by GitHub
parent 5dada30d9e
commit 0e8432602d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 28 additions and 31 deletions

View file

@ -30,7 +30,6 @@ a = Analysis([os.path.join(SRC_DIR, '__main__.py')],
'vorta.keyring.darwin',
'vorta.keyring.kwallet',
'vorta.keyring.secretstorage',
'pkg_resources.py2_warn',
],
hookspath=[],
runtime_hooks=[],

View file

@ -15,10 +15,7 @@ classifiers =
Operating System :: MacOS
Operating System :: POSIX
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3
Topic :: System :: Archiving :: Backup
Topic :: System :: Systems Administration
Topic :: Utilities
@ -37,17 +34,18 @@ package_dir =
include_package_data = true
python_requires = >=3.8
install_requires =
platformdirs >=3.0.0, <5.0.0; sys_platform == 'darwin' # for macOS: breaking changes in 3.0.0,
platformdirs >=2.6.0, <5.0.0; sys_platform != 'darwin' # for others: 2.6+ works consistently.
pyqt6
packaging
peewee
platformdirs >=2.6.0, <5.0.0; sys_platform != 'darwin' # for others: 2.6+ works consistently.
platformdirs >=3.0.0, <5.0.0; sys_platform == 'darwin' # for macOS: breaking changes in 3.0.0,
psutil
setuptools
secretstorage; sys_platform != 'darwin'
pyobjc-core < 10; sys_platform == 'darwin'
pyobjc-framework-Cocoa < 10; sys_platform == 'darwin'
pyobjc-framework-LaunchServices < 10; sys_platform == 'darwin'
pyobjc-framework-CoreWLAN < 10; sys_platform == 'darwin'
pyobjc-framework-LaunchServices < 10; sys_platform == 'darwin'
pyqt6
secretstorage; sys_platform != 'darwin'
setuptools
tests_require =
pytest
pytest-qt
@ -97,7 +95,7 @@ extension-pkg-whitelist=PyQt6
load-plugins=
[pylint.messages control]
disable= W0503,W0511,C0301,R0903,R0201,W0212,C0114,C0115,C0116,C0103,E0611,E1120,C0415,R0914,R0912,R0915
disable= W0511,C0301,R0903,W0212,C0114,C0115,C0116,C0103,E0611,E1120,C0415,R0914,R0912,R0915
[pylint.format]
max-line-length=120

View file

@ -1,13 +1,13 @@
from pkg_resources import parse_version
from packaging.version import Version
MIN_BORG_FOR_FEATURE = {
'BLAKE2': parse_version('1.1.4'),
'ZSTD': parse_version('1.1.4'),
'JSON_LOG': parse_version('1.1.0'),
'DIFF_JSON_LINES': parse_version('1.1.16'),
'COMPACT_SUBCOMMAND': parse_version('1.2.0a1'),
'V122': parse_version('1.2.2'),
'V2': parse_version('2.0.0b10'),
"BLAKE2": Version("1.1.4"),
"ZSTD": Version("1.1.4"),
"JSON_LOG": Version("1.1.0"),
"DIFF_JSON_LINES": Version("1.1.16"),
"COMPACT_SUBCOMMAND": Version("1.2.0a1"),
"V122": Version("1.2.2"),
"V2": Version("2.0.0b10"),
# add new version-checks here.
}
@ -19,12 +19,12 @@ class BorgCompatibility:
to customize Borg commands by version in the future.
"""
version = '1.1.0'
path = ''
version = "1.1.0"
path = ""
def set_version(self, version, path):
self.version = version
self.path = path
def check(self, feature_name):
return parse_version(self.version) >= MIN_BORG_FOR_FEATURE[feature_name]
return Version(self.version) >= MIN_BORG_FOR_FEATURE[feature_name]

View file

@ -2,8 +2,8 @@
import subprocess
import pytest
from packaging.version import Version
from peewee import SqliteDatabase
from pkg_resources import parse_version
import vorta
import vorta.application
@ -45,7 +45,7 @@ def borg_version():
# test window does not automatically set borg version
borg_compat.set_version(borg_version, borg_compat.path)
parsed_borg_version = parse_version(borg_version)
parsed_borg_version = Version(borg_version)
return borg_version, parsed_borg_version
@ -54,7 +54,7 @@ def create_test_repo(tmpdir_factory, borg_version):
repo_path = tmpdir_factory.mktemp('repo')
source_files_dir = tmpdir_factory.mktemp('borg_src')
is_borg_v2 = borg_version[1] >= parse_version('2.0.0b1')
is_borg_v2 = borg_version[1] >= Version('2.0.0b1')
if is_borg_v2:
subprocess.run(['borg', '-r', str(repo_path), 'rcreate', '--encryption=none'], check=True)
@ -225,7 +225,7 @@ def min_borg_version(borg_version, request):
if request.node.get_closest_marker('min_borg_version'):
parsed_borg_version = borg_version[1]
if parsed_borg_version < parse_version(request.node.get_closest_marker('min_borg_version').args[0]):
if parsed_borg_version < Version(request.node.get_closest_marker('min_borg_version').args[0]):
pytest.skip(
'skipped due to borg version requirement for test: {}'.format(
request.node.get_closest_marker('min_borg_version').args[0]

View file

@ -3,7 +3,7 @@
"""
import pytest
from pkg_resources import parse_version
from packaging.version import Version
import vorta.borg
import vorta.utils
@ -343,7 +343,7 @@ def test_archive_diff_lines(
):
"""Test that the diff lines are parsed correctly for supported borg versions"""
parsed_borg_version = borg_version[1]
supports_fifo = parsed_borg_version > parse_version("1.1.18")
supports_fifo = parsed_borg_version > Version("1.1.18")
supports_chrdev = create_test_repo[2]
params = BorgDiffJob.prepare(
@ -372,8 +372,8 @@ def test_archive_diff_lines(
item
for item in expected
if (
("min_version" not in item or parse_version(item["min_version"]) <= parsed_borg_version)
and ("max_version" not in item or parse_version(item["max_version"]) >= parsed_borg_version)
("min_version" not in item or Version(item["min_version"]) <= parsed_borg_version)
and ("max_version" not in item or Version(item["max_version"]) >= parsed_borg_version)
and (item["data"]["file_type"] != FileType.FIFO or supports_fifo)
and (item["data"]["file_type"] != FileType.CHRDEV or supports_chrdev)
)