/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: Jelmer Vernooij
  • Date: 2017-05-21 18:10:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6623.
  • Revision ID: jelmer@jelmer.uk-20170521181028-zn04pdfw0od9hfj3
Rename brzlib => breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
# NOTE: The directory containing setup.py, whether run by 'python setup.py' or
20
20
# './setup.py' or the equivalent with another path, should always be at the
21
21
# start of the path, so this should find the right one...
22
 
import brzlib
 
22
import breezy
23
23
 
24
24
def get_long_description():
25
25
    dirname = os.path.dirname(__file__)
36
36
# see http://docs.python.org/dist/meta-data.html
37
37
META_INFO = {
38
38
    'name':         'brz',
39
 
    'version':      brzlib.__version__,
 
39
    'version':      breezy.__version__,
40
40
    'author':       'Canonical Ltd',
41
41
    'author_email': 'bazaar@lists.canonical.com',
42
42
    'maintainer':   'Breezy Developers',
65
65
BZRLIB = {}
66
66
 
67
67
PKG_DATA = {# install files from selftest suite
68
 
            'package_data': {'brzlib': ['doc/api/*.txt',
 
68
            'package_data': {'breezy': ['doc/api/*.txt',
69
69
                                        'tests/test_patches_data/*',
70
70
                                        'help_topics/en/*.txt',
71
71
                                        'tests/ssl_certs/ca.crt',
75
75
                                       ]},
76
76
           }
77
77
I18N_FILES = []
78
 
for filepath in glob.glob("brzlib/locale/*/LC_MESSAGES/*.mo"):
79
 
    langfile = filepath[len("brzlib/locale/"):]
 
78
for filepath in glob.glob("breezy/locale/*/LC_MESSAGES/*.mo"):
 
79
    langfile = filepath[len("breezy/locale/"):]
80
80
    targetpath = os.path.dirname(os.path.join("share/locale", langfile))
81
81
    I18N_FILES.append((targetpath, [filepath]))
82
82
 
83
 
def get_brzlib_packages():
84
 
    """Recurse through the brzlib directory, and extract the package names"""
 
83
def get_breezy_packages():
 
84
    """Recurse through the breezy directory, and extract the package names"""
85
85
 
86
86
    packages = []
87
 
    base_path = os.path.dirname(os.path.abspath(brzlib.__file__))
 
87
    base_path = os.path.dirname(os.path.abspath(breezy.__file__))
88
88
    for root, dirs, files in os.walk(base_path):
89
89
        if '__init__.py' in files:
90
90
            assert root.startswith(base_path)
91
 
            # Get just the path below brzlib
 
91
            # Get just the path below breezy
92
92
            package_path = root[len(base_path):]
93
93
            # Remove leading and trailing slashes
94
94
            package_path = package_path.strip('\\/')
95
95
            if not package_path:
96
 
                package_name = 'brzlib'
 
96
                package_name = 'breezy'
97
97
            else:
98
 
                package_name = ('brzlib.' +
 
98
                package_name = ('breezy.' +
99
99
                            package_path.replace('/', '.').replace('\\', '.'))
100
100
            packages.append(package_name)
101
101
    return sorted(packages)
102
102
 
103
103
 
104
 
BZRLIB['packages'] = get_brzlib_packages()
 
104
BZRLIB['packages'] = get_breezy_packages()
105
105
 
106
106
 
107
107
from distutils import log
146
146
            return path
147
147
 
148
148
    def _win_batch_args(self):
149
 
        from brzlib.win32utils import winver
 
149
        from breezy.win32utils import winver
150
150
        if winver == 'Windows NT':
151
151
            return '%*'
152
152
        else:
174
174
## Setup
175
175
########################
176
176
 
177
 
from brzlib.bzr_distutils import build_mo
 
177
from breezy.bzr_distutils import build_mo
178
178
 
179
179
command_classes = {'install_scripts': my_install_scripts,
180
180
                   'build': bzr_build,
288
288
        define_macros=define_macros, libraries=libraries))
289
289
 
290
290
 
291
 
add_pyrex_extension('brzlib._annotator_pyx')
292
 
add_pyrex_extension('brzlib._bencode_pyx')
293
 
add_pyrex_extension('brzlib._chunks_to_lines_pyx')
294
 
add_pyrex_extension('brzlib._groupcompress_pyx',
295
 
                    extra_source=['brzlib/diff-delta.c'])
296
 
add_pyrex_extension('brzlib._knit_load_data_pyx')
297
 
add_pyrex_extension('brzlib._known_graph_pyx')
298
 
add_pyrex_extension('brzlib._rio_pyx')
 
291
add_pyrex_extension('breezy._annotator_pyx')
 
292
add_pyrex_extension('breezy._bencode_pyx')
 
293
add_pyrex_extension('breezy._chunks_to_lines_pyx')
 
294
add_pyrex_extension('breezy._groupcompress_pyx',
 
295
                    extra_source=['breezy/diff-delta.c'])
 
296
add_pyrex_extension('breezy._knit_load_data_pyx')
 
297
add_pyrex_extension('breezy._known_graph_pyx')
 
298
add_pyrex_extension('breezy._rio_pyx')
299
299
if sys.platform == 'win32':
300
 
    add_pyrex_extension('brzlib._dirstate_helpers_pyx',
 
300
    add_pyrex_extension('breezy._dirstate_helpers_pyx',
301
301
                        libraries=['Ws2_32'])
302
 
    add_pyrex_extension('brzlib._walkdirs_win32')
 
302
    add_pyrex_extension('breezy._walkdirs_win32')
303
303
else:
304
304
    if have_pyrex and pyrex_version_info == LooseVersion("0.9.4.1"):
305
305
        # Pyrex 0.9.4.1 fails to compile this extension correctly
308
308
        # which is NULL safe with PY_DECREF which is not.)
309
309
        # <https://bugs.launchpad.net/bzr/+bug/449372>
310
310
        # <https://bugs.launchpad.net/bzr/+bug/276868>
311
 
        print('Cannot build extension "brzlib._dirstate_helpers_pyx" using')
 
311
        print('Cannot build extension "breezy._dirstate_helpers_pyx" using')
312
312
        print('your version of pyrex "%s". Please upgrade your pyrex'
313
313
              % (pyrex_version,))
314
314
        print('install. For now, the non-compiled (python) version will')
315
315
        print('be used instead.')
316
316
    else:
317
 
        add_pyrex_extension('brzlib._dirstate_helpers_pyx')
318
 
    add_pyrex_extension('brzlib._readdir_pyx')
319
 
add_pyrex_extension('brzlib._chk_map_pyx')
320
 
ext_modules.append(Extension('brzlib._patiencediff_c',
321
 
                             ['brzlib/_patiencediff_c.c']))
 
317
        add_pyrex_extension('breezy._dirstate_helpers_pyx')
 
318
    add_pyrex_extension('breezy._readdir_pyx')
 
319
add_pyrex_extension('breezy._chk_map_pyx')
 
320
ext_modules.append(Extension('breezy._patiencediff_c',
 
321
                             ['breezy/_patiencediff_c.c']))
322
322
if have_pyrex and pyrex_version_info < LooseVersion("0.9.6.3"):
323
323
    print("")
324
324
    print('Your Pyrex/Cython version %s is too old to build the simple_set' % (
330
330
else:
331
331
    # We only need 0.9.6.3 to build _simple_set_pyx, but static_tuple depends
332
332
    # on simple_set
333
 
    add_pyrex_extension('brzlib._simple_set_pyx')
334
 
    ext_modules.append(Extension('brzlib._static_tuple_c',
335
 
                                 ['brzlib/_static_tuple_c.c']))
336
 
add_pyrex_extension('brzlib._btree_serializer_pyx')
 
333
    add_pyrex_extension('breezy._simple_set_pyx')
 
334
    ext_modules.append(Extension('breezy._static_tuple_c',
 
335
                                 ['breezy/_static_tuple_c.c']))
 
336
add_pyrex_extension('breezy._btree_serializer_pyx')
337
337
 
338
338
 
339
339
if unavailable_files:
363
363
    # TBZR points to the TBZR directory
364
364
    tbzr_root = os.environ["TBZR"]
365
365
 
366
 
    # Ensure tbrzlib itself is on sys.path
 
366
    # Ensure tbreezy itself is on sys.path
367
367
    sys.path.append(tbzr_root)
368
368
 
369
 
    packages.append("tbrzlib")
 
369
    packages.append("tbreezy")
370
370
 
371
371
    # collect up our icons.
372
372
    cwd = os.getcwd()
373
 
    ico_root = os.path.join(tbzr_root, 'tbrzlib', 'resources')
 
373
    ico_root = os.path.join(tbzr_root, 'tbreezy', 'resources')
374
374
    icos = [] # list of (path_root, relative_ico_path)
375
375
    # First always brz's icon and its in the root of the brz tree.
376
376
    icos.append(('', 'brz.ico'))
524
524
 
525
525
    ARGS.update(META_INFO)
526
526
    ARGS.update(BZRLIB)
527
 
    PKG_DATA['package_data']['brzlib'].append('locale/*/LC_MESSAGES/*.mo')
 
527
    PKG_DATA['package_data']['breezy'].append('locale/*/LC_MESSAGES/*.mo')
528
528
    ARGS.update(PKG_DATA)
529
529
 
530
530
    setup(**ARGS)
534
534
    import py2exe
535
535
 
536
536
    # pick real brz version
537
 
    import brzlib
 
537
    import breezy
538
538
 
539
539
    version_number = []
540
 
    for i in brzlib.version_info[:4]:
 
540
    for i in breezy.version_info[:4]:
541
541
        try:
542
542
            i = int(i)
543
543
        except ValueError:
590
590
    gui_target.dest_base = "bzrw"
591
591
 
592
592
    packages = BZRLIB['packages']
593
 
    packages.remove('brzlib')
594
 
    packages = [i for i in packages if not i.startswith('brzlib.plugins')]
 
593
    packages.remove('breezy')
 
594
    packages = [i for i in packages if not i.startswith('breezy.plugins')]
595
595
    includes = []
596
 
    for i in glob.glob('brzlib\\*.py'):
 
596
    for i in glob.glob('breezy\\*.py'):
597
597
        module = i[:-3].replace('\\', '.')
598
598
        if module.endswith('__init__'):
599
599
            module = module[:-len('__init__')]
634
634
        excludes.append("email.MIME" + oldname)
635
635
 
636
636
    # text files for help topis
637
 
    text_topics = glob.glob('brzlib/help_topics/en/*.txt')
 
637
    text_topics = glob.glob('breezy/help_topics/en/*.txt')
638
638
    topics_files = [('lib/help_topics/en', text_topics)]
639
639
 
640
640
    # built-in plugins
643
643
    # which hard-codes the list of plugins, gets more upset if modules are
644
644
    # missing, etc?
645
645
    plugins = None # will be a set after plugin sniffing...
646
 
    for root, dirs, files in os.walk('brzlib/plugins'):
647
 
        if root == 'brzlib/plugins':
 
646
    for root, dirs, files in os.walk('breezy/plugins'):
 
647
        if root == 'breezy/plugins':
648
648
            plugins = set(dirs)
649
649
            # We ship plugins as normal files on the file-system - however,
650
650
            # the build process can cause *some* of these plugin files to end
652
652
            # library.zip, and then saw import errors related to that as the
653
653
            # rest of the svn plugin wasn't. So we tell py2exe to leave the
654
654
            # plugins out of the .zip file
655
 
            excludes.extend(["brzlib.plugins." + d for d in dirs])
 
655
            excludes.extend(["breezy.plugins." + d for d in dirs])
656
656
        x = []
657
657
        for i in files:
658
658
            # Throw away files we don't want packaged. Note that plugins may
661
661
            ext = os.path.splitext(i)[1]
662
662
            if ext.endswith('~') or ext in [".pyc", ".swp"]:
663
663
                continue
664
 
            if i == '__init__.py' and root == 'brzlib/plugins':
 
664
            if i == '__init__.py' and root == 'breezy/plugins':
665
665
                continue
666
666
            x.append(os.path.join(root, i))
667
667
        if x:
668
 
            target_dir = root[len('brzlib/'):]  # install to 'plugins/...'
 
668
            target_dir = root[len('breezy/'):]  # install to 'plugins/...'
669
669
            plugins_files.append((target_dir, x))
670
670
    # find modules for built-in plugins
671
671
    import tools.package_mf
672
672
    mf = tools.package_mf.CustomModuleFinder()
673
 
    mf.run_package('brzlib/plugins')
 
673
    mf.run_package('breezy/plugins')
674
674
    packs, mods = mf.get_result()
675
675
    additional_packages.update(packs)
676
676
    includes.extend(mods)