Rev 4589: (bialix) Include the image format plugins in the win32 all-in-one in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Aug 4 18:52:39 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4589 [merge]
revision-id: pqm at pqm.ubuntu.com-20090804175234-3e4oyzlwy1rb3mnj
parent: pqm at pqm.ubuntu.com-20090804162005-kyldsbg8c018fknc
parent: john at arbash-meinel.com-20090804154920-s561kuatso49851u
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2009-08-04 18:52:34 +0100
message:
  (bialix) Include the image format plugins in the win32 all-in-one
  	installer.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
  tools/win32/bzr.iss.cog        bzr.iss.cog-20060622100836-b3yup582rt3y0nvm-5
=== modified file 'NEWS'
--- a/NEWS	2009-08-04 14:10:09 +0000
+++ b/NEWS	2009-08-04 17:52:34 +0000
@@ -186,6 +186,11 @@
 * --subunit support now adds timestamps if the subunit version supports
   it. (Robert Collins)
 
+* The Windows all-in-one installer now bundles the PyQt image format
+  plugins, which allows previewing more images as part of 'qdiff'.
+  (Alexander Belchenko)
+
+
 Testing
 *******
 

=== modified file 'setup.py'
--- a/setup.py	2009-06-23 20:20:39 +0000
+++ b/setup.py	2009-08-04 15:21:43 +0000
@@ -93,6 +93,7 @@
 BZRLIB['packages'] = get_bzrlib_packages()
 
 
+from distutils import log
 from distutils.core import setup
 from distutils.command.install_scripts import install_scripts
 from distutils.command.install_data import install_data
@@ -400,7 +401,7 @@
     data_files.append(('', [os.path.join(dist_dir, 'tbzrshellext_x64.dll')]))
 
 
-def get_qbzr_py2exe_info(includes, excludes, packages):
+def get_qbzr_py2exe_info(includes, excludes, packages, data_files):
     # PyQt4 itself still escapes the plugin detection code for some reason...
     packages.append('PyQt4')
     excludes.append('PyQt4.elementtree.ElementTree')
@@ -414,10 +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")
-    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
+    # 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:
+        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):
@@ -600,7 +636,7 @@
     data_files = topics_files + plugins_files
 
     if 'qbzr' in plugins:
-        get_qbzr_py2exe_info(includes, excludes, packages)
+        get_qbzr_py2exe_info(includes, excludes, packages, data_files)
 
     if 'svn' in plugins:
         get_svn_py2exe_info(includes, excludes, packages)

=== modified file 'tools/win32/bzr.iss.cog'
--- a/tools/win32/bzr.iss.cog	2009-01-12 01:55:34 +0000
+++ b/tools/win32/bzr.iss.cog	2009-08-04 10:06:30 +0000
@@ -137,6 +137,18 @@
 ; ]]]
 ; [[[end]]]
 
+; imageformats plugins for PyQt4
+; [[[cog
+; plug_dir = os.path.join(os.path.dirname(cog.inFile), # $(bzr_src_root)/tools/win32
+;                         '..', '..', 'win32_bzr.exe', 'imageformats')
+; if os.path.isdir(plug_dir):
+;     cog.outl('Source: "imageformats\\*.*"; DestDir: "{app}\\imageformats"; '
+;              'Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete;')
+; else:
+;     cog.msg('imageformats plugins for PyQt4 not found')
+; ]]]
+; [[[end]]]
+
 [Types]
 Name: "typical"; Description: "A typical installation"
 Name: "full"; Description: "Full Installation (typical installation plus test utilities)"




More information about the bazaar-commits mailing list