hook-distributed.py 1.5 KB

1234567891011121314151617181920212223242526272829
  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 collect_data_files, collect_submodules
  13. # Collect submodules of distributed.http, many of which are imported indirectly.
  14. hiddenimports = collect_submodules("distributed.http")
  15. # Collect data files (distributed.yaml, distributed-schema.yaml, templates).
  16. datas = collect_data_files("distributed")
  17. # `distributed.dashboard.components.scheduler` attempts to refer to data files relative to its parent directory, but
  18. # with non-normalized '..' elements in the path (e.g., `_MEIPASS/distributed/dashboard/components/../theme.yaml`). On
  19. # POSIX systems, such paths are treated as non-existent if a component does not exist, even if the file exists at the
  20. # normalized location (i.e., if `_MEIPASS/distributed/dashboard/theme.yaml` file exists but
  21. # `_MEIPASS/distributed/dashboard/components` directory does not). As a work around, collect source .py files from
  22. # `distributed.dashboard.components` to ensure existence of the `components` directory.
  23. module_collection_mode = {
  24. 'distributed.dashboard.components': 'pyz+py',
  25. }