diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..49fb912
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,3 @@
+
+ test
+
diff --git a/concatenated.fastq.gz b/concatenated.fastq.gz
new file mode 100644
index 0000000..2ff8b89
--- /dev/null
+++ b/concatenated.fastq.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:cb22726d477bafe5b6f8bab6a48e160944580e6697efe805513ba8a33b372747
+size 92680
diff --git a/python-zlib-ng.changes b/python-zlib-ng.changes
index 828d8f3..4a7cb60 100644
--- a/python-zlib-ng.changes
+++ b/python-zlib-ng.changes
@@ -1,3 +1,33 @@
+-------------------------------------------------------------------
+Tue Feb 6 20:48:05 UTC 2024 - Ben Greiner
+
+- Update to 0.4.0
+ * Add a gzip_ng_threaded module that contains the
+ gzip_ng_threaded.open function. This allows using multithreaded
+ compression as well as escaping the GIL.
+ * The internal gzip_ng._GzipReader has been rewritten in C. As a
+ result the overhead of decompressing files has significantly
+ been reduced.
+ * The gzip_ng._GzipReader in C is now used in gzip_ng.decompress.
+ The _GzipReader also can read from objects that support the
+ buffer protocol. This has reduced overhead significantly.
+ * Fix some unclosed buffer errors in the gzip_ng CLI.
+- Version 0.3.0
+ * Source distributions on Linux now default to building with
+ configure and make as it is faster and has less dependencies
+ than CMake.
+ * Python 3.12 support was added. Python 3.7 support was dropped
+ as it is end of life.
+ * Update embedded zlib-ng version to 2.1.5. This comes with some
+ speed improvements and changes with regards to the compression
+ levels. Also several bugs were fixed. For full details checkout
+ the zlib-ng 2.1.2 release notes as well as those for the bugfix
+ releases 2.1.3, 2.1.4 and 2.1.5.
+- Fix BuildRequirements. This one never used poetry.
+- Enable tests in multibuild: some tests call python3.X -m zlib_ng
+ without respecting the PYTHONPATH from %pytest_arch.
+- Link to system library
+
-------------------------------------------------------------------
Wed Dec 6 10:25:00 UTC 2023 - Adrian Schröter
diff --git a/python-zlib-ng.spec b/python-zlib-ng.spec
index fcded84..1d32714 100644
--- a/python-zlib-ng.spec
+++ b/python-zlib-ng.spec
@@ -1,7 +1,7 @@
#
# spec file for package python-zlib-ng
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,26 +12,44 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-Name: python-zlib-ng
-Version: 0.2.0
+%global flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == "test"
+%define psuffix -test
+%bcond_without test
+%else
+%define psuffix %{nil}
+%bcond_with test
+%endif
+
+Name: python-zlib-ng%{psuffix}
+Version: 0.4.0
Release: 0
-License: MIT
+License: Python-2.0
Summary: Faster zlib and gzip compatible compression and decompression
Group: Development/Languages/Python
-Url: https://github.com/pycompression/python-zlib-ng
-Source: https://files.pythonhosted.org/packages/source/z/zlib-ng/zlib-ng-%{version}.tar.gz
-BuildRequires: %{python_module devel}
-BuildRequires: %{python_module poetry}
-BuildRequires: %{python_module wheel}
+URL: https://github.com/pycompression/python-zlib-ng
+Source0: https://files.pythonhosted.org/packages/source/z/zlib-ng/zlib-ng-%{version}.tar.gz
+Source1: https://github.com/pycompression/python-zlib-ng/raw/v%{version}/tests/data/concatenated.fastq.gz
+Source2: https://github.com/pycompression/python-zlib-ng/raw/v%{version}/tests/data/seeds.txt
+Source3: https://github.com/pycompression/python-zlib-ng/raw/v%{version}/tests/data/test.fastq.bgzip.gz
+Source4: https://github.com/pycompression/python-zlib-ng/raw/v%{version}/tests/data/test.fastq.gz
+BuildRequires: %{python_module devel >= 3.8}
BuildRequires: %{python_module pip}
-BuildRequires: cmake
+BuildRequires: %{python_module setuptools}
+BuildRequires: %{python_module wheel}
BuildRequires: fdupes
-BuildRequires: zlib-ng-devel
BuildRequires: python-rpm-macros
+BuildRequires: zlib-ng-devel
+Provides: python-zlib_ng = %{version}-%{release}
+%if %{with test}
+BuildRequires: %{python_module pytest}
+BuildRequires: %{python_module testsuite}
+BuildRequires: %{python_module zlib-ng = %{version}}
+%endif
%python_subpackages
%description
@@ -39,20 +57,34 @@ Faster zlib and gzip compatible compression and decompression by providing Pytho
This package provides Python bindings for the zlib-ng library.
-
%prep
%setup -q -n zlib-ng-%{version}
+mkdir tests/data
+cp %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} tests/data/
%build
+%if !%{with test}
+export PYTHON_ZLIB_NG_LINK_DYNAMIC=1
%pyproject_wheel
-
-%install
-%pyproject_install
-%python_expand %fdupes %{buildroot}%{$python_sitelib}
+%endif
+%install
+%if !%{with test}
+%pyproject_install
+%python_expand %fdupes %{buildroot}%{$python_sitearch}
+%endif
+
+%if %{with test}
+%check
+%pytest_arch
+%endif
+
+%if !%{with test}
%files %{python_files}
%license LICENSE
%doc README.rst
-%{python_sitearch}/*
+%{python_sitearch}/zlib_ng
+%{python_sitearch}/zlib_ng-%{version}.dist-info
+%endif
%changelog
diff --git a/seeds.txt b/seeds.txt
new file mode 100644
index 0000000..0df5318
--- /dev/null
+++ b/seeds.txt
@@ -0,0 +1,100 @@
+3543943125
+2012239574
+2871899840
+1576915383
+443567851
+3239180423
+3373382826
+3275169686
+3720569364
+2789290573
+618407468
+3601134391
+257166085
+951339096
+688447921
+2980268332
+4041231849
+2665838137
+2152080166
+3061402473
+114075645
+1066757169
+3059147274
+246562262
+3880192386
+4271112646
+3614603334
+3491130170
+332943583
+1921692081
+159629030
+4169931400
+641090334
+2429776133
+152825723
+2237958331
+2779470898
+872209389
+1543398313
+227922013
+1433480097
+2411689409
+4285411687
+2669236754
+2315690542
+2593947855
+2435538281
+640615264
+2183831503
+2141774460
+498759490
+1981068107
+659087394
+644660319
+4084740067
+306553019
+4172422758
+761521931
+2820900477
+160799031
+3875345091
+1347385004
+2312301814
+404607200
+2258507054
+1861096434
+3113292015
+1063461481
+3623153239
+11376533
+1748307784
+1185247326
+1030491484
+3925346575
+4212727269
+4234599042
+4019013354
+3237401702
+1335471143
+3405720069
+4119823939
+1476030215
+1339973082
+3541240200
+608243180
+4149852723
+3655893277
+2099999624
+3547173299
+860208608
+4254465956
+603882225
+1785239865
+3260029982
+83829029
+3136481952
+2052207849
+1971968310
+2157083216
+3415051802
diff --git a/test.fastq.bgzip.gz b/test.fastq.bgzip.gz
new file mode 100644
index 0000000..24d949d
--- /dev/null
+++ b/test.fastq.bgzip.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:95c770e328b56169ab48a3f1681dca55719924409b2e3d3b24a6e74d8bce6d5b
+size 1556539
diff --git a/test.fastq.gz b/test.fastq.gz
new file mode 100644
index 0000000..233d5db
--- /dev/null
+++ b/test.fastq.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:110fd6cd976092bb0fee2a828c9aeb7a03224c4428a1438b02a6b590e4759a68
+size 1660692
diff --git a/zlib-ng-0.2.0.tar.gz b/zlib-ng-0.2.0.tar.gz
deleted file mode 100644
index c7359de..0000000
--- a/zlib-ng-0.2.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:2b23707cb7e5bf27afd8422d290f68e82185af69741bde60914f18d16fb66e9b
-size 905929
diff --git a/zlib-ng-0.4.0.tar.gz b/zlib-ng-0.4.0.tar.gz
new file mode 100644
index 0000000..f69d140
--- /dev/null
+++ b/zlib-ng-0.4.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3b730881aaeb86f9a4995de5e22499406ccf92f8508b5c017c343d27570a8c0a
+size 2458999