From 668822df6c013cb0b05398104f702d201abe392b Mon Sep 17 00:00:00 2001 From: William Douglas Date: Tue, 19 Oct 2021 12:01:14 -0700 Subject: [PATCH] Add pypi module version overrides Enable selectively removing version dependencies for a given set of python modules. The motiviation for this change is to avoid breaking package builds when there are packages that often lag pypi in updating their max version requirements. Signed-off-by: William Douglas --- README.rst | 14 ++++++++++++++ autospec/config.py | 3 +++ autospec/specfiles.py | 2 ++ 3 files changed, 19 insertions(+) diff --git a/README.rst b/README.rst index 6de140c..fe63845 100644 --- a/README.rst +++ b/README.rst @@ -324,6 +324,20 @@ series 0001-my-awesome-patch.patch -d some/subdir -p1 ``` +pypi_overrides + This file contains a list of modules to remove version tests on during the + build. It also modifies the requirement of the requires.txt egg if it + exists in the package. For example: + + ``` + colorama + ``` + in the file will cause this modification: + ``` + - 'colorama>=0.2.5,<0.4.4', + + 'colorama', + ``` + golang_libpath When building go packages, the go import path will be guessed automatically (e.g. building ``https://github.com/go-yaml/yaml/`` would get diff --git a/autospec/config.py b/autospec/config.py index ae3e50a..7a2e2c3 100644 --- a/autospec/config.py +++ b/autospec/config.py @@ -96,6 +96,7 @@ class Config(object): self.install_append = [] self.service_restart = [] self.patches = [] + self.pypi_overrides = [] self.verpatches = OrderedDict() self.extra_sources = [] self.autoreconf = False @@ -891,6 +892,8 @@ class Config(object): self.config_opts['security_sensitive'] = True self.rewrite_config_opts() + self.pypi_overrides += self.read_conf_file(os.path.join(self.download_path, "pypi_overrides")) + content = self.read_conf_file(os.path.join(self.download_path, "configure")) self.extra_configure = " \\\n".join(content) diff --git a/autospec/specfiles.py b/autospec/specfiles.py index 937be5b..fdc9a04 100644 --- a/autospec/specfiles.py +++ b/autospec/specfiles.py @@ -1363,6 +1363,8 @@ class Specfile(object): self._write_strip("export MAKEFLAGS=%{?_smp_mflags}") if self.config.subdir: self._write_strip("pushd " + self.config.subdir) + for module in self.config.pypi_overrides: + self._write_strip(f"pypi-dep-fix.py . {module}") self._write_strip("python3 setup.py build " + self.config.extra_configure) self._write_strip("\n") if self.tests_config and not self.config.config_opts['skip_tests']: