xeonthread

Untitled

Jul 3rd, 2019
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. # Copyright (c) 2019 Riverbank Computing Limited <[email protected]>
  2. #
  3. # This file is part of PyQt5.
  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. #
  14. # This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  15. # WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  16.  
  17.  
  18. def find_qt():
  19. import os
  20.  
  21. path = os.environ['PATH']
  22. curdir = os.getcwd()
  23. dll_curdir = curdir + '\\Qt5Core.dll'
  24. dll_dir = os.path.dirname(__file__) + '\\Qt\\bin'
  25.  
  26. if os.path.isfile(dll_curdir):
  27. path = curdir + ';' + path
  28. os.environ['PATH'] = path
  29. elif os.path.isfile(dll_dir + '\\Qt5Core.dll'):
  30. path = dll_dir + ';' + path
  31. os.environ['PATH'] = path
  32. else:
  33. for dll_dir in path.split(';'):
  34. if os.path.isfile(dll_dir + '\\Qt5Core.dll'):
  35. break
  36. else:
  37. raise ImportError("unable to find Qt5Core.dll on PATH")
  38.  
  39. try:
  40. os.add_dll_directory(dll_dir)
  41. os.add_dll_directory(curdir)
  42.  
  43. except AttributeError:
  44. pass
  45.  
  46. find_qt()
  47. del find_qt
Advertisement
Add Comment
Please, Sign In to add comment