config.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #-----------------------------------------------------------------------------
  2. # Copyright (c) 2005-2021, PyInstaller Development Team.
  3. #
  4. # Distributed under the terms of the GNU General Public License (version 2
  5. # or later) with exception for distributing the bootloader.
  6. #
  7. # The full license is in the file COPYING.txt, distributed with this software.
  8. #
  9. # SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
  10. #-----------------------------------------------------------------------------
  11. """
  12. This module holds run-time PyInstaller configuration.
  13. Variable CONF is a dict() with all configuration options that are necessary for the build phase. Build phase is done by
  14. passing .spec file to exec() function. CONF variable is the only way how to pass arguments to exec() and how to avoid
  15. using 'global' variables.
  16. NOTE: Having 'global' variables does not play well with the test suite because it does not provide isolated environments
  17. for tests. Some tests might fail in this case.
  18. NOTE: The 'CONF' dict() is cleaned after building phase to not interfere with any other possible test.
  19. To pass any arguments to build phase, just do:
  20. from PyInstaller.config import CONF
  21. CONF['my_var_name'] = my_value
  22. And to use this variable in the build phase:
  23. from PyInstaller.config import CONF
  24. foo = CONF['my_var_name']
  25. This is the list of known variables. (Please update it if necessary.)
  26. cachedir
  27. hasUPX
  28. hiddenimports
  29. noconfirm
  30. pathex
  31. ui_admin
  32. ui_access
  33. upx_dir
  34. workpath
  35. tests_modgraph - cached PyiModuleGraph object to speed up tests
  36. """
  37. # NOTE: Do not import other PyInstaller modules here. Just define constants here.
  38. CONF = {
  39. # Unit tests require this key to exist.
  40. 'pathex': [],
  41. }