hook-pyttsx3.py 953 B

123456789101112131415161718192021222324252627282930
  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. # pyttsx3 conditionally imports drivers module based on specific platform.
  13. # https://github.com/nateshmbhat/pyttsx3/blob/5a19376a94fdef6bfaef8795539e755b1f363fbf/pyttsx3/driver.py#L40-L50
  14. import sys
  15. hiddenimports = ["pyttsx3.drivers", "pyttsx3.drivers.dummy"]
  16. # Take directly from the link above.
  17. if sys.platform == 'darwin':
  18. driverName = 'nsss'
  19. elif sys.platform == 'win32':
  20. driverName = 'sapi5'
  21. else:
  22. driverName = 'espeak'
  23. # import driver module
  24. name = 'pyttsx3.drivers.%s' % driverName
  25. hiddenimports.append(name)