File tables-pr1000-debundled-blosc2.patch of Package failed_python-tables

Index: tables-3.8.0/requirements.txt
===================================================================
--- tables-3.8.0.orig/requirements.txt
+++ tables-3.8.0/requirements.txt
@@ -4,8 +4,5 @@
 cython>=0.29.21
 numpy>=1.19.0
 numexpr>=2.6.2
-# blosc2 wheel is actually only needed when compiling on conda envs.
-# Otherwise, lib comes bundled in PyTables wheels (but it doesn't hurt either).
-blosc2~=2.0.0
 packaging
 py-cpuinfo
Index: tables-3.8.0/setup.py
===================================================================
--- tables-3.8.0.orig/setup.py
+++ tables-3.8.0/setup.py
@@ -109,7 +109,27 @@ def get_blosc2_version(headername):
 
 
 def get_blosc2_directories():
-    """Get Blosc2 directories for the C library by using wheel metadata"""
+    """Get Blosc2 directories for the C library"""
+    # If the system provides the library and headers,
+    # get them from environment variables or find by pkg-config
+    try:
+        include_path = Path(os.environ.get(
+                "BLOSC2_INCDIR",
+                subprocess.check_output(
+                    [PKG_CONFIG, '--variable=includedir', 'blosc2'],
+                    text=True).strip()))
+        library_path = Path(os.environ.get(
+                "BLOSC2_LIBDIR",
+                subprocess.check_output(
+                    [PKG_CONFIG, '--variable=libdir', 'blosc2'],
+                    text=True).strip()))
+    except CalledProcessError:
+        pass
+    else:
+        return include_path, library_path
+
+    # Otherwise get them from the PyPI published wheels for blosc2
+    # They package the library and headers directly
     try:
         import blosc2
     except ModuleNotFoundError:
Index: tables-3.8.0/tables/__init__.py
===================================================================
--- tables-3.8.0.orig/tables/__init__.py
+++ tables-3.8.0/tables/__init__.py
@@ -8,20 +8,23 @@ to efficiently cope with extremely large
 """
 import os
 from ctypes import cdll
+from ctypes.util import find_library
 import platform
 
 
 # Load the blosc2 library, and if not found in standard locations,
 # try this directory (it should be automatically copied in setup.py).
-current_dir = os.path.dirname(__file__)
-platform_system = platform.system()
-blosc2_lib = "libblosc2"
-if platform_system == "Linux":
-    blosc2_lib += ".so"
-elif platform_system == "Darwin":
-    blosc2_lib += ".dylib"
-else:
-    blosc2_lib += ".dll"
+blosc2_lib = find_library("blosc2")
+if blosc2_lib is None:
+    current_dir = os.path.dirname(__file__)
+    platform_system = platform.system()
+    blosc2_lib = "libblosc2"
+    if platform_system == "Linux":
+        blosc2_lib += ".so"
+    elif platform_system == "Darwin":
+        blosc2_lib += ".dylib"
+    else:
+        blosc2_lib += ".dll"
 try:
     cdll.LoadLibrary(blosc2_lib)
 except OSError:
Index: tables-3.8.0/tables/req_versions.py
===================================================================
--- tables-3.8.0.orig/tables/req_versions.py
+++ tables-3.8.0/tables/req_versions.py
@@ -3,12 +3,13 @@
 from packaging.version import Version
 
 # **********************************************************************
-#   Keep these in sync with setup.cfg and user's guide
+#   Keep these in sync with requirements.txt and user's guide
 # **********************************************************************
 
 # Minimum recommended versions for mandatory packages
-min_numpy_version = Version('1.9.3')
+min_numpy_version = Version('1.19.0')
 min_numexpr_version = Version('2.6.2')
+# These are library versions, not the python modules
 min_hdf5_version = Version('1.10.5')
 min_blosc_version = Version('1.11.1')
 min_blosc2_version = Version('2.5.0')
openSUSE Build Service is sponsored by