__init__.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  2. #
  3. # This file is part of PyQt6.
  4. #
  5. # This file may be used under the terms of the GNU General Public License
  6. # version 3.0 as published by the Free Software Foundation and appearing in
  7. # the file LICENSE included in the packaging of this file. Please review the
  8. # following information to ensure the GNU General Public License version 3.0
  9. # requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  10. #
  11. # If you do not wish to use this file under the terms of the GPL version 3.0
  12. # then you may purchase a commercial license. For more information contact
  13. # info@riverbankcomputing.com.
  14. #
  15. # This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  16. # WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  17. # Support PyQt6 sub-packages that have been created by setuptools.
  18. __path__ = __import__('pkgutil').extend_path(__path__, __name__)
  19. def find_qt():
  20. import os, sys
  21. qtcore_dll = '\\Qt6Core.dll'
  22. dll_dir = os.path.dirname(sys.executable)
  23. if not os.path.isfile(dll_dir + qtcore_dll):
  24. path = os.environ['PATH']
  25. dll_dir = os.path.dirname(__file__) + '\\Qt6\\bin'
  26. if os.path.isfile(dll_dir + qtcore_dll):
  27. path = dll_dir + ';' + path
  28. os.environ['PATH'] = path
  29. else:
  30. for dll_dir in path.split(';'):
  31. if os.path.isfile(dll_dir + qtcore_dll):
  32. break
  33. else:
  34. return
  35. try:
  36. os.add_dll_directory(dll_dir)
  37. except AttributeError:
  38. pass
  39. find_qt()
  40. del find_qt