~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Martin Pool
  • Date: 2009-09-14 01:48:28 UTC
  • mfrom: (4685 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4688.
  • Revision ID: mbp@sourcefrog.net-20090914014828-ydr9rlkdfq2sv57z
Merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
            'package_data': {'bzrlib': ['doc/api/*.txt',
66
66
                                        'tests/test_patches_data/*',
67
67
                                        'help_topics/en/*.txt',
 
68
                                        'tests/ssl_certs/server_without_pass.key',
 
69
                                        'tests/ssl_certs/server_with_pass.key',
 
70
                                        'tests/ssl_certs/server.crt'
68
71
                                       ]},
69
72
           }
70
73
 
93
96
BZRLIB['packages'] = get_bzrlib_packages()
94
97
 
95
98
 
 
99
from distutils import log
96
100
from distutils.core import setup
97
101
from distutils.command.install_scripts import install_scripts
98
102
from distutils.command.install_data import install_data
400
404
    data_files.append(('', [os.path.join(dist_dir, 'tbzrshellext_x64.dll')]))
401
405
 
402
406
 
403
 
def get_qbzr_py2exe_info(includes, excludes, packages):
 
407
def get_qbzr_py2exe_info(includes, excludes, packages, data_files):
404
408
    # PyQt4 itself still escapes the plugin detection code for some reason...
405
409
    packages.append('PyQt4')
406
410
    excludes.append('PyQt4.elementtree.ElementTree')
414
418
        QtSql4.dll QtTest4.dll QtWebKit4.dll QtXml4.dll
415
419
        qscintilla2.dll""".split())
416
420
    # the qt binaries might not be on PATH...
417
 
    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
 
421
    # They seem to install to a place like C:\Python25\PyQt4\*
 
422
    # Which is not the same as C:\Python25\Lib\site-packages\PyQt4
 
423
    pyqt_dir = os.path.join(sys.prefix, "PyQt4")
 
424
    pyqt_bin_dir = os.path.join(pyqt_dir, "bin")
 
425
    if os.path.isdir(pyqt_bin_dir):
 
426
        path = os.environ.get("PATH", "")
 
427
        if pyqt_bin_dir.lower() not in [p.lower() for p in path.split(os.pathsep)]:
 
428
            os.environ["PATH"] = path + os.pathsep + pyqt_bin_dir
 
429
    # also add all imageformat plugins to distribution
 
430
    # We will look in 2 places, dirname(PyQt4.__file__) and pyqt_dir
 
431
    base_dirs_to_check = []
 
432
    if os.path.isdir(pyqt_dir):
 
433
        base_dirs_to_check.append(pyqt_dir)
 
434
    try:
 
435
        import PyQt4
 
436
    except ImportError:
 
437
        pass
 
438
    else:
 
439
        pyqt4_base_dir = os.path.dirname(PyQt4.__file__)
 
440
        if pyqt4_base_dir != pyqt_dir:
 
441
            base_dirs_to_check.append(pyqt4_base_dir)
 
442
    if not base_dirs_to_check:
 
443
        log.warn("Can't find PyQt4 installation -> not including imageformat"
 
444
                 " plugins")
 
445
    else:
 
446
        files = []
 
447
        for base_dir in base_dirs_to_check:
 
448
            plug_dir = os.path.join(base_dir, 'plugins', 'imageformats')
 
449
            if os.path.isdir(plug_dir):
 
450
                for fname in os.listdir(plug_dir):
 
451
                    # Include plugin dlls, but not debugging dlls
 
452
                    fullpath = os.path.join(plug_dir, fname)
 
453
                    if fname.endswith('.dll') and not fname.endswith('d4.dll'):
 
454
                        files.append(fullpath)
 
455
        if files:
 
456
            data_files.append(('imageformats', files))
 
457
        else:
 
458
            log.warn('PyQt4 was found, but we could not find any imageformat'
 
459
                     ' plugins. Are you sure your configuration is correct?')
421
460
 
422
461
 
423
462
def get_svn_py2exe_info(includes, excludes, packages):
505
544
                                     version = version_str,
506
545
                                     description = META_INFO['description'],
507
546
                                     author = META_INFO['author'],
508
 
                                     copyright = "(c) Canonical Ltd, 2005-2007",
 
547
                                     copyright = "(c) Canonical Ltd, 2005-2009",
509
548
                                     company_name = "Canonical Ltd.",
510
549
                                     comments = META_INFO['description'],
511
550
                                    )
600
639
    data_files = topics_files + plugins_files
601
640
 
602
641
    if 'qbzr' in plugins:
603
 
        get_qbzr_py2exe_info(includes, excludes, packages)
 
642
        get_qbzr_py2exe_info(includes, excludes, packages, data_files)
604
643
 
605
644
    if 'svn' in plugins:
606
645
        get_svn_py2exe_info(includes, excludes, packages)