termux-packages/packages/borgbackup/use-distutils.patch
2021-07-26 13:25:08 +03:00

130 lines
4.4 KiB
Diff

From a90b4d665e6145f7d10535ec77510ba7f04f7515 Mon Sep 17 00:00:00 2001
From: Leonid Pliushch <leonid.pliushch@gmail.com>
Date: Mon, 26 Jul 2021 13:11:32 +0300
Subject: [PATCH] Termux borgbackup: use distutils instead of packaging
Do not remove this patch unless you know what you are doing!
We don't have module "packaging" packaged and thus cannot use it without
installing through "pip". But for stable packages we cannot use it in
postinst script to add missing dependencies.
So if you decide to drop this patch:
* Add python3-packaging to termux-packages.
* Alternatively: create a postinst deb script (pip3 install packaging)
and move borgbackup to https://github.com/termux/unstable-packages
---
setup.py | 21 +++++++--------------
src/borg/__init__.py | 5 ++---
src/borg/xattr.py | 6 +++---
3 files changed, 12 insertions(+), 20 deletions(-)
diff --git a/setup.py b/setup.py
index 7ad8f814..526757ed 100644
--- a/setup.py
+++ b/setup.py
@@ -11,8 +11,9 @@
multiprocessing = None
from setuptools.command.build_ext import build_ext
-from setuptools import setup, find_packages, Extension, Command
+from setuptools import setup, find_packages, Extension
from setuptools.command.sdist import sdist
+from distutils.command.clean import clean
try:
from Cython.Build import cythonize
@@ -70,7 +71,6 @@
# Please note:
# using any other version is not supported by borg development and
# any feedback related to issues caused by this will be ignored.
- 'packaging',
]
# note for package maintainers: if you package borgbackup for distribution,
@@ -137,16 +137,9 @@ def rm(file):
pass
-class Clean(Command):
- user_options = []
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
+class Clean(clean):
def run(self):
+ super().run()
for source in cython_sources:
genc = source.replace('.pyx', '.c')
rm(genc)
@@ -160,7 +153,7 @@ def run(self):
'build_usage': setup_docs.build_usage,
'build_man': setup_docs.build_man,
'sdist': Sdist,
- 'clean2': Clean,
+ 'clean': Clean,
}
ext_modules = []
@@ -227,8 +220,8 @@ def members_appended(*ds):
# sometimes there's no need to cythonize
# this breaks chained commands like 'clean sdist'
- cythonizing = len(sys.argv) > 1 and sys.argv[1] not in (
- ('clean', 'clean2', 'egg_info', '--help-commands', '--version')) and '--help' not in sys.argv[1:]
+ cythonizing = len(sys.argv) > 1 and sys.argv[1] not in ('clean', 'egg_info', '--help-commands', '--version') \
+ and '--help' not in sys.argv[1:]
if cythonize and cythonizing:
cython_opts = dict(
diff --git a/src/borg/__init__.py b/src/borg/__init__.py
index 9f13c7d6..47adb1b6 100644
--- a/src/borg/__init__.py
+++ b/src/borg/__init__.py
@@ -1,12 +1,11 @@
-from packaging.version import parse as parse_version
+from distutils.version import LooseVersion
# IMPORTANT keep imports from borg here to a minimum because our testsuite depends on
# being able to import borg.constants and then monkey patching borg.constants.PBKDF2_ITERATIONS
from ._version import version as __version__
-_v = parse_version(__version__)
-__version_tuple__ = _v._version.release
+__version_tuple__ = tuple(LooseVersion(__version__).version[:3])
# assert that all semver components are integers
# this is mainly to show errors when people repackage poorly
diff --git a/src/borg/xattr.py b/src/borg/xattr.py
index a2039ebb..dd412edd 100644
--- a/src/borg/xattr.py
+++ b/src/borg/xattr.py
@@ -7,7 +7,7 @@
import sys
import tempfile
-from packaging.version import parse as parse_version
+from distutils.version import LooseVersion
from .helpers import prepare_subprocess_env
@@ -29,8 +29,8 @@
if preload.startswith("libfakeroot"):
env = prepare_subprocess_env(system=True)
fakeroot_output = subprocess.check_output(['fakeroot', '-v'], env=env)
- fakeroot_version = parse_version(fakeroot_output.decode('ascii').split()[-1])
- if fakeroot_version >= parse_version("1.20.2"):
+ fakeroot_version = LooseVersion(fakeroot_output.decode('ascii').split()[-1])
+ if fakeroot_version >= LooseVersion("1.20.2"):
# 1.20.2 has been confirmed to have xattr support
# 1.18.2 has been confirmed not to have xattr support
# Versions in-between are unknown
--
2.30.2