config.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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
  14. for the build phase. Build phase is done by passing .spec file to exec()
  15. function. CONF variable is the only way how to pass arguments to exec() and
  16. how to avoid using 'global' variables.
  17. NOTE: Having 'global' variables does not play well with the test suite
  18. because it does not provide isolated environments for tests. Some tests might
  19. fail in this case.
  20. NOTE: The 'CONF' dict() is cleaned after building phase to not interfere with
  21. any other possible test.
  22. To pass any arguments to build phase, just do:
  23. from PyInstaller.config import CONF
  24. CONF['my_var_name'] = my_value
  25. And to use this variable in the build phase:
  26. from PyInstaller.config import CONF
  27. foo = CONF['my_var_name']
  28. This is the list of known variables. (Please update it if necessary.)
  29. cachedir
  30. hasUPX
  31. hiddenimports
  32. noconfirm
  33. pathex
  34. ui_admin
  35. ui_access
  36. upx_dir
  37. workpath
  38. tests_modgraph - cached PyiModuleGraph object to speed up tests
  39. """
  40. # NOTE: Do not import other PyInstaller modules here. Just define constants here.
  41. CONF = {
  42. # Unit tests require this key to exist.
  43. 'pathex': [],
  44. }