Compare commits
No commits in common. "49e95c40d2d3a9a4919a70c1e4345a8b0f3fb173" and "1e65bf0b8d567b2fe7eb352637fa8486805d855e" have entirely different histories.
49e95c40d2
...
1e65bf0b8d
102
fix-python3.8+-use-py_ssize_t-type.patch
Normal file
102
fix-python3.8+-use-py_ssize_t-type.patch
Normal file
@ -0,0 +1,102 @@
|
||||
From 8242ae139f70a228bbcd8e7ca28f235ec0654180 Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Dryabzhinsky <sergey.dryabzhinsky@gmail.com>
|
||||
Date: Fri, 16 Apr 2021 21:40:23 +0300
|
||||
Subject: [PATCH] fix python3.8+ use py_ssize_t type
|
||||
|
||||
---
|
||||
src/python-zstd.c | 23 ++++++++++++++---------
|
||||
1 file changed, 14 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/python-zstd.c b/src/python-zstd.c
|
||||
index 1cf7b61..9ce1577 100644
|
||||
--- 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 @@ static PyObject *py_zstd_compress_mt(PyObject* self, PyObject *args)
|
||||
|
||||
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 @@ static PyObject *py_zstd_compress_mt(PyObject* self, PyObject *args)
|
||||
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 @@ static PyObject *py_zstd_compress_mt(PyObject* self, PyObject *args)
|
||||
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 @@ static PyObject *py_zstd_uncompress(PyObject* self, PyObject *args)
|
||||
|
||||
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 @@ static PyObject *py_zstd_compress_old(PyObject* self, PyObject *args) {
|
||||
|
||||
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 @@ static PyObject *py_zstd_uncompress_old(PyObject* self, PyObject *args) {
|
||||
|
||||
PyObject *result;
|
||||
const char *source;
|
||||
- uint32_t source_size;
|
||||
+ Py_ssize_t source_size;
|
||||
uint32_t dest_size;
|
||||
size_t cSize;
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,11 +1,17 @@
|
||||
%global _empty_manifest_terminate_build 0
|
||||
Name: python-zstd
|
||||
Version: 1.5.5.1
|
||||
Release: 1
|
||||
Version: 1.4.8.1
|
||||
Release: 3
|
||||
Summary: ZSTD Bindings for Python
|
||||
License: BSD-2-Clause
|
||||
URL: https://github.com/sergey-dryabzhinsky/python-zstd
|
||||
Source0: https://files.pythonhosted.org/packages/ba/b4/bf8c6a6b73c6b267a13df955f821f041fcc770b56820b135849f33e3b888/zstd-1.5.5.1.tar.gz
|
||||
Source0: https://files.pythonhosted.org/packages/92/bc/6bc155c61db55d5b3111a8afc76aaec084372bde89a82ecd4f5fd96c639a/zstd-1.4.8.1.tar.gz
|
||||
|
||||
# https://github.com/sergey-dryabzhinsky/python-zstd/commit/428a31edcde94d2908aa8ca3439ca01a797de3a4
|
||||
Patch1: fix-python3.8+-use-py_ssize_t-type.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-setuptools
|
||||
|
||||
%description
|
||||
Simple Python bindings for the Zstd compression library.
|
||||
@ -13,79 +19,29 @@ Simple Python bindings for the Zstd compression library.
|
||||
%package -n python3-zstd
|
||||
Summary: %{summary}
|
||||
Provides: python3-zstd
|
||||
# Base build requires
|
||||
BuildRequires: gcc
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-setuptools
|
||||
BuildRequires: python3-cffi
|
||||
# The library does not do symbol versioning to fully match automatically on
|
||||
|
||||
%description -n python3-zstd
|
||||
Simple Python bindings for the Zstd compression library.
|
||||
|
||||
%package help
|
||||
Summary: ZSTD Bindings for Python
|
||||
Provides: python3-zstd-doc
|
||||
%description help
|
||||
Simple Python bindings for the Zstd compression library.
|
||||
|
||||
%prep
|
||||
%autosetup -n zstd-%{version}
|
||||
%autosetup -n zstd-1.4.8.1 -p1
|
||||
|
||||
%build
|
||||
%py3_build
|
||||
|
||||
%install
|
||||
%py3_install
|
||||
install -d -m755 %{buildroot}/%{_pkgdocdir}
|
||||
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
|
||||
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
|
||||
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
|
||||
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
|
||||
pushd %{buildroot}
|
||||
if [ -d usr/lib ]; then
|
||||
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
|
||||
fi
|
||||
if [ -d usr/lib64 ]; then
|
||||
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
|
||||
fi
|
||||
if [ -d usr/bin ]; then
|
||||
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
|
||||
fi
|
||||
if [ -d usr/sbin ]; then
|
||||
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
|
||||
fi
|
||||
touch doclist.lst
|
||||
if [ -d usr/share/man ]; then
|
||||
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
|
||||
fi
|
||||
popd
|
||||
mv %{buildroot}/filelist.lst .
|
||||
mv %{buildroot}/doclist.lst .
|
||||
|
||||
%check
|
||||
%{__python3} setup.py test
|
||||
|
||||
%files -n python3-zstd -f filelist.lst
|
||||
%dir %{python3_sitearch}/*
|
||||
|
||||
%files help -f doclist.lst
|
||||
%{_docdir}/*
|
||||
%files -n python3-zstd
|
||||
%license LICENSE
|
||||
%doc README.rst
|
||||
%{python3_sitearch}/zstd-1.4.8.1-py%{python3_version}.egg-info
|
||||
%{python3_sitearch}/zstd*.so
|
||||
|
||||
%changelog
|
||||
* Fri Apr 07 2023 Ge Wang <wang__ge@126.com> - 1.5.5.1-1
|
||||
- Update to version 1.5.5.1
|
||||
|
||||
* Mon Feb 27 2023 wubijie <wubijie@kylinos.cn> - 1.5.4.0-1
|
||||
- Update package to version 1.5.4.0
|
||||
|
||||
* Fri Dec 09 2022 chendexi <chendexi@kylinos.cn> - 1.5.2.6-1
|
||||
- Upgrade package to version 1.5.2.6
|
||||
|
||||
* Wed Aug 10 2022 liqiuyu <liqiuyu@kylinos.cn> - 1.5.2.5-1
|
||||
- update to 1.5.2.5
|
||||
|
||||
* Fri Jun 03 2022 OpenStack_SIG <openstack@openeuler.org> - 1.5.1.0-1
|
||||
- Upgrade python3-zstd to version 1.5.1.0
|
||||
|
||||
* Tue May 10 2022 yangping <yangping69@h-partners> - 1.4.8.1-3
|
||||
- License compliance rectification
|
||||
|
||||
|
||||
BIN
zstd-1.4.8.1.tar.gz
Normal file
BIN
zstd-1.4.8.1.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user