From f0e2e2d6f32932d0ece92ee0f0d4e7c68f30f78d Mon Sep 17 00:00:00 2001 From: frandosis Date: Mon, 7 Nov 2022 11:21:33 +0100 Subject: [PATCH] Update to adhere to PEP-353 and PEP-517. Making it compatible with python 3.10 and above. --- .gitignore | 5 +++++ MANIFEST.in | 2 +- Makefile | 3 +++ fastlz.c | 5 +++-- pyproject.toml | 3 +++ setup.cfg | 21 +++++++++++++++++++++ setup.py | 22 ++-------------------- 7 files changed, 38 insertions(+), 23 deletions(-) create mode 100644 pyproject.toml create mode 100644 setup.cfg diff --git a/.gitignore b/.gitignore index cb28125..32d70cb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,8 @@ MANIFEST env* build/ dist/ +demo.py +venv/ +verify/ +__pycache__ +*.egg-info diff --git a/MANIFEST.in b/MANIFEST.in index 41c74a9..430a55f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ include README.rst include fastlz/fastlz.c -include fastlz/fastlz.h +include fastlz/fastlz.h \ No newline at end of file diff --git a/Makefile b/Makefile index 67391fb..d1386dd 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,5 @@ all: python3 setup.py sdist + +clean: + rm -rf build dist *.egg-info \ No newline at end of file diff --git a/fastlz.c b/fastlz.c index 5f59974..65a372d 100644 --- a/fastlz.c +++ b/fastlz.c @@ -1,3 +1,4 @@ +#define PY_SSIZE_T_CLEAN #include #include "fastlz/fastlz.h" @@ -16,7 +17,7 @@ compress(PyObject *self, PyObject *args, PyObject *kwargs) PyObject *result; const char *input; char *output; - int input_len, output_len; + Py_ssize_t input_len, output_len; static char *arglist[] = {"string", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|i", arglist, &input, @@ -50,7 +51,7 @@ decompress(PyObject *self, PyObject *args) { PyObject *result; const char *input; - int input_len; + Py_ssize_t input_len; char *output; uint32_t output_len, decompressed_len; diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7fd26b9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..96e540a --- /dev/null +++ b/setup.cfg @@ -0,0 +1,21 @@ +[metadata] +name = fastlz +version = 0.5.0 +description = Python wrapper for FastLZ, a lightning-fast lossless compression library. +author = Valdemar M. T. Landberg +author_email = valdemar.landberg@live.dk +url = https://github.com/valdemarmtl/python-fastlz +license = BSD License, +classifiers = + Development Status :: 4 - Beta + Intended Audience :: Developers + License :: OSI Approved :: BSD License + Operating System :: POSIX + Programming Language :: C + Programming Language :: Python + Topic :: Software Development :: Libraries + Topic :: System :: Archiving :: Compression + Topic :: Utilities + +[bdist_wheel] +universal = 1 \ No newline at end of file diff --git a/setup.py b/setup.py index 5ba821d..6a7c885 100644 --- a/setup.py +++ b/setup.py @@ -1,29 +1,11 @@ -from distutils.core import setup, Extension - +from setuptools import Extension, setup setup( name='fastlz', version='0.5.0', - description='Python wrapper for FastLZ, a lightning-fast lossless ' - 'compression library.', - author='Remus M. Prunescu', - author_email='remusmp@gmail.com', - url='https://github.com/remusmp/python-fastlz', - license='BSD License', - classifiers = [ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: POSIX', - 'Programming Language :: C', - 'Programming Language :: Python', - 'Topic :: Software Development :: Libraries', - 'Topic :: System :: Archiving :: Compression', - 'Topic :: Utilities' - ], ext_modules = [ Extension( - 'fastlz', + name='fastlz', sources=['fastlz.c', 'fastlz/fastlz.c'], include_dirs=['fastlz'] )