/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: John Arbash Meinel
  • Date: 2009-10-13 16:44:43 UTC
  • mto: This revision was merged to the branch mainline in revision 4741.
  • Revision ID: john@arbash-meinel.com-20091013164443-b92lnyiir2ucyguj
Stop using hash() because of bugs wrt pyrex 0.9.8.5

Rather than going directly to the Py_TYPE() object, I also use PyObject_Hash()
everywhere now. This simplifies the code a little bit, as I can declare it
returns -1 as an exception, rather than having to manually check the return
value.

What is really strange is that pyrex 0.9.7.2 gets it right, strange
regression to have. cython 0.11.3 also gets it right, but I don't know
that all versions of cython handle it correctly, either.


The main problem is that we are mixing, and then comparing
'other_hash = this_hash'. If we always used the 32-bit form, we would
be okay for our purposes, or always use the 64-bit form. I'm focusing
on the latter.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    'version':      bzrlib.__version__,
38
38
    'author':       'Canonical Ltd',
39
39
    'author_email': 'bazaar@lists.canonical.com',
40
 
    'url':          'http://bazaar.canonical.com/',
 
40
    'url':          'http://www.bazaar-vcs.org/',
41
41
    'description':  'Friendly distributed version control system',
42
42
    'license':      'GNU GPL v2',
43
 
    'download_url': 'https://launchpad.net/bzr/+download',
 
43
    'download_url': 'http://bazaar-vcs.org/Download',
44
44
    'long_description': get_long_description(),
