~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

merge 2.0 branch rev 4647

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
148
152
    def run(self):
149
153
        build.run(self)
150
154
 
151
 
        import generate_docs
 
155
        from tools import generate_docs
152
156
        generate_docs.main(argv=["bzr", "man"])
153
157
 
154
158
 
242
246
    c_name = path + '.c'
243
247
    define_macros = []
244
248
    if sys.platform == 'win32':
245
 
        # pyrex uses the macro WIN32 to detect the platform, even though it should
246
 
        # be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
247
 
        # right value.
 
249
        # pyrex uses the macro WIN32 to detect the platform, even though it
 
250
        # should be using something like _WIN32 or MS_WINDOWS, oh well, we can
 
251
        # give it the right value.
248
252
        define_macros.append(('WIN32', None))
249
253
    if have_pyrex:
250
254
        source = [pyrex_name]
259
263
        define_macros=define_macros, libraries=libraries))
260
264
 
261
265
 
 
266
add_pyrex_extension('bzrlib._annotator_pyx')
262
267
add_pyrex_extension('bzrlib._bencode_pyx')
263
 
add_pyrex_extension('bzrlib._btree_serializer_c')
 
268
add_pyrex_extension('bzrlib._btree_serializer_pyx')
264
269
add_pyrex_extension('bzrlib._chunks_to_lines_pyx')
265
270
add_pyrex_extension('bzrlib._groupcompress_pyx',
266
271
                    extra_source=['bzrlib/diff-delta.c'])
267
 
add_pyrex_extension('bzrlib._knit_load_data_c')
 
272
add_pyrex_extension('bzrlib._knit_load_data_pyx')
 
273
add_pyrex_extension('bzrlib._known_graph_pyx')
268
274
add_pyrex_extension('bzrlib._rio_pyx')
269
275
if sys.platform == 'win32':
270
 
    add_pyrex_extension('bzrlib._dirstate_helpers_c',
 
276
    add_pyrex_extension('bzrlib._dirstate_helpers_pyx',
271
277
                        libraries=['Ws2_32'])
272
278
    add_pyrex_extension('bzrlib._walkdirs_win32')
273
279
    z_lib = 'zdll'
277
283
        # The code it generates re-uses a "local" pointer and
278
284
        # calls "PY_DECREF" after having set it to NULL. (It mixes PY_XDECREF
279
285
        # which is NULL safe with PY_DECREF which is not.)
280
 
        print 'Cannot build extension "bzrlib._dirstate_helpers_c" using'
 
286
        print 'Cannot build extension "bzrlib._dirstate_helpers_pyx" using'
281
287
        print 'your version of pyrex "%s". Please upgrade your pyrex' % (
282
288
            pyrex_version,)
283
289
        print 'install. For now, the non-compiled (python) version will'
284
290
        print 'be used instead.'
285
291
    else:
286
 
        add_pyrex_extension('bzrlib._dirstate_helpers_c')
 
292
        add_pyrex_extension('bzrlib._dirstate_helpers_pyx')
287
293
    add_pyrex_extension('bzrlib._readdir_pyx')
288
294
    z_lib = 'z'
289
295
add_pyrex_extension('bzrlib._chk_map_pyx', libraries=[z_lib])
290
 
ext_modules.append(Extension('bzrlib._patiencediff_c', ['bzrlib/_patiencediff_c.c']))
 
296
ext_modules.append(Extension('bzrlib._patiencediff_c',
 
297
                             ['bzrlib/_patiencediff_c.c']))
291
298
 
292
299
 
293
300
if unavailable_files:
397
404
    data_files.append(('', [os.path.join(dist_dir, 'tbzrshellext_x64.dll')]))
398
405
 
399
406
 
400
 
def get_qbzr_py2exe_info(includes, excludes, packages):
 
407
def get_qbzr_py2exe_info(includes, excludes, packages, data_files):
401
408
    # PyQt4 itself still escapes the plugin detection code for some reason...
402
409
    packages.append('PyQt4')
403
410
    excludes.append('PyQt4.elementtree.ElementTree')
411
418
        QtSql4.dll QtTest4.dll QtWebKit4.dll QtXml4.dll
412
419
        qscintilla2.dll""".split())
413
420
    # the qt binaries might not be on PATH...
414
 
    qt_dir = os.path.join(sys.prefix, "PyQt4", "bin")
415
 
    path = os.environ.get("PATH","")
416
 
    if qt_dir.lower() not in [p.lower() for p in path.split(os.pathsep)]:
417
 
        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?')
418
460
 
419
461
 
420
462
def get_svn_py2exe_info(includes, excludes, packages):
535
577
                  ImaginaryModule cElementTree elementtree.ElementTree
536
578
                  Crypto.PublicKey._fastmath
537
579
                  medusa medusa.filesys medusa.ftp_server
538
 
                  tools tools.doc_generate
 
580
                  tools
539
581
                  resource validate""".split()
540
582
    dll_excludes = []
541
583
 
597
639
    data_files = topics_files + plugins_files
598
640
 
599
641
    if 'qbzr' in plugins:
600
 
        get_qbzr_py2exe_info(includes, excludes, packages)
 
642
        get_qbzr_py2exe_info(includes, excludes, packages, data_files)
601
643
 
602
644
    if 'svn' in plugins:
603
645
        get_svn_py2exe_info(includes, excludes, packages)
654
696
    # ad-hoc for easy_install
655
697
    DATA_FILES = []
656
698
    if not 'bdist_egg' in sys.argv:
657
 
        # generate and install bzr.1 only with plain install, not easy_install one
 
699
        # generate and install bzr.1 only with plain install, not the
 
700
        # easy_install one
658
701
        DATA_FILES = [('man/man1', ['bzr.1'])]
659
702
 
660
703
    # std setup