hook-duckdb.py 958 B

12345678910111213141516171819202122
  1. # ------------------------------------------------------------------
  2. # Copyright (c) 2025 PyInstaller Development Team.
  3. #
  4. # This file is distributed under the terms of the GNU General Public
  5. # License (version 2.0 or later).
  6. #
  7. # The full license is available in LICENSE, distributed with
  8. # this software.
  9. #
  10. # SPDX-License-Identifier: GPL-2.0-or-later
  11. # ------------------------------------------------------------------
  12. from PyInstaller.utils.hooks import copy_metadata, is_module_satisfies
  13. # duckdb requires stdlib `inspect` module. On newer python versions (>= 3.10), it is collected as a dependency of other
  14. # stdlib modules, while on older python versions this is not the case. Therefore, we add it to hidden imports regardless
  15. # of python version.
  16. hiddenimports = ['inspect']
  17. # Starting with v1.4.0, `duckdb` uses `importlib.metadata.version()` to determine its version.
  18. if is_module_satisfies("duckdb >= 1.4.0"):
  19. datas = copy_metadata('duckdb')