Skip to content

Commit

Permalink
Issue pyinstaller#521: On Windows extend system PATH for PyQt4 hook.
Browse files Browse the repository at this point in the history
  • Loading branch information
matysek committed Jan 2, 2015
1 parent fea83b7 commit d20dcbe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 4 additions & 2 deletions PyInstaller/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ def __add_obsolete_options(parser):
# Site-packages functions - use native function if available.
if hasattr(site, 'getsitepackages'):
getsitepackages = site.getsitepackages
# Backported For Python 2.6.
# Backported For Python 2.6 and virtualenv.
# Module 'site' in virtualenv might not have this attribute.
else:
def getsitepackages():
"""
Expand All @@ -350,7 +351,8 @@ def getsitepackages():
pths = [os.path.join(sys.prefix, 'Lib', 'site-packages')]
# Include Real sys.prefix for virtualenv.
if is_virtualenv:
pths.append[os.path.join(venv_real_prefix, 'Lib', 'site-packages')]
pths.append(os.path.join(venv_real_prefix, 'Lib', 'site-packages'))
return pths
else:
# TODO Implement for Python 2.6 on other platforms.
raise NotImplementedError()
12 changes: 11 additions & 1 deletion PyInstaller/hooks/hook-PyQt4.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,18 @@
#-----------------------------------------------------------------------------


import os

from PyInstaller.hooks.hookutils import qt4_menu_nib_dir
from PyInstaller.compat import is_darwin
from PyInstaller.compat import getsitepackages, is_darwin, is_win


# On Windows system PATH has to be extended to point to the PyQt4 directory.
# The PySide directory contains Qt dlls. We need to avoid including different
# version of Qt libraries when there is installed another application (e.g. QtCreator)
if is_win:
from PyInstaller.utils.winutils import extend_system_path
extend_system_path([os.path.join(x, 'PyQt4') for x in getsitepackages()])


# In the new consolidated mode any PyQt depends on _qt
Expand Down

0 comments on commit d20dcbe

Please sign in to comment.