hook-adbutils.py 1.0 KB

1234567891011121314151617181920212223
  1. # ------------------------------------------------------------------
  2. # Copyright (c) 2021 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, is_module_satisfies
  13. # adb.exe is not automatically collected by collect_dynamic_libs()
  14. datas = collect_data_files("adbutils", subdir="binaries", includes=["adb*"])
  15. # adbutils v2.2.2 replaced `pkg_resources` with `importlib.resources`, and now uses the following code to determine the
  16. # path to the `adbutils.binaries` sub-package directory:
  17. # https://github.com/openatx/adbutils/blob/2.2.2/adbutils/_utils.py#L78-L87
  18. # As `adbutils.binaries` is not directly imported anywhere, we need a hidden import.
  19. if is_module_satisfies('adbutils >= 2.2.2'):
  20. hiddenimports = ['adbutils.binaries']