Rev 4586: Rework the setup.py a little bit, to support other versions of PyQt in http://bazaar.launchpad.net/~jameinel/bzr/bzr.exe-qtimages
John Arbash Meinel
john at arbash-meinel.com
Tue Aug 4 16:22:10 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/bzr.exe-qtimages
------------------------------------------------------------
revno: 4586
revision-id: john at arbash-meinel.com-20090804152143-ka8g1obtvzeamoxs
parent: bialix at ukr.net-20090804100630-w8qiper6rucyglri
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: bzr.exe-qtimages
timestamp: Tue 2009-08-04 10:21:43 -0500
message:
Rework the setup.py a little bit, to support other versions of PyQt
-------------- next part --------------
=== modified file 'setup.py'
--- a/setup.py 2009-08-04 10:06:30 +0000
+++ b/setup.py 2009-08-04 15:21:43 +0000
@@ -415,27 +415,45 @@
QtSql4.dll QtTest4.dll QtWebKit4.dll QtXml4.dll
qscintilla2.dll""".split())
# the qt binaries might not be on PATH...
- qt_dir = os.path.join(sys.prefix, "PyQt4", "bin")
- if os.path.isdir(qt_dir):
- path = os.environ.get("PATH","")
- if qt_dir.lower() not in [p.lower() for p in path.split(os.pathsep)]:
- os.environ["PATH"] = path + os.pathsep + qt_dir
- # add imageformats plugins to distribution
+ # They seem to install to a place like C:\Python25\PyQt4\*
+ # Which is not the same as C:\Python25\Lib\site-packages\PyQt4
+ pyqt_dir = os.path.join(sys.prefix, "PyQt4")
+ pyqt_bin_dir = os.path.join(pyqt_dir, "bin")
+ if os.path.isdir(pyqt_bin_dir):
+ path = os.environ.get("PATH", "")
+ if pyqt_bin_dir.lower() not in [p.lower() for p in path.split(os.pathsep)]:
+ os.environ["PATH"] = path + os.pathsep + pyqt_bin_dir
+ # also add all imageformat plugins to distribution
+ # We will look in 2 places, dirname(PyQt4.__file__) and pyqt_dir
+ base_dirs_to_check = []
+ if os.path.isdir(pyqt_dir):
+ base_dirs_to_check.append(pyqt_dir)
try:
import PyQt4
except ImportError:
- log.warn("Can't find PyQt4 installation -> skip imageformats plugins")
- else:
- imageformats = 'imageformats'
- plug_dir = os.path.join(os.path.dirname(PyQt4.__file__),
- 'plugins', imageformats)
- if os.path.isdir(plug_dir):
- files = []
- for i in os.listdir(plug_dir):
- if i.endswith('.dll') and not i.endswith('d4.dll'):
- files.append(os.path.join(plug_dir,i))
- if files:
- data_files.append((imageformats, files))
+ pass
+ else:
+ pyqt4_base_dir = os.path.dirname(PyQt4.__file__)
+ if pyqt4_base_dir != pyqt_dir:
+ base_dirs_to_check.append(pyqt4_base_dir)
+ if not base_dirs_to_check:
+ log.warn("Can't find PyQt4 installation -> not including imageformat"
+ " plugins")
+ else:
+ files = []
+ for base_dir in base_dirs_to_check:
+ plug_dir = os.path.join(base_dir, 'plugins', 'imageformats')
+ if os.path.isdir(plug_dir):
+ for fname in os.listdir(plug_dir):
+ # Include plugin dlls, but not debugging dlls
+ fullpath = os.path.join(plug_dir, fname)
+ if fname.endswith('.dll') and not fname.endswith('d4.dll'):
+ files.append(fullpath)
+ if files:
+ data_files.append(('imageformats', files))
+ else:
+ log.warn('PyQt4 was found, but we could not find any imageformat'
+ ' plugins. Are you sure your configuration is correct?')
def get_svn_py2exe_info(includes, excludes, packages):
More information about the bazaar-commits
mailing list