45
45
    'classifiers': [
46
46
        'Development Status :: 6 - Mature',
186
186
    from distutils.command.build_ext import build_ext
187
187
else:
188
188
    have_pyrex = True
189
 
    pyrex_version_info = tuple(map(int, pyrex_version.split('.')))
190
189
 
191
190
 
192
191
class build_ext_if_possible(build_ext):
271
270
 
272
271
add_pyrex_extension('bzrlib._annotator_pyx')
273
272
add_pyrex_extension('bzrlib._bencode_pyx')
 
273
add_pyrex_extension('bzrlib._btree_serializer_pyx')
274
274
add_pyrex_extension('bzrlib._chunks_to_lines_pyx')
275
275
add_pyrex_extension('bzrlib._groupcompress_pyx',
276
276
                    extra_source=['bzrlib/diff-delta.c'])
283
283
    add_pyrex_extension('bzrlib._walkdirs_win32')
284
284
    z_lib = 'zdll'
285
285
else:
286
 
    if have_pyrex and pyrex_version_info[:3] == (0,9,4):
 
286
    if have_pyrex and pyrex_version == '0.9.4.1':
287
287
        # Pyrex 0.9.4.1 fails to compile this extension correctly
288
288
        # The code it generates re-uses a "local" pointer and
289
289
        # calls "PY_DECREF" after having set it to NULL. (It mixes PY_XDECREF
290
290
        # which is NULL safe with PY_DECREF which is not.)
291
 
        # <https://bugs.edge.launchpad.net/bzr/+bug/449372>
292
 
        # <https://bugs.edge.launchpad.net/bzr/+bug/276868>
293
291
        print 'Cannot build extension "bzrlib._dirstate_helpers_pyx" using'
294
292
        print 'your version of pyrex "%s". Please upgrade your pyrex' % (
295
293
            pyrex_version,)
302
300
add_pyrex_extension('bzrlib._chk_map_pyx', libraries=[z_lib])
303
301
ext_modules.append(Extension('bzrlib._patiencediff_c',
304
302
                             ['bzrlib/_patiencediff_c.c']))
305
 
if have_pyrex and pyrex_version_info < (0, 9, 6, 3):
306
 
    print
307
 
    print 'Your Pyrex/Cython version %s is too old to build the simple_set' % (
308
 
        pyrex_version)
309
 
    print 'and static_tuple extensions.'
310
 
    print 'Please upgrade to at least Pyrex 0.9.6.3'
311
 
    print
312
 
    # TODO: Should this be a fatal error?
313
 
else:
314
 
    # We only need 0.9.6.3 to build _simple_set_pyx, but static_tuple depends
315
 
    # on simple_set
316
 
    add_pyrex_extension('bzrlib._simple_set_pyx')
317
 
    ext_modules.append(Extension('bzrlib._static_tuple_c',
318
 
                                 ['bzrlib/_static_tuple_c.c']))
319
 
add_pyrex_extension('bzrlib._btree_serializer_pyx')
320
 
 
 
303
add_pyrex_extension('bzrlib._simple_set_pyx')
 
304
ext_modules.append(Extension('bzrlib._static_tuple_c',
 
305
                             ['bzrlib/_static_tuple_c.c']))
321
306
 
322
307
if unavailable_files:
323
308
    print 'C extension(s) not found:'
349
334
    # Ensure tbzrlib itself is on sys.path
350
335
    sys.path.append(tbzr_root)
351
336
 
 
337
    # Ensure our COM "entry-point" is on sys.path
 
338
    sys.path.append(os.path.join(tbzr_root, "shellext", "python"))
 
339
 
352
340
    packages.append("tbzrlib")
353
341
 
354
342
    # collect up our icons.
376
364
    excludes.extend("""pywin pywin.dialogs pywin.dialogs.list
377
365
                       win32ui crawler.Crawler""".split())
378
366
 
 
367
    # NOTE: We still create a DLL version of the Python implemented shell
 
368
    # extension for testing purposes - but it is *not* registered by
 
369
    # default - our C++ one is instead.  To discourage people thinking
 
370
    # this DLL is still necessary, its called 'tbzr_old.dll'
 
371
    tbzr = dict(
 
372
        modules=["tbzr"],
 
373
        create_exe = False, # we only want a .dll
 
374
        dest_base = 'tbzr_old',
 
375
    )
 
376
    com_targets.append(tbzr)
 
377
 
379
378
    # tbzrcache executables - a "console" version for debugging and a
380
379
    # GUI version that is generally used.
381
380
    tbzrcache = dict(
406
405
    console_targets.append(tracer)
407
406
 
408
407
    # The C++ implemented shell extensions.
409
 
    dist_dir = os.path.join(tbzr_root, "shellext", "build")
 
408
    dist_dir = os.path.join(tbzr_root, "shellext", "cpp", "tbzrshellext",
 
409
                            "build", "dist")
410
410
    data_files.append(('', [os.path.join(dist_dir, 'tbzrshellext_x86.dll')]))
411
411
    data_files.append(('', [os.path.join(dist_dir, 'tbzrshellext_x64.dll')]))
412
412
 
415
415
    # PyQt4 itself still escapes the plugin detection code for some reason...
416
416
    packages.append('PyQt4')
417
417
    excludes.append('PyQt4.elementtree.ElementTree')
418
 
    excludes.append('PyQt4.uic.port_v3')
419
418
    includes.append('sip') # extension module required for Qt.
420
419
    packages.append('pygments') # colorizer for qbzr
421
420
    packages.append('docutils') # html formatting
470
469
 
471
470
def get_svn_py2exe_info(includes, excludes, packages):
472
471
    packages.append('subvertpy')
473
 
    packages.append('sqlite3')
474
472
 
475
473
 
476
474
if 'bdist_wininst' in sys.argv:
554
552
                                     version = version_str,
555
553
                                     description = META_INFO['description'],
556
554
                                     author = META_INFO['author'],
557
 
                                     copyright = "(c) Canonical Ltd, 2005-2010",
 
555
                                     copyright = "(c) Canonical Ltd, 2005-2009",
558
556
                                     company_name = "Canonical Ltd.",
559
557
                                     comments = META_INFO['description'],
560
558
                                    )
573
571
    if sys.version.startswith('2.4'):
574
572
        # adding elementtree package
575
573
        additional_packages.add('elementtree')
576
 
    elif sys.version.startswith('2.6') or sys.version.startswith('2.5'):
 
574
    elif sys.version.startswith('2.5'):
577
575
        additional_packages.add('xml.etree')
578
576
    else:
579
577
        import warnings
625
623
            excludes.extend(["bzrlib.plugins." + d for d in dirs])
626
624
        x = []
627
625
        for i in files:
628
 
            # Throw away files we don't want packaged. Note that plugins may
629
 
            # have data files with all sorts of extensions so we need to
630
 
            # be conservative here about what we ditch.
631
 
            ext = os.path.splitext(i)[1]
632
 
            if ext.endswith('~') or ext in [".pyc", ".swp"]:
 
626
            if os.path.splitext(i)[1] not in [".py", ".pyd", ".dll", ".mo"]:
633
627
                continue
634
628
            if i == '__init__.py' and root == 'bzrlib/plugins':
635
629
                continue
649
643
                       'tools/win32/bzr_postinstall.py',
650
644
                       ]
651
645
    gui_targets = []
 
646
    com_targets = []
652
647
    data_files = topics_files + plugins_files
653
648
 
654
649
    if 'qbzr' in plugins:
699
694
    setup(options=options_list,
700
695
          console=console_targets,
701
696
          windows=gui_targets,
 
697
          com_server=com_targets,
702
698
          zipfile='lib/library.zip',
703
699
          data_files=data_files,
704
700
          cmdclass={'install_data': install_data_with_bytecompile},
712
708
        # easy_install one
713
709
        DATA_FILES = [('man/man1', ['bzr.1'])]
714
710
 
715
 
    if sys.platform != 'win32':
716
 
        # see https://wiki.kubuntu.org/Apport/DeveloperHowTo
717
 
        #
718
 
        # checking the paths and hardcoding the check for root is a bit gross,
719
 
        # but I don't see a cleaner way to find out the locations in a way
720
 
        # that's going to align with the hardcoded paths in apport.
721
 
        if os.geteuid() == 0:
722
 
            DATA_FILES += [
723
 
                ('/usr/share/apport/package-hooks',
724
 
                    ['apport/source_bzr.py']),
725
 
                ('/etc/apport/crashdb.conf.d/',
726
 
                    ['apport/bzr-crashdb.conf']),]
727
 
 
728
711
    # std setup
729
712
    ARGS = {'scripts': ['bzr'],
730
713
            'data_files': DATA_FILES,