Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-zstandard for 
openSUSE:Factory checked in at 2023-02-19 18:18:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-zstandard (Old)
 and      /work/SRC/openSUSE:Factory/.python-zstandard.new.22824 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-zstandard"

Sun Feb 19 18:18:31 2023 rev:9 rq:1066418 version:0.19.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-zstandard/python-zstandard.changes        
2022-12-07 17:35:05.956583242 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-zstandard.new.22824/python-zstandard.changes 
    2023-02-19 18:18:32.601321441 +0100
@@ -1,0 +2,8 @@
+Fri Feb 17 12:46:17 UTC 2023 - Martin Liška <mli...@suse.cz>
+
+- Enable --system-zstd so that we depend of a system shared library
+  of zstd.
+- Add feature-detection.patch as feature detection test does not support
+  --system-zstd (gh#indygreg/python-zstandard#191).
+
+-------------------------------------------------------------------

New:
----
  feature-detection.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-zstandard.spec ++++++
--- /var/tmp/diff_new_pack.dnQqQA/_old  2023-02-19 18:18:34.053330667 +0100
+++ /var/tmp/diff_new_pack.dnQqQA/_new  2023-02-19 18:18:34.057330693 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-zstandard
 #
-# 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
@@ -25,6 +25,7 @@
 Group:          Development/Languages/Python
 URL:            https://github.com/indygreg/python-zstandard
 Source:         
https://files.pythonhosted.org/packages/source/z/zstandard/zstandard-%{version}.tar.gz
+Patch0:         feature-detection.patch
 BuildRequires:  %{python_module devel}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
@@ -48,10 +49,11 @@
 
 %prep
 %setup -q -n zstandard-%{version}
+%patch0 -p1
 
 %build
 export CFLAGS="%{optflags}"
-%python_build
+%python_build --system-zstd
 
 %install
 %python_install

++++++ feature-detection.patch ++++++
diff --git a/c-ext/backend_c.c b/c-ext/backend_c.c
index e31dd15..a5d9dee 100644
--- a/c-ext/backend_c.c
+++ b/c-ext/backend_c.c
@@ -210,6 +210,20 @@ void zstd_module_init(PyObject *m) {
     Py_DECREF(feature);
 #endif
 
+#ifdef SYSTEM_ZSTD
+    feature = PyUnicode_FromString("system_zstd");
+    if (NULL == feature) {
+        PyErr_SetString(PyExc_ImportError, "could not create feature string");
+        return;
+    }
+
+    if (PySet_Add(features, feature) == -1) {
+        return;
+    }
+
+    Py_DECREF(feature);
+#endif
+
     if (PyObject_SetAttrString(m, "backend_features", features) == -1) {
         return;
     }
diff --git a/setup_zstd.py b/setup_zstd.py
index 399b129..d940c80 100644
--- a/setup_zstd.py
+++ b/setup_zstd.py
@@ -78,6 +78,7 @@ def get_c_extension(
 
     if system_zstd:
         extra_args.append("-DZSTD_MULTITHREAD")
+        extra_args.append("-DSYSTEM_ZSTD")
     else:
         extra_args.append("-DZSTD_SINGLE_FILE")
         extra_args.append("-DZSTDLIB_VISIBILITY=")
diff --git a/tests/test_module_attributes.py b/tests/test_module_attributes.py
index d487aa8..15cda73 100644
--- a/tests/test_module_attributes.py
+++ b/tests/test_module_attributes.py
@@ -26,7 +26,15 @@ class TestModuleAttributes(unittest.TestCase):
             },
         }[zstd.backend]
 
-        self.assertEqual(zstd.backend_features, expected)
+        # The following features are available only with
+        # statically linked version of the module.
+        available_features = set(zstd.backend_features)
+        if 'system_zstd' in available_features:
+            available_features.remove('system_zstd')
+            expected.discard('multi_compress_to_buffer')
+            expected.discard('multi_decompress_to_buffer')
+
+        self.assertEqual(available_features, expected)
 
     def test_constants(self):
         self.assertEqual(zstd.MAX_COMPRESSION_LEVEL, 22)

Reply via email to