diff options
author | Henrik Riomar <henrik.riomar@gmail.com> | 2020-10-24 20:44:26 +0200 |
---|---|---|
committer | Leo <thinkabit.ukim@gmail.com> | 2020-10-24 23:09:28 +0000 |
commit | 9c1524ecbc08f629562afb6194a817ee9fb4d1e7 (patch) | |
tree | 4fc4589fa4be76e3a54a1d87f3678af3a7d9c6d3 | |
parent | 55c34d996504e25c128f1eaf1e27e5047317ec25 (diff) |
main/rdiff-backup: get version with importlib-metadata
If py3-setuptools is not installed 'rdiff-backup --version' will just report
DEV, this adds py3-importlib-metadata as an option to installing py3-setuptools.
-rw-r--r-- | main/rdiff-backup/0001-Resolve-runtime-dependency-on-setuptools-to-get-vers.patch | 147 | ||||
-rw-r--r-- | main/rdiff-backup/APKBUILD | 9 |
2 files changed, 153 insertions, 3 deletions
diff --git a/main/rdiff-backup/0001-Resolve-runtime-dependency-on-setuptools-to-get-vers.patch b/main/rdiff-backup/0001-Resolve-runtime-dependency-on-setuptools-to-get-vers.patch new file mode 100644 index 00000000000..475c67c0c1d --- /dev/null +++ b/main/rdiff-backup/0001-Resolve-runtime-dependency-on-setuptools-to-get-vers.patch @@ -0,0 +1,147 @@ +From e5d1fc3d706315e80bb1a8b8b6960a827475408b Mon Sep 17 00:00:00 2001 +From: Eric L <ericzolf@users.noreply.github.com> +Date: Tue, 28 Jul 2020 07:12:46 +0200 +Subject: [PATCH] Resolve runtime dependency on setuptools to get version + (#427) + +CHG: depend on importlib-metadata instead of setuptools to get rdiff-backup veersion, closes #418 +--- + README.md | 4 +++- + docs/DEVELOP.md | 3 ++- + setup.py | 2 +- + src/rdiff_backup/Globals.py | 19 +++++++++++++++---- + tools/build_wheels.sh | 2 ++ + tox.ini | 2 +- + tox_root.ini | 2 +- + tox_slow.ini | 2 +- + 8 files changed, 26 insertions(+), 10 deletions(-) + +diff --git a/README.md b/README.md +index 4997513..7b52d8f 100644 +--- a/README.md ++++ b/README.md +@@ -125,9 +125,11 @@ sudo pip3 install rdiff-backup + You need to make sure that the following requirements are met: + + * Python 3.5 or higher +-* librsync 1.0.0 ++* librsync 1.0.0 or higher + * pylibacl (optional, to support ACLs) + * pyxattr (optional, to support extended attributes) - the xattr library (without py) isn't regularly tested but should work and you will be helped ++* if Python's version is 3.7.x or below, importlib-metadata 1.x ++ (or alternatively setuptools) + * SSH for remote operations + + ``` +diff --git a/docs/DEVELOP.md b/docs/DEVELOP.md +index accc5dc..12b1156 100644 +--- a/docs/DEVELOP.md ++++ b/docs/DEVELOP.md +@@ -136,7 +136,8 @@ The same pre-requisites as for the installation of rdiff-backup also apply for b + * librsync 1.0.0 or higher + * pylibacl (optional, to support ACLs) + * pyxattr (optional, to support extended attributes) - even if the xattr library (without py) isn't part of our CI/CD pipeline, feel free to use it for your development +-* python3-setuptools (for a proper version instead of DEV) ++* if Python's version is 3.7.x or below, importlib-metadata 1.x ++ (or alternatively setuptools) + + Additionally are following pre-requisites needed: + +diff --git a/setup.py b/setup.py +index f1d41fd..6e1bb10 100755 +--- a/setup.py ++++ b/setup.py +@@ -222,6 +222,6 @@ setup( + 'build_py': build_py, + 'clean': clean, + }, +- install_requires=['setuptools'], ++ install_requires=['importlib-metadata ~= 1.0 ; python_version < "3.8"'], + setup_requires=['setuptools_scm'], + ) +diff --git a/src/rdiff_backup/Globals.py b/src/rdiff_backup/Globals.py +index caad32c..2843630 100644 +--- a/src/rdiff_backup/Globals.py ++++ b/src/rdiff_backup/Globals.py +@@ -24,11 +24,22 @@ from . import log + + # The current version of rdiff-backup + # Get it from package info or fall back to DEV version. ++# importlib/metadata is the new approach, pkg_resources the old one, kept for ++# compatibility reasons (and because importlib_metadata -for Python < 3.8- ++# isn't yet packaged for all distros). + try: +- import pkg_resources +- version = pkg_resources.get_distribution("rdiff-backup").version +-except BaseException: +- version = "DEV" ++ from importlib import metadata ++ version = metadata.version('rdiff-backup') ++except ImportError: ++ try: # the fallback library for Python below 3.8 ++ import importlib_metadata as metadata ++ version = metadata.version('rdiff-backup') ++ except ImportError: ++ try: # the old method requiring setuptools to be installed ++ import pkg_resources ++ version = pkg_resources.get_distribution("rdiff-backup").version ++ except BaseException: # if everything else fails... ++ version = "DEV-no-metadata" + + # If this is set, use this value in seconds as the current time + # instead of reading it from the clock. +diff --git a/tools/build_wheels.sh b/tools/build_wheels.sh +index 5efe343..748cb69 100755 +--- a/tools/build_wheels.sh ++++ b/tools/build_wheels.sh +@@ -8,6 +8,8 @@ yum install -y librsync-devel + + # Compile wheels + for PYBIN in $pybindirs; do ++ "${PYBIN}/pip" install --user \ ++ 'importlib-metadata ~= 1.0 ; python_version < "3.8"' + "${PYBIN}/pip" wheel /io/ -w dist/ + done + +diff --git a/tox.ini b/tox.ini +index 59e2d06..91ce683 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -17,7 +17,7 @@ passenv = RDIFF_TEST_* RDIFF_BACKUP_* + setenv = + COVERAGE_FILE = {envlogdir}/coverage.sqlite + deps = +- setuptools ++ importlib-metadata ~= 1.0 ; python_version < "3.8" + pyxattr + pylibacl + coverage +diff --git a/tox_root.ini b/tox_root.ini +index cf79bb3..7cf5292 100644 +--- a/tox_root.ini ++++ b/tox_root.ini +@@ -20,7 +20,7 @@ isolated_build_env = .package.root + # or explicitly the RDIFF_* ones: + passenv = SUDO_USER SUDO_UID SUDO_GID RDIFF_TEST_* RDIFF_BACKUP_* + deps = +- setuptools ++ importlib-metadata ~= 1.0 ; python_version < "3.8" + pyxattr + pylibacl + #whitelist_externals = env +diff --git a/tox_slow.ini b/tox_slow.ini +index 64edd84..940fb1b 100644 +--- a/tox_slow.ini ++++ b/tox_slow.ini +@@ -12,7 +12,7 @@ envlist = py35, py36, py37, py38 + [testenv] + passenv = RDIFF_TEST_* RDIFF_BACKUP_* + deps = +- setuptools ++ importlib-metadata ~= 1.0 ; python_version < "3.8" + pyxattr + pylibacl + # whitelist_externals = +-- +2.29.1 + diff --git a/main/rdiff-backup/APKBUILD b/main/rdiff-backup/APKBUILD index d5ca9cdb764..2002d3a572b 100644 --- a/main/rdiff-backup/APKBUILD +++ b/main/rdiff-backup/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Jeremy Thomerson <jeremy@thomersonfamily.com> pkgname=rdiff-backup pkgver=2.0.5 -pkgrel=0 +pkgrel=1 pkgdesc="Reverse differential backup tool" options="!check" # Requires unpacakged 'xattr' url="https://rdiff-backup.net/" @@ -13,7 +13,9 @@ subpackages=" $pkgname-doc $pkgname-bash-completion:bashcomp:noarch " -source="https://github.com/rdiff-backup/rdiff-backup/releases/download/v$pkgver/rdiff-backup-$pkgver.tar.gz" +source="https://github.com/rdiff-backup/rdiff-backup/releases/download/v$pkgver/rdiff-backup-$pkgver.tar.gz + 0001-Resolve-runtime-dependency-on-setuptools-to-get-vers.patch + " build() { python3 setup.py build @@ -31,4 +33,5 @@ bashcomp() { amove usr/share/bash-completion } -sha512sums="59482e6d78bc887fc99efd4b4779e9b41c7e4b0427e51b80b18a550d0051e4213a0c200296154759d1734f511f7abe3175d171f018c59c55e5abdfd0a890cfbd rdiff-backup-2.0.5.tar.gz" +sha512sums="59482e6d78bc887fc99efd4b4779e9b41c7e4b0427e51b80b18a550d0051e4213a0c200296154759d1734f511f7abe3175d171f018c59c55e5abdfd0a890cfbd rdiff-backup-2.0.5.tar.gz +10788ac9ab17849e3f22a4fcfc9b7cd4ea528067591c00f58fb2f41fbb5773e904665d116d92f21fada4b18147e5d1eb31a042be011021a280e2cb87f6683ed0 0001-Resolve-runtime-dependency-on-setuptools-to-get-vers.patch" |