From 8e365ce40028efb6e80a662a083e87cfd42fe471 Mon Sep 17 00:00:00 2001
From: Jean-Christophe Morin <jcmorin@anaconda.com>
Date: Wed, 9 Aug 2023 12:10:22 -0400
Subject: [PATCH] Don't copy blosc2 in the package. We don't want to bundle it.

By default, pytables will copy blosc2 DLLs into the installed package if blosc2 is
found in a list of hardcoded "standard" paths.
---
 setup.py | 106 +++++++++++++++++++++++++++----------------------------
 1 file changed, 53 insertions(+), 53 deletions(-)

diff --git a/setup.py b/setup.py
index 966be028..ef6e1010 100755
--- a/setup.py
+++ b/setup.py
@@ -813,59 +813,59 @@ if __name__ == "__main__":
                     f"{blosc2_version}.  Update it via `pip install blosc2 -U.`"
                 )
 
-        if not rundir:
-            loc = {
-                "posix": "the default library paths",
-                "nt": "any of the directories in %%PATH%%",
-            }[os.name]
-
-            if package.name == "blosc2":
-                # We will copy this into the tables directory
-                print("  * Copying blosc2 runtime library to 'tables' dir"
-                      " because it was not found in standard locations")
-                platform_system = platform.system()
-                if platform_system == "Linux":
-                    copy_libs += ['libblosc2.so']
-                    dll_dir = '/tmp/hdf5/lib'
-                    # Copy dlls when producing the wheels in CI
-                    if "bdist_wheel" in sys.argv and os.path.exists(dll_dir):
-                        shared_libs = glob.glob(str(libdir) + '/libblosc2.so*')
-                        for lib in shared_libs:
-                            shutil.copy(lib, dll_dir)
-                    else:
-                        shutil.copy(libdir / 'libblosc2.so', 'tables')
-                elif platform_system == "Darwin":
-                    copy_libs += ['libblosc2.dylib']
-                    dll_dir = '/tmp/hdf5/lib'
-                    # Copy dlls when producing the wheels in CI
-                    if "bdist_wheel" in sys.argv and os.path.exists(dll_dir):
-                        shared_libs = glob.glob(str(libdir) + '/libblosc2*.dylib')
-                        for lib in shared_libs:
-                            shutil.copy(lib, dll_dir)
-                    else:
-                        shutil.copy(libdir / 'libblosc2.dylib', 'tables')
-                else:
-                    copy_libs += ['libblosc2.dll']
-                    dll_dir = 'C:\\Miniconda\\envs\\build\\Library\\bin'
-                    # Copy dlls when producing the wheels in CI
-                    if "bdist_wheel" in sys.argv and os.path.exists(dll_dir):
-                        shutil.copy(libdir.parent / 'bin' / 'libblosc2.dll', dll_dir)
-                    else:
-                        shutil.copy(libdir.parent / 'bin' / 'libblosc2.dll', 'tables')
-            else:
-                if "bdist_wheel" in sys.argv and os.name == "nt":
-                    exit_with_error(
-                        f"Could not find the {package.name} runtime.",
-                        f"The {package.name} shared library was *not* found in "
-                        f"{loc}. Cannot build wheel without the runtime.",
-                    )
-
-                print_warning(
-                    f"Could not find the {package.name} runtime.",
-                    f"The {package.name} shared library was *not* found "
-                    f"in {loc}. In case of runtime problems, please "
-                    f"remember to install it.",
-                )
+        # if not rundir:
+        #     loc = {
+        #         "posix": "the default library paths",
+        #         "nt": "any of the directories in %%PATH%%",
+        #     }[os.name]
+
+        #     if package.name == "blosc2":
+        #         # We will copy this into the tables directory
+        #         print("  * Copying blosc2 runtime library to 'tables' dir"
+        #               " because it was not found in standard locations")
+        #         platform_system = platform.system()
+        #         if platform_system == "Linux":
+        #             copy_libs += ['libblosc2.so']
+        #             dll_dir = '/tmp/hdf5/lib'
+        #             # Copy dlls when producing the wheels in CI
+        #             if "bdist_wheel" in sys.argv and os.path.exists(dll_dir):
+        #                 shared_libs = glob.glob(str(libdir) + '/libblosc2.so*')
+        #                 for lib in shared_libs:
+        #                     shutil.copy(lib, dll_dir)
+        #             else:
+        #                 shutil.copy(libdir / 'libblosc2.so', 'tables')
+        #         elif platform_system == "Darwin":
+        #             copy_libs += ['libblosc2.dylib']
+        #             dll_dir = '/tmp/hdf5/lib'
+        #             # Copy dlls when producing the wheels in CI
+        #             if "bdist_wheel" in sys.argv and os.path.exists(dll_dir):
+        #                 shared_libs = glob.glob(str(libdir) + '/libblosc2*.dylib')
+        #                 for lib in shared_libs:
+        #                     shutil.copy(lib, dll_dir)
+        #             else:
+        #                 shutil.copy(libdir / 'libblosc2.dylib', 'tables')
+        #         else:
+        #             copy_libs += ['libblosc2.dll']
+        #             dll_dir = 'C:\\Miniconda\\envs\\build\\Library\\bin'
+        #             # Copy dlls when producing the wheels in CI
+        #             if "bdist_wheel" in sys.argv and os.path.exists(dll_dir):
+        #                 shutil.copy(libdir.parent / 'bin' / 'libblosc2.dll', dll_dir)
+        #             else:
+        #                 shutil.copy(libdir.parent / 'bin' / 'libblosc2.dll', 'tables')
+        #     else:
+        #         if "bdist_wheel" in sys.argv and os.name == "nt":
+        #             exit_with_error(
+        #                 f"Could not find the {package.name} runtime.",
+        #                 f"The {package.name} shared library was *not* found in "
+        #                 f"{loc}. Cannot build wheel without the runtime.",
+        #             )
+
+        #         print_warning(
+        #             f"Could not find the {package.name} runtime.",
+        #             f"The {package.name} shared library was *not* found "
+        #             f"in {loc}. In case of runtime problems, please "
+        #             f"remember to install it.",
+        #         )
 
 
         if os.name == "nt":
-- 
2.41.0

