termux-packages/packages/borgbackup/use-distutils.patch

106 lines
3.3 KiB
Diff

From 2ae2e3a15fa3e361b5f2e186d2450a8ccd38f698 Mon Sep 17 00:00:00 2001
From: Leonid Pliushch <leonid.pliushch@gmail.com>
Date: Mon, 26 Jul 2021 13:30:08 +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 | 24 ++++++++----------------
src/borg/__init__.py | 5 ++---
src/borg/xattr.py | 6 +++---
3 files changed, 13 insertions(+), 22 deletions(-)
diff --git a/setup.py b/setup.py
index 87e93d25..5ca79af2 100644
--- a/setup.py
+++ b/setup.py
@@ -10,9 +10,11 @@
except ImportError:
multiprocessing = None
-from setuptools.command.build_ext import build_ext
-from setuptools import setup, find_namespace_packages, Extension, Command
+from distutils.command.build_ext import build_ext
+from setuptools import setup, find_namespace_packages, Extension
from setuptools.command.sdist import sdist
+from distutils.core import Command
+from distutils.command.clean import clean
try:
from Cython.Build import cythonize
@@ -71,7 +73,6 @@
# using any other msgpack version is not supported by borg development and
# any feedback related to issues caused by this will be ignored.
'msgpack >=0.5.6, <=1.0.8, !=1.0.1',
- 'packaging',
]
# note for package maintainers: if you package borgbackup for distribution,
@@ -146,15 +147,8 @@
class Clean(Command):
- user_options = []
-
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
def run(self):
+ super().run()
for source in cython_sources:
genc = source.replace('.pyx', '.c')
rm(genc)
@@ -168,7 +162,7 @@
'build_usage': setup_docs.build_usage,
'build_man': setup_docs.build_man,
'sdist': Sdist,
- 'clean2': Clean,
+ 'clean': Clean,
}
ext_modules = []
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 f611a80a..8f77ab95 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 as parse_version
from .helpers import prepare_subprocess_env