diff --git a/0001-Use-system-libhiredis.patch b/0001-Use-system-libhiredis.patch index da5d72f..47bfec2 100644 --- a/0001-Use-system-libhiredis.patch +++ b/0001-Use-system-libhiredis.patch @@ -9,17 +9,28 @@ Forwarded: no Last-Updated: 2022-01-15 Patch-Name: 0001-Use-system-libhiredis.patch --- - setup.py 2022-01-15 16:17:07.715728053 +0100 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/setup.py 2021-03-28 17:11:23.000000000 +0200 -+++ b/setup.py 2022-01-15 16:17:07.715728053 +0100 -@@ -13,7 +13,7 @@ def version(): - ext = Extension("hiredis.hiredis", - sources=sorted(glob.glob("src/*.c") + - ["vendor/hiredis/%s.c" % src for src in ("alloc", "read", "sds")]), -- include_dirs=["vendor"]) -+ extra_link_args=["-lhiredis"]) + setup.py | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) +--- a/setup.py ++++ b/setup.py +@@ -26,8 +26,7 @@ def get_linker_args(): + if 'win32' in sys.platform or 'darwin' in sys.platform: + return [] + else: +- return ["-Wl,-Bsymbolic", ] +- ++ return ["-Wl,-Bsymbolic", "-lhiredis"] + + def get_compiler_args(): + if 'win32' in sys.platform: +@@ -47,8 +46,7 @@ ext = Extension("hiredis.hiredis", + sources=get_sources(), + extra_compile_args=get_compiler_args(), + extra_link_args=get_linker_args(), +- libraries=get_libraries(), +- include_dirs=["vendor"]) ++ libraries=get_libraries()) + setup( - name="hiredis", + name="hiredis", diff --git a/159-sdsalloc-to-alloc.patch b/159-sdsalloc-to-alloc.patch new file mode 100644 index 0000000..797b90d --- /dev/null +++ b/159-sdsalloc-to-alloc.patch @@ -0,0 +1,42 @@ +From c2a20695aae53de7b5160e29675344df0b805fa6 Mon Sep 17 00:00:00 2001 +From: Maxim Cournoyer +Date: Sat, 18 Mar 2023 15:18:08 -0400 +Subject: [PATCH] pack: Replace sdsalloc.h with alloc.h + +Fixes #158. + +* src/pack.c: Replace sdsalloc.h with alloc.h. +(pack_command): Replace s_malloc with hi_malloc. +--- + src/pack.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/pack.c b/src/pack.c +index 443e9d3..23e4004 100644 +--- a/src/pack.c ++++ b/src/pack.c +@@ -16,7 +16,7 @@ extern sds sdscpylen(sds s, const char *t, size_t len); + extern sds sdsnewlen(const void *init, size_t initlen); + #endif + +-#include ++#include + + PyObject * + pack_command(PyObject *cmd) +@@ -32,7 +32,7 @@ pack_command(PyObject *cmd) + } + + Py_ssize_t tokens_number = PyTuple_Size(cmd); +- sds *tokens = s_malloc(sizeof(sds) * tokens_number); ++ sds *tokens = hi_malloc(sizeof(sds) * tokens_number); + if (tokens == NULL) + { + return PyErr_NoMemory(); +@@ -118,4 +118,4 @@ pack_command(PyObject *cmd) + sdsfreesplitres(tokens, tokens_number); + hi_free(lengths); + return result; +-} +\ No newline at end of file ++} diff --git a/drop-vendor-sources.patch b/drop-vendor-sources.patch index ff5ccba..a1e1ef2 100644 --- a/drop-vendor-sources.patch +++ b/drop-vendor-sources.patch @@ -1,16 +1,16 @@ --- setup.py | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) ---- a/setup.py 2022-01-15 16:32:39.379711369 +0100 -+++ b/setup.py 2022-01-15 16:33:03.091710944 +0100 -@@ -11,8 +11,7 @@ def version(): - return module.__version__ +--- a/setup.py ++++ b/setup.py +@@ -19,7 +19,7 @@ def version(): - ext = Extension("hiredis.hiredis", -- sources=sorted(glob.glob("src/*.c") + -- ["vendor/hiredis/%s.c" % src for src in ("alloc", "read", "sds")]), -+ sources=sorted(glob.glob("src/*.c")), - extra_link_args=["-lhiredis"]) + def get_sources(): + hiredis_sources = ("alloc", "async", "hiredis", "net", "read", "sds", "sockcompat") +- return sorted(glob.glob("src/*.c") + ["vendor/hiredis/%s.c" % src for src in hiredis_sources]) ++ return sorted(glob.glob("src/*.c")) - setup( + + def get_linker_args(): diff --git a/hiredis-2.0.0.tar.gz b/hiredis-2.0.0.tar.gz deleted file mode 100644 index f2d122e..0000000 --- a/hiredis-2.0.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:81d6d8e39695f2c37954d1011c0480ef7cf444d4e3ae24bc5e89ee5de360139a -size 75807 diff --git a/hiredis-2.2.2.tar.gz b/hiredis-2.2.2.tar.gz new file mode 100644 index 0000000..b765d46 --- /dev/null +++ b/hiredis-2.2.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c270bd0567a9c60673284e000132f603bb4ecbcd707567647a68f85ef45c4d4 +size 84086 diff --git a/python-hiredis.changes b/python-hiredis.changes index 08ee2c2..fdbeea0 100644 --- a/python-hiredis.changes +++ b/python-hiredis.changes @@ -1,3 +1,23 @@ +------------------------------------------------------------------- +Sat Mar 18 20:17:39 UTC 2023 - Matej Cepl + +- Update to 2.2.2: + - Reverting gcc -BSymbolic due to symbol collisions + - Add pack_command to support writing via hiredis-py + - Fixing broken windows builds on python < 3.8 + - Fix url in Issue tracker + - Restores publishing of source distribution + - Supporting hiredis 1.1.0 + - Modernizing: Restoring CI, Moving to pytest + - Adding LICENSE to Repository + - Python 3.11 trove, and links back to the project + - Integrating release drafter + - Implement pack_command that serializes redis-py command to + the RESP bytes object. + +- Add 159-sdsalloc-to-alloc.patch (gh#redis/hiredis-py#158), + which replaces use of sdsalloc with plain alloc. + ------------------------------------------------------------------- Sat Jan 15 15:37:17 UTC 2022 - Matthias Fehring diff --git a/python-hiredis.spec b/python-hiredis.spec index 25e8dc1..ff53af0 100644 --- a/python-hiredis.spec +++ b/python-hiredis.spec @@ -1,7 +1,7 @@ # # spec file for package python-hiredis # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,9 +16,8 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-hiredis -Version: 2.0.0 +Version: 2.2.2 Release: 0 Summary: Python wrapper for hiredis License: BSD-3-Clause @@ -27,9 +26,13 @@ Source: https://files.pythonhosted.org/packages/source/h/hiredis/hiredis Patch0: 0001-Use-system-libhiredis.patch # PATCH-FIX-UPSTREAM drop-vendor-sources.patch gh#redis/hiredis-py#90 mcepl@suse.com # Allow to use platform hiredis libs on build -Patch2: drop-vendor-sources.patch +Patch1: drop-vendor-sources.patch +# PATCH-FIX-UPSTREAM 159-sdsalloc-to-alloc.patch gh#redis/hiredis-py#158 mcepl@suse.com +# Don't use sdsalloc, we actually don't need it +Patch2: 159-sdsalloc-to-alloc.patch BuildRequires: %{python_module devel} -BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: hiredis-devel >= 1.0.0 BuildRequires: python-rpm-macros @@ -39,23 +42,23 @@ BuildRequires: python-rpm-macros Python wrapper for hiredis C connector. %prep -%setup -q -n hiredis-%{version} -%autopatch -p1 +%autosetup -p1 -n hiredis-%{version} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitearch} -%check -%python_exec setup.py build_ext --inplace -export PYTHONPATH=%{buildroot}%{$python_sitearch} -%python_exec test.py +# %%check +# export PYTHONPATH=%%{buildroot}%%{$python_sitearch} +# %%python_exec test.py %files %{python_files} -%license COPYING -%{python_sitearch}/* +%license LICENSE +%doc README.md +%{python_sitearch}/hiredis +%{python_sitearch}/hiredis-%{version}*-info %changelog