hook-xarray.py 1.1 KB

123456789101112131415161718192021222324252627282930
  1. # ------------------------------------------------------------------
  2. # Copyright (c) 2024 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, collect_entry_point
  13. datas = []
  14. hiddenimports = []
  15. # Collect additional backend plugins that are registered via `xarray.backends` entry-point.
  16. ep_datas, ep_hiddenimports = collect_entry_point('xarray.backends')
  17. datas += ep_datas
  18. hiddenimports += ep_hiddenimports
  19. # Similarly, collect chunk manager entry-points.
  20. ep_datas, ep_hiddenimports = collect_entry_point('xarray.chunkmanagers')
  21. datas += ep_datas
  22. hiddenimports += ep_hiddenimports
  23. # `xarray` requires `numpy` metadata due to several calls to its `xarray.core.utils.module_available` with specified
  24. # `minversion` argument, which end up calling `importlib.metadata.version`.
  25. datas += copy_metadata('numpy')