~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Alexander Belchenko
  • Date: 2009-08-04 10:06:30 UTC
  • mto: This revision was merged to the branch mainline in revision 4589.
  • Revision ID: bialix@ukr.net-20090804100630-w8qiper6rucyglri
Bundle imageformats plugins for PyQt4 into bzr.exe installer to enable support of many image formats in QBzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
BZRLIB['packages'] = get_bzrlib_packages()
94
94
 
95
95
 
 
96
from distutils import log
96
97
from distutils.core import setup
97
98
from distutils.command.install_scripts import install_scripts
98
99
from distutils.command.install_data import install_data
400
401
    data_files.append(('', [os.path.join(dist_dir, 'tbzrshellext_x64.dll')]))
401
402
 
402
403
 
403
 
def get_qbzr_py2exe_info(includes, excludes, packages):
 
404
def get_qbzr_py2exe_info(includes, excludes, packages, data_files):
404
405
    # PyQt4 itself still escapes the plugin detection code for some reason...
405
406
    packages.append('PyQt4')
406
407
    excludes.append('PyQt4.elementtree.ElementTree')
415
416
        qscintilla2.dll""".split())
416
417
    # the qt binaries might not be on PATH...
417
418
    qt_dir = os.path.join(sys.prefix, "PyQt4", "bin")
418
 
    path = os.environ.get("PATH","")
419
 
    if qt_dir.lower() not in [p.lower() for p in path.split(os.pathsep)]:
420
 
        os.environ["PATH"] = path + os.pathsep + qt_dir
 
419
    if os.path.isdir(qt_dir):
 
420
        path = os.environ.get("PATH","")
 
421
        if qt_dir.lower() not in [p.lower() for p in path.split(os.pathsep)]:
 
422
            os.environ["PATH"] = path + os.pathsep + qt_dir
 
423
    # add imageformats plugins to distribution
 
424
    try:
 
425
        import PyQt4
 
426
    except ImportError:
 
427
        log.warn("Can't find PyQt4 installation -> skip imageformats plugins")
 
428
    else:
 
429
        imageformats = 'imageformats'
 
430
        plug_dir = os.path.join(os.path.dirname(PyQt4.__file__),
 
431
            'plugins', imageformats)
 
432
        if os.path.isdir(plug_dir):
 
433
            files = []
 
434
            for i in os.listdir(plug_dir):
 
435
                if i.endswith('.dll') and not i.endswith('d4.dll'):
 
436
                    files.append(os.path.join(plug_dir,i))
 
437
            if files:
 
438
                data_files.append((imageformats, files))
421
439
 
422
440
 
423
441
def get_svn_py2exe_info(includes, excludes, packages):
600
618
    data_files = topics_files + plugins_files
601
619
 
602
620
    if 'qbzr' in plugins:
603
 
        get_qbzr_py2exe_info(includes, excludes, packages)
 
621
        get_qbzr_py2exe_info(includes, excludes, packages, data_files)
604
622
 
605
623
    if 'svn' in plugins:
606
624
        get_svn_py2exe_info(includes, excludes, packages)