hook-notebook.py 1.0 KB

123456789101112131415161718192021222324252627
  1. # ------------------------------------------------------------------
  2. # Copyright (c) 2020 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. import os
  13. from PyInstaller.utils.hooks import collect_data_files, collect_submodules
  14. from jupyter_core.paths import jupyter_config_path, jupyter_path
  15. # collect modules for handlers
  16. hiddenimports = collect_submodules('notebook', filter=lambda name: name.endswith('.handles'))
  17. hiddenimports.append('notebook.services.shutdown')
  18. datas = collect_data_files('notebook')
  19. # Collect share and etc folder for pre-installed extensions
  20. datas += [(path, 'share/jupyter')
  21. for path in jupyter_path() if os.path.exists(path)]
  22. datas += [(path, 'etc/jupyter')
  23. for path in jupyter_config_path() if os.path.exists(path)]