salimma pushed to rpms/python-zstd (epel9). "Rebuilt for Python 3.12"
by notifications@fedoraproject.org
Notification time stamped 2023-06-30 15:14:33 UTC
From ae89d1a6db781ca35b6c468f7b2da4395191ddd0 Mon Sep 17 00:00:00 2001
From: Python Maint <python-maint(a)redhat.com>
Date: Jun 13 2023 18:58:20 +0000
Subject: Rebuilt for Python 3.12
---
diff --git a/python-zstd.spec b/python-zstd.spec
index 8e3dfc2..2f7bae6 100644
--- a/python-zstd.spec
+++ b/python-zstd.spec
@@ -3,7 +3,7 @@
Name: python-%{pypi_name}
Version: %{zstd_version}.1
-Release: 10%{?dist}
+Release: 11%{?dist}
Summary: Zstd Bindings for Python
License: BSD
@@ -70,6 +70,9 @@ sed -i -e '/test_version/d' tests/__init__.py
%{python3_sitearch}/%{pypi_name}*.so
%changelog
+* Tue Jun 13 2023 Python Maint <python-maint(a)redhat.com> - 1.4.5.1-11
+- Rebuilt for Python 3.12
+
* Wed Feb 01 2023 Nikita Popov <npopov(a)redhat.com> - 1.4.5.1-10
- Port to C99
https://src.fedoraproject.org/rpms/python-zstd/c/ae89d1a6db781ca35b6c468f...
12 months
salimma pushed to rpms/python-zstd (epel9). "Rebuilt for Python 3.11"
by notifications@fedoraproject.org
Notification time stamped 2023-06-30 15:14:33 UTC
From 37ba10828ad4f4708634bf3ee3f630c118fd51ba Mon Sep 17 00:00:00 2001
From: Python Maint <python-maint(a)redhat.com>
Date: Jun 13 2022 13:35:57 +0000
Subject: Rebuilt for Python 3.11
---
diff --git a/python-zstd.spec b/python-zstd.spec
index 17ea473..b926dd9 100644
--- a/python-zstd.spec
+++ b/python-zstd.spec
@@ -3,7 +3,7 @@
Name: python-%{pypi_name}
Version: %{zstd_version}.1
-Release: 6%{?dist}
+Release: 7%{?dist}
Summary: Zstd Bindings for Python
License: BSD
@@ -67,6 +67,9 @@ sed -i -e '/test_version/d' tests/__init__.py
%{python3_sitearch}/%{pypi_name}*.so
%changelog
+* Mon Jun 13 2022 Python Maint <python-maint(a)redhat.com> - 1.4.5.1-7
+- Rebuilt for Python 3.11
+
* Fri Jan 21 2022 Fedora Release Engineering <releng(a)fedoraproject.org> - 1.4.5.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
https://src.fedoraproject.org/rpms/python-zstd/c/37ba10828ad4f4708634bf3e...
12 months
salimma pushed to rpms/python-zstd (epel9). "Python 3.11 compatibility"
by notifications@fedoraproject.org
Notification time stamped 2023-06-30 15:14:33 UTC
From fe962811b8d9558c9cd27327909fbfacf24d8ae2 Mon Sep 17 00:00:00 2001
From: Tomáš Hrnčiar <thrnciar(a)redhat.com>
Date: May 03 2022 10:14:54 +0000
Subject: Python 3.11 compatibility
---
diff --git a/0003-Port-to-Python-3.11-use-Py_SET_SIZE.patch b/0003-Port-to-Python-3.11-use-Py_SET_SIZE.patch
new file mode 100644
index 0000000..e99a9ba
--- /dev/null
+++ b/0003-Port-to-Python-3.11-use-Py_SET_SIZE.patch
@@ -0,0 +1,452 @@
+From 3e0333abe56db74dd8d8b2fd0578b16067cdf998 Mon Sep 17 00:00:00 2001
+From: Victor Stinner <vstinner(a)python.org>
+Date: Tue, 3 May 2022 12:00:02 +0200
+Subject: [PATCH] Port to Python 3.11: use Py_SET_SIZE()
+
+On Python 3.11, "Py_SIZE(result) = cSize;" fails with a compiler
+error. Since Python 3.9, Py_SET_SIZE() must be used instead:
+
+* https://docs.python.org/dev/whatsnew/3.11.html#c-api-changes
+* https://docs.python.org/dev/c-api/structures.html#c.Py_SIZE
+
+Add a copy of the pythoncapi_compat.h header file to get
+Py_SET_SIZE() on Python 3.8 and older:
+https://github.com/pythoncapi/pythoncapi_compat
+---
+ src/python-zstd.c | 5 +-
+ src/pythoncapi_compat.h | 393 ++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 396 insertions(+), 2 deletions(-)
+ create mode 100644 src/pythoncapi_compat.h
+
+diff --git a/src/python-zstd.c b/src/python-zstd.c
+index f87aa71..6cde04b 100644
+--- a/src/python-zstd.c
++++ b/src/python-zstd.c
+@@ -33,6 +33,7 @@
+ /* Since 3.8 it is mandatory to use proper type for # formats */
+ #define PY_SSIZE_T_CLEAN
+ #include <Python.h>
++#include "pythoncapi_compat.h" // Py_SET_SIZE() for Python 3.8 and older
+
+ #include "bytesobject.h"
+ #include "zstd.h"
+@@ -116,7 +117,7 @@ static PyObject *py_zstd_compress_mt(PyObject* self, PyObject *args)
+ Py_CLEAR(result);
+ return NULL;
+ }
+- Py_SIZE(result) = cSize;
++ Py_SET_SIZE(result, cSize);
+ }
+ return result;
+ }
+@@ -280,7 +281,7 @@ static PyObject *py_zstd_compress_old(PyObject* self, PyObject *args) {
+ PyErr_Format(ZstdError, "Compression error: %s", ZSTD_getErrorName(cSize));
+ Py_CLEAR(result);
+ } else {
+- Py_SIZE(result) = cSize + hdr_size;
++ Py_SET_SIZE(result, cSize + hdr_size);
+ }
+ }
+ return result;
+diff --git a/src/pythoncapi_compat.h b/src/pythoncapi_compat.h
+new file mode 100644
+index 0000000..b4011d2
+--- /dev/null
++++ b/src/pythoncapi_compat.h
+@@ -0,0 +1,393 @@
++// Header file providing new functions of the Python C API to old Python
++// versions.
++//
++// File distributed under the MIT license.
++// Copyright Contributors to the pythoncapi_compat project.
++//
++// Homepage:
++// https://github.com/pythoncapi/pythoncapi_compat
++//
++// Latest version:
++// https://raw.githubusercontent.com/pythoncapi/pythoncapi_compat/master/pyt...
++//
++// SPDX-License-Identifier: MIT
++
++#ifndef PYTHONCAPI_COMPAT
++#define PYTHONCAPI_COMPAT
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#include <Python.h>
++#include "frameobject.h" // PyFrameObject, PyFrame_GetBack()
++
++
++// Compatibility with Visual Studio 2013 and older which don't support
++// the inline keyword in C (only in C++): use __inline instead.
++#if (defined(_MSC_VER) && _MSC_VER < 1900 \
++ && !defined(__cplusplus) && !defined(inline))
++# define inline __inline
++# define PYTHONCAPI_COMPAT_MSC_INLINE
++ // These two macros are undefined at the end of this file
++#endif
++
++
++// Cast argument to PyObject* type.
++#ifndef _PyObject_CAST
++# define _PyObject_CAST(op) ((PyObject*)(op))
++#endif
++#ifndef _PyObject_CAST_CONST
++# define _PyObject_CAST_CONST(op) ((const PyObject*)(op))
++#endif
++
++
++// bpo-42262 added Py_NewRef() to Python 3.10.0a3
++#if PY_VERSION_HEX < 0x030A00A3 && !defined(Py_NewRef)
++static inline PyObject* _Py_NewRef(PyObject *obj)
++{
++ Py_INCREF(obj);
++ return obj;
++}
++#define Py_NewRef(obj) _Py_NewRef(_PyObject_CAST(obj))
++#endif
++
++
++// bpo-42262 added Py_XNewRef() to Python 3.10.0a3
++#if PY_VERSION_HEX < 0x030A00A3 && !defined(Py_XNewRef)
++static inline PyObject* _Py_XNewRef(PyObject *obj)
++{
++ Py_XINCREF(obj);
++ return obj;
++}
++#define Py_XNewRef(obj) _Py_XNewRef(_PyObject_CAST(obj))
++#endif
++
++
++// See https://bugs.python.org/issue42522
++#if !defined(_Py_StealRef)
++static inline PyObject* __Py_StealRef(PyObject *obj)
++{
++ Py_DECREF(obj);
++ return obj;
++}
++#define _Py_StealRef(obj) __Py_StealRef(_PyObject_CAST(obj))
++#endif
++
++
++// See https://bugs.python.org/issue42522
++#if !defined(_Py_XStealRef)
++static inline PyObject* __Py_XStealRef(PyObject *obj)
++{
++ Py_XDECREF(obj);
++ return obj;
++}
++#define _Py_XStealRef(obj) __Py_XStealRef(_PyObject_CAST(obj))
++#endif
++
++
++// bpo-39573 added Py_SET_REFCNT() to Python 3.9.0a4
++#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_REFCNT)
++static inline void _Py_SET_REFCNT(PyObject *ob, Py_ssize_t refcnt)
++{
++ ob->ob_refcnt = refcnt;
++}
++#define Py_SET_REFCNT(ob, refcnt) _Py_SET_REFCNT(_PyObject_CAST(ob), refcnt)
++#endif
++
++
++// Py_SETREF() and Py_XSETREF() were added to Python 3.5.2.
++// It is excluded from the limited C API.
++#if (PY_VERSION_HEX < 0x03050200 && !defined(Py_SETREF)) && !defined(Py_LIMITED_API)
++#define Py_SETREF(op, op2) \
++ do { \
++ PyObject *_py_tmp = _PyObject_CAST(op); \
++ (op) = (op2); \
++ Py_DECREF(_py_tmp); \
++ } while (0)
++
++#define Py_XSETREF(op, op2) \
++ do { \
++ PyObject *_py_tmp = _PyObject_CAST(op); \
++ (op) = (op2); \
++ Py_XDECREF(_py_tmp); \
++ } while (0)
++#endif
++
++
++// bpo-43753 added Py_Is(), Py_IsNone(), Py_IsTrue() and Py_IsFalse()
++// to Python 3.10.0b1.
++#if PY_VERSION_HEX < 0x030A00B1 && !defined(Py_Is)
++# define Py_Is(x, y) ((x) == (y))
++#endif
++#if PY_VERSION_HEX < 0x030A00B1 && !defined(Py_IsNone)
++# define Py_IsNone(x) Py_Is(x, Py_None)
++#endif
++#if PY_VERSION_HEX < 0x030A00B1 && !defined(Py_IsTrue)
++# define Py_IsTrue(x) Py_Is(x, Py_True)
++#endif
++#if PY_VERSION_HEX < 0x030A00B1 && !defined(Py_IsFalse)
++# define Py_IsFalse(x) Py_Is(x, Py_False)
++#endif
++
++
++// bpo-39573 added Py_SET_TYPE() to Python 3.9.0a4
++#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_TYPE)
++static inline void
++_Py_SET_TYPE(PyObject *ob, PyTypeObject *type)
++{
++ ob->ob_type = type;
++}
++#define Py_SET_TYPE(ob, type) _Py_SET_TYPE(_PyObject_CAST(ob), type)
++#endif
++
++
++// bpo-39573 added Py_SET_SIZE() to Python 3.9.0a4
++#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_SIZE)
++static inline void
++_Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size)
++{
++ ob->ob_size = size;
++}
++#define Py_SET_SIZE(ob, size) _Py_SET_SIZE((PyVarObject*)(ob), size)
++#endif
++
++
++// bpo-40421 added PyFrame_GetCode() to Python 3.9.0b1
++#if PY_VERSION_HEX < 0x030900B1
++static inline PyCodeObject*
++PyFrame_GetCode(PyFrameObject *frame)
++{
++ assert(frame != NULL);
++ assert(frame->f_code != NULL);
++ return (PyCodeObject*)Py_NewRef(frame->f_code);
++}
++#endif
++
++static inline PyCodeObject*
++_PyFrame_GetCodeBorrow(PyFrameObject *frame)
++{
++ return (PyCodeObject *)_Py_StealRef(PyFrame_GetCode(frame));
++}
++
++
++// bpo-40421 added PyFrame_GetCode() to Python 3.9.0b1
++#if PY_VERSION_HEX < 0x030900B1 && !defined(PYPY_VERSION)
++static inline PyFrameObject*
++PyFrame_GetBack(PyFrameObject *frame)
++{
++ assert(frame != NULL);
++ return (PyFrameObject*)Py_XNewRef(frame->f_back);
++}
++#endif
++
++#if !defined(PYPY_VERSION)
++static inline PyFrameObject*
++_PyFrame_GetBackBorrow(PyFrameObject *frame)
++{
++ return (PyFrameObject *)_Py_XStealRef(PyFrame_GetBack(frame));
++}
++#endif
++
++
++// bpo-39947 added PyThreadState_GetInterpreter() to Python 3.9.0a5
++#if PY_VERSION_HEX < 0x030900A5
++static inline PyInterpreterState *
++PyThreadState_GetInterpreter(PyThreadState *tstate)
++{
++ assert(tstate != NULL);
++ return tstate->interp;
++}
++#endif
++
++
++// bpo-40429 added PyThreadState_GetFrame() to Python 3.9.0b1
++#if PY_VERSION_HEX < 0x030900B1 && !defined(PYPY_VERSION)
++static inline PyFrameObject*
++PyThreadState_GetFrame(PyThreadState *tstate)
++{
++ assert(tstate != NULL);
++ return (PyFrameObject *)Py_XNewRef(tstate->frame);
++}
++#endif
++
++#if !defined(PYPY_VERSION)
++static inline PyFrameObject*
++_PyThreadState_GetFrameBorrow(PyThreadState *tstate)
++{
++ return (PyFrameObject *)_Py_XStealRef(PyThreadState_GetFrame(tstate));
++}
++#endif
++
++
++// bpo-39947 added PyInterpreterState_Get() to Python 3.9.0a5
++#if PY_VERSION_HEX < 0x030900A5
++static inline PyInterpreterState *
++PyInterpreterState_Get(void)
++{
++ PyThreadState *tstate;
++ PyInterpreterState *interp;
++
++ tstate = PyThreadState_GET();
++ if (tstate == NULL) {
++ Py_FatalError("GIL released (tstate is NULL)");
++ }
++ interp = tstate->interp;
++ if (interp == NULL) {
++ Py_FatalError("no current interpreter");
++ }
++ return interp;
++}
++#endif
++
++
++// bpo-39947 added PyInterpreterState_Get() to Python 3.9.0a6
++#if 0x030700A1 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x030900A6 && !defined(PYPY_VERSION)
++static inline uint64_t
++PyThreadState_GetID(PyThreadState *tstate)
++{
++ assert(tstate != NULL);
++ return tstate->id;
++}
++#endif
++
++// bpo-43760 added PyThreadState_EnterTracing() to Python 3.11.0a2
++#if PY_VERSION_HEX < 0x030B00A2 && !defined(PYPY_VERSION)
++static inline void PyThreadState_EnterTracing(PyThreadState *tstate)
++{
++ tstate->tracing++;
++#if PY_VERSION_HEX >= 0x030A00A1
++ tstate->cframe->use_tracing = 0;
++#else
++ tstate->use_tracing = 0;
++#endif
++}
++#endif
++
++// bpo-43760 added PyThreadState_LeaveTracing() to Python 3.11.0a2
++#if PY_VERSION_HEX < 0x030B00A2 && !defined(PYPY_VERSION)
++static inline void PyThreadState_LeaveTracing(PyThreadState *tstate)
++{
++ tstate->tracing--;
++ int use_tracing = (tstate->c_tracefunc != NULL
++ || tstate->c_profilefunc != NULL);
++#if PY_VERSION_HEX >= 0x030A00A1
++ tstate->cframe->use_tracing = use_tracing;
++#else
++ tstate->use_tracing = use_tracing;
++#endif
++}
++#endif
++
++
++// bpo-37194 added PyObject_CallNoArgs() to Python 3.9.0a1
++#if PY_VERSION_HEX < 0x030900A1
++static inline PyObject*
++PyObject_CallNoArgs(PyObject *func)
++{
++ return PyObject_CallFunctionObjArgs(func, NULL);
++}
++#endif
++
++
++// bpo-39245 made PyObject_CallOneArg() public (previously called
++// _PyObject_CallOneArg) in Python 3.9.0a4
++#if PY_VERSION_HEX < 0x030900A4
++static inline PyObject*
++PyObject_CallOneArg(PyObject *func, PyObject *arg)
++{
++ return PyObject_CallFunctionObjArgs(func, arg, NULL);
++}
++#endif
++
++
++// bpo-1635741 added PyModule_AddObjectRef() to Python 3.10.0a3
++#if PY_VERSION_HEX < 0x030A00A3
++static inline int
++PyModule_AddObjectRef(PyObject *module, const char *name, PyObject *value)
++{
++ int res;
++ Py_XINCREF(value);
++ res = PyModule_AddObject(module, name, value);
++ if (res < 0) {
++ Py_XDECREF(value);
++ }
++ return res;
++}
++#endif
++
++
++// bpo-40024 added PyModule_AddType() to Python 3.9.0a5
++#if PY_VERSION_HEX < 0x030900A5
++static inline int
++PyModule_AddType(PyObject *module, PyTypeObject *type)
++{
++ const char *name, *dot;
++
++ if (PyType_Ready(type) < 0) {
++ return -1;
++ }
++
++ // inline _PyType_Name()
++ name = type->tp_name;
++ assert(name != NULL);
++ dot = strrchr(name, '.');
++ if (dot != NULL) {
++ name = dot + 1;
++ }
++
++ return PyModule_AddObjectRef(module, name, (PyObject *)type);
++}
++#endif
++
++
++// bpo-40241 added PyObject_GC_IsTracked() to Python 3.9.0a6.
++// bpo-4688 added _PyObject_GC_IS_TRACKED() to Python 2.7.0a2.
++#if PY_VERSION_HEX < 0x030900A6 && !defined(PYPY_VERSION)
++static inline int
++PyObject_GC_IsTracked(PyObject* obj)
++{
++ return (PyObject_IS_GC(obj) && _PyObject_GC_IS_TRACKED(obj));
++}
++#endif
++
++// bpo-40241 added PyObject_GC_IsFinalized() to Python 3.9.0a6.
++// bpo-18112 added _PyGCHead_FINALIZED() to Python 3.4.0 final.
++#if PY_VERSION_HEX < 0x030900A6 && PY_VERSION_HEX >= 0x030400F0 && !defined(PYPY_VERSION)
++static inline int
++PyObject_GC_IsFinalized(PyObject *obj)
++{
++ return (PyObject_IS_GC(obj) && _PyGCHead_FINALIZED((PyGC_Head *)(obj)-1));
++}
++#endif
++
++
++// bpo-39573 added Py_IS_TYPE() to Python 3.9.0a4
++#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_IS_TYPE)
++static inline int
++_Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type) {
++ return ob->ob_type == type;
++}
++#define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type)
++#endif
++
++
++// Py_UNUSED() was added to Python 3.4.0b2.
++#if PY_VERSION_HEX < 0x030400B2 && !defined(Py_UNUSED)
++# if defined(__GNUC__) || defined(__clang__)
++# define Py_UNUSED(name) _unused_ ## name __attribute__((unused))
++# else
++# define Py_UNUSED(name) _unused_ ## name
++# endif
++#endif
++
++
++#ifdef PYTHONCAPI_COMPAT_MSC_INLINE
++# undef inline
++# undef PYTHONCAPI_COMPAT_MSC_INLINE
++#endif
++
++#ifdef __cplusplus
++}
++#endif
++#endif // PYTHONCAPI_COMPAT
+--
+2.33.1
+
diff --git a/python-zstd.spec b/python-zstd.spec
index 89695bd..17ea473 100644
--- a/python-zstd.spec
+++ b/python-zstd.spec
@@ -18,6 +18,10 @@ Patch1: python-zstd-1.4.5.1-test-once.patch
# From https://github.com/sergey-dryabzhinsky/python-zstd/commit/428a31edcd
Patch2: python-zstd-1.4.5.1-py_ssize_t_clean.patch
+# Python 3.11 compatibility, merged upstream
+# From https://github.com/sergey-dryabzhinsky/python-zstd/commit/4e9b8b0cbf
+Patch3: 0003-Port-to-Python-3.11-use-Py_SET_SIZE.patch
+
BuildRequires: gcc
BuildRequires: python3-devel
BuildRequires: python3dist(setuptools)
https://src.fedoraproject.org/rpms/python-zstd/c/fe962811b8d9558c9cd27327...
12 months
salimma pushed to rpms/python-zstd (epel9). "Use __python3 macro for
CentOS compatibility"
by notifications@fedoraproject.org
Notification time stamped 2023-06-30 15:14:32 UTC
From d747d8bf04c8108ce3e57cf0e3c558313afe541a Mon Sep 17 00:00:00 2001
From: Joel Capitao <jcapitao(a)redhat.com>
Date: Sep 21 2020 12:53:23 +0000
Subject: Use __python3 macro for CentOS compatibility
---
diff --git a/python-zstd.spec b/python-zstd.spec
index cceabdb..d327561 100644
--- a/python-zstd.spec
+++ b/python-zstd.spec
@@ -3,7 +3,7 @@
Name: python-%{pypi_name}
Version: %{zstd_version}.1
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Zstd Bindings for Python
License: BSD
@@ -50,7 +50,7 @@ sed -i -e '/test_version/d' tests/__init__.py
%py3_install
%check
-%python3 setup.py test
+%{__python3} setup.py test
%files -n python3-%{pypi_name}
%license LICENSE
@@ -59,5 +59,8 @@ sed -i -e '/test_version/d' tests/__init__.py
%{python3_sitearch}/%{pypi_name}*.so
%changelog
+* Mon Sep 21 2020 Joel Capitao <jcapitao(a)redhat.com> - 1.4.5.1-2
+- Edit macro for CentOS interoperability
+
* Sun Aug 23 2020 Neal Gompa <ngompa13(a)gmail.com> - 1.4.5.1-1
- Initial package (#1870571)
https://src.fedoraproject.org/rpms/python-zstd/c/d747d8bf04c8108ce3e57cf0...
12 months
salimma pushed to rpms/python-zstd (epel9). "Python 3.10 compatibility"
by notifications@fedoraproject.org
Notification time stamped 2023-06-30 15:14:32 UTC
From 27eafa11ea5f97933d7a372e3835d46fbc1b578e Mon Sep 17 00:00:00 2001
From: Miro Hrončok <miro(a)hroncok.cz>
Date: Jun 07 2021 22:48:34 +0000
Subject: Python 3.10 compatibility
---
diff --git a/python-zstd-1.4.5.1-py_ssize_t_clean.patch b/python-zstd-1.4.5.1-py_ssize_t_clean.patch
new file mode 100644
index 0000000..b37c4b5
--- /dev/null
+++ b/python-zstd-1.4.5.1-py_ssize_t_clean.patch
@@ -0,0 +1,88 @@
+--- a/src/python-zstd.c
++++ b/src/python-zstd.c
+@@ -29,13 +29,16 @@
+
+ #include <stdlib.h>
+ #include <stddef.h>
++
++/* Since 3.8 it is mandatory to use proper type for # formats */
++#define PY_SSIZE_T_CLEAN
+ #include <Python.h>
++
+ #include "bytesobject.h"
+ #include "zstd.h"
+ #include "util.h"
+ #include "python-zstd.h"
+
+-
+ /**
+ * New function for multi-threaded compression.
+ * Uses origin zstd header, nothing more.
+@@ -47,12 +50,13 @@
+
+ PyObject *result;
+ const char *source;
+- uint32_t source_size;
++ Py_ssize_t source_size;
+ char *dest;
+- uint32_t dest_size;
++ Py_ssize_t dest_size;
+ size_t cSize;
+ int32_t level = ZSTD_CLEVEL_DEFAULT;
+ int32_t threads = 0;
++ ZSTD_CCtx* cctx = 0;
+
+ #if PY_MAJOR_VERSION >= 3
+ if (!PyArg_ParseTuple(args, "y#|ii", &source, &source_size, &level, &threads))
+@@ -87,7 +91,7 @@
+ return NULL;
+ }
+
+- dest_size = ZSTD_compressBound(source_size);
++ dest_size = (Py_ssize_t)ZSTD_compressBound(source_size);
+ result = PyBytes_FromStringAndSize(NULL, dest_size);
+ if (result == NULL) {
+ return NULL;
+@@ -96,12 +100,13 @@
+ if (source_size > 0) {
+ dest = PyBytes_AS_STRING(result);
+
+- ZSTD_CCtx* cctx = ZSTD_createCCtx();
++ cctx = ZSTD_createCCtx();
++
+ ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, level);
+ ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, threads);
+
+ Py_BEGIN_ALLOW_THREADS
+- cSize = ZSTD_compress2(cctx, dest, dest_size, source, source_size);
++ cSize = ZSTD_compress2(cctx, dest, (size_t)dest_size, source, (size_t)source_size);
+ Py_END_ALLOW_THREADS
+
+ ZSTD_freeCCtx(cctx);
+@@ -126,7 +131,7 @@
+
+ PyObject *result;
+ const char *source;
+- uint32_t source_size;
++ Py_ssize_t source_size;
+ uint64_t dest_size;
+ char error = 0;
+ size_t cSize;
+@@ -233,7 +238,7 @@
+
+ PyObject *result;
+ const char *source;
+- uint32_t source_size;
++ Py_ssize_t source_size;
+ char *dest;
+ uint32_t dest_size;
+ size_t cSize;
+@@ -289,7 +294,7 @@
+
+ PyObject *result;
+ const char *source;
+- uint32_t source_size;
++ Py_ssize_t source_size;
+ uint32_t dest_size;
+ size_t cSize;
+
diff --git a/python-zstd-1.4.5.1-test-external.patch b/python-zstd-1.4.5.1-test-external.patch
index 9b99d16..548810f 100644
--- a/python-zstd-1.4.5.1-test-external.patch
+++ b/python-zstd-1.4.5.1-test-external.patch
@@ -1,5 +1,5 @@
---- zstd-1.3.8.1/setup.py.orig 2019-03-04 17:40:51.208528890 +0700
-+++ zstd-1.3.8.1/setup.py 2019-03-04 17:58:37.644953996 +0700
+--- a/setup.py
++++ b/setup.py
@@ -97,6 +97,8 @@
class ZstdBuildExt( build_ext ):
diff --git a/python-zstd-1.4.5.1-test-once.patch b/python-zstd-1.4.5.1-test-once.patch
index 3246edf..438523d 100644
--- a/python-zstd-1.4.5.1-test-once.patch
+++ b/python-zstd-1.4.5.1-test-once.patch
@@ -1,5 +1,5 @@
---- zstd-1.3.8.1/setup.py.orig 2019-03-04 17:40:51.208528890 +0700
-+++ zstd-1.3.8.1/setup.py 2019-03-04 17:58:37.644953996 +0700
+--- a/setup.py
++++ b/setup.py
@@ -171,7 +173,6 @@
Extension('zstd', zstdFiles, libraries=ext_libraries)
],
diff --git a/python-zstd.spec b/python-zstd.spec
index 22376a8..17cdaf2 100644
--- a/python-zstd.spec
+++ b/python-zstd.spec
@@ -14,6 +14,10 @@ Source0: %{pypi_source}
Patch0: python-zstd-1.4.5.1-test-external.patch
Patch1: python-zstd-1.4.5.1-test-once.patch
+# Python 3.10 compatibility, merged upstream
+# From https://github.com/sergey-dryabzhinsky/python-zstd/commit/428a31edcd
+Patch2: python-zstd-1.4.5.1-py_ssize_t_clean.patch
+
BuildRequires: gcc
BuildRequires: python3-devel
BuildRequires: python3dist(setuptools)
@@ -33,7 +37,7 @@ Simple Python bindings for the Zstd compression library.
%prep
-%autosetup -n %{pypi_name}-%{version}
+%autosetup -p1 -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
# Remove bundled zstd library
https://src.fedoraproject.org/rpms/python-zstd/c/27eafa11ea5f97933d7a372e...
12 months
salimma pushed to rpms/python-zstd (epel9). "Initial package (#1870571)"
by notifications@fedoraproject.org
Notification time stamped 2023-06-30 15:14:32 UTC
From 9286670d767ea9cddb4d8063621e17f6a9b347af Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13(a)gmail.com>
Date: Aug 23 2020 12:19:23 +0000
Subject: Initial package (#1870571)
---
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..80dc5d3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/zstd-1.4.5.1.tar.gz
diff --git a/python-zstd-1.4.5.1-test-external.patch b/python-zstd-1.4.5.1-test-external.patch
new file mode 100644
index 0000000..9b99d16
--- /dev/null
+++ b/python-zstd-1.4.5.1-test-external.patch
@@ -0,0 +1,11 @@
+--- zstd-1.3.8.1/setup.py.orig 2019-03-04 17:40:51.208528890 +0700
++++ zstd-1.3.8.1/setup.py 2019-03-04 17:58:37.644953996 +0700
+@@ -97,6 +97,8 @@
+ class ZstdBuildExt( build_ext ):
+
+ def build_extensions(self):
++ if 'test' in sys.argv: return
++
+ c = self.compiler.compiler_type
+ if c in COPT:
+ for e in self.extensions:
diff --git a/python-zstd-1.4.5.1-test-once.patch b/python-zstd-1.4.5.1-test-once.patch
new file mode 100644
index 0000000..3246edf
--- /dev/null
+++ b/python-zstd-1.4.5.1-test-once.patch
@@ -0,0 +1,10 @@
+--- zstd-1.3.8.1/setup.py.orig 2019-03-04 17:40:51.208528890 +0700
++++ zstd-1.3.8.1/setup.py 2019-03-04 17:58:37.644953996 +0700
+@@ -171,7 +173,6 @@
+ Extension('zstd', zstdFiles, libraries=ext_libraries)
+ ],
+ cmdclass = {'build_ext': ZstdBuildExt },
+- test_suite='setup.my_test_suite',
+ classifiers=[
+ 'License :: OSI Approved :: BSD License',
+ 'Intended Audience :: Developers',
diff --git a/python-zstd.spec b/python-zstd.spec
new file mode 100644
index 0000000..cceabdb
--- /dev/null
+++ b/python-zstd.spec
@@ -0,0 +1,63 @@
+%global pypi_name zstd
+%global zstd_version 1.4.5
+
+Name: python-%{pypi_name}
+Version: %{zstd_version}.1
+Release: 1%{?dist}
+Summary: Zstd Bindings for Python
+
+License: BSD
+URL: https://github.com/sergey-dryabzhinsky/python-zstd
+Source0: %{pypi_source}
+
+# Patches to fix test execution
+Patch0: python-zstd-1.4.5.1-test-external.patch
+Patch1: python-zstd-1.4.5.1-test-once.patch
+
+BuildRequires: gcc
+BuildRequires: python3-devel
+BuildRequires: python3dist(setuptools)
+BuildRequires: pkgconfig(libzstd) >= %{zstd_version}
+
+%description
+Simple Python bindings for the Zstd compression library.
+
+%package -n python3-%{pypi_name}
+Summary: %{summary}
+%{?python_provide:%python_provide python3-%{pypi_name}}
+# The library does not do symbol versioning to fully match automatically on
+Requires: libzstd%{?_isa} >= %{zstd_version}
+
+%description -n python3-%{pypi_name}
+Simple Python bindings for the Zstd compression library.
+
+
+%prep
+%autosetup -n %{pypi_name}-%{version}
+# Remove bundled egg-info
+rm -rf %{pypi_name}.egg-info
+# Remove bundled zstd library
+rm -rf zstd/
+# do not test the version matching, we don't really need exact version of
+# zstd here
+rm tests/test_version.py
+sed -i -e '/test_version/d' tests/__init__.py
+
+%build
+%py3_build -- --legacy --pyzstd-legacy --external
+
+%install
+%py3_install
+
+%check
+%python3 setup.py test
+
+%files -n python3-%{pypi_name}
+%license LICENSE
+%doc README.rst
+%{python3_sitearch}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
+%{python3_sitearch}/%{pypi_name}*.so
+
+%changelog
+* Sun Aug 23 2020 Neal Gompa <ngompa13(a)gmail.com> - 1.4.5.1-1
+- Initial package (#1870571)
diff --git a/sources b/sources
new file mode 100644
index 0000000..614046d
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+SHA512 (zstd-1.4.5.1.tar.gz) = f27e255bc66798b2227d39eaa7648803e7753556b522d3dc37e82413f01dcff44b05f652c210e9832077876bd954a3abdad5ed1823f5f50217b83159bbaf896d
https://src.fedoraproject.org/rpms/python-zstd/c/9286670d767ea9cddb4d8063...
12 months