[packages/brotli] - added py2 patch (restore setup.py compatibility with python2.7), cleanup

qboosh qboosh at pld-linux.org
Wed Nov 8 20:16:17 CET 2023


commit 45ad4c6f56509d588c9863e5c61c3a0add618c17
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Wed Nov 8 19:57:58 2023 +0100

    - added py2 patch (restore setup.py compatibility with python2.7), cleanup

 brotli-py2.patch | 20 ++++++++++++++++++++
 brotli.spec      | 16 ++++++++--------
 2 files changed, 28 insertions(+), 8 deletions(-)
---
diff --git a/brotli.spec b/brotli.spec
index 1d1d573..11e8ea7 100644
--- a/brotli.spec
+++ b/brotli.spec
@@ -1,8 +1,8 @@
 #
 # Conditional build:
-%bcond_with	python2		# Python 2 module
+%bcond_without	python2		# Python 2 module
 %bcond_without	python3		# Python 3 module
-%bcond_without	static_libs	# don't build static libraries
+%bcond_without	static_libs	# static libraries
 #
 Summary:	Brotli - generic-purpose lossless compression algorithm
 Summary(pl.UTF-8):	Brotli - algorytm bezstratnej kompresji ogólnego przeznaczenia
@@ -14,16 +14,13 @@ Group:		Libraries
 #Source0Download: https://github.com/google/brotli/releases
 Source0:	https://github.com/google/brotli/archive/v%{version}/Brotli-%{version}.tar.gz
 # Source0-md5:	3a6a3dba82a3604792d3cb0bd41bca60
-Patch0:		%{name}-pc.patch
+Patch0:		%{name}-py2.patch
 URL:		https://github.com/google/brotli/
-BuildRequires:	autoconf >= 2.61
-BuildRequires:	automake >= 1:1.7
 BuildRequires:	bc
 BuildRequires:	cmake >= 3.16
 BuildRequires:	libstdc++-devel >= 6:4.7
-BuildRequires:	libtool >= 2:2
-%{?with_python2:BuildRequires:	python-devel >= 2}
-%{?with_python3:BuildRequires:	python3-devel >= 1:3.2}
+%{?with_python2:BuildRequires:	python-devel >= 1:2.7}
+%{?with_python3:BuildRequires:	python3-devel >= 1:3.3}
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.714
 Requires:	libbrotli = %{version}-%{release}
@@ -113,9 +110,11 @@ Moduł Pythona 3 do kodowania/dekodowania kompresji Brotli.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 %cmake -B build
+
 %{__make} -C build
 
 %if %{with static_libs}
@@ -128,6 +127,7 @@ Moduł Pythona 3 do kodowania/dekodowania kompresji Brotli.
 %if %{with python2}
 %py_build
 %endif
+
 %if %{with python3}
 %py3_build
 %endif
diff --git a/brotli-py2.patch b/brotli-py2.patch
new file mode 100644
index 0000000..a6cc9d9
--- /dev/null
+++ b/brotli-py2.patch
@@ -0,0 +1,20 @@
+--- brotli-1.1.0/setup.py.orig	2023-08-29 13:00:29.000000000 +0200
++++ brotli-1.1.0/setup.py	2023-11-08 19:42:16.251391487 +0100
+@@ -27,7 +27,7 @@ def read_define(path, macro):
+   """ Return macro value from the given file. """
+   with open(path, 'r') as f:
+     for line in f:
+-      m = re.match(rf'#define\s{macro}\s+(.+)', line)
++      m = re.match(r'#define\s{macro}\s+(.+)'.format(macro=macro), line)
+       if m:
+         return m.group(1)
+   return ''
+@@ -41,7 +41,7 @@ def get_version():
+   patch = read_define(version_file_path, 'BROTLI_VERSION_PATCH')
+   if not major or not minor or not patch:
+     return ''
+-  return f'{major}.{minor}.{patch}'
++  return '{major}.{minor}.{patch}'.format(major=major, minor=minor, patch=patch)
+ 
+ 
+ def get_test_suite():
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/brotli.git/commitdiff/45ad4c6f56509d588c9863e5c61c3a0add618c17



More information about the pld-cvs-commit mailing list