/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: 2019-05-29 03:22:34 UTC
  • mfrom: (7303 work)
  • mto: This revision was merged to the branch mainline in revision 7306.
  • Revision ID: jelmer@jelmer.uk-20190529032234-mt3fuws8gq03tapi
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
    sys.stderr.write("[ERROR] Not a supported Python version. Need 2.7+\n")
17
17
    sys.exit(1)
18
18
 
 
19
 
 
20
try:
 
21
    import setuptools
 
22
except ImportError:
 
23
    sys.stderr.write("[ERROR] Please install setuptools\n")
 
24
    sys.exit(1)
 
25
 
 
26
 
19
27
# NOTE: The directory containing setup.py, whether run by 'python setup.py' or
20
28
# './setup.py' or the equivalent with another path, should always be at the
21
29
# start of the path, so this should find the right one...
32
40
# META INFORMATION FOR SETUP
33
41
# see http://docs.python.org/dist/meta-data.html
34
42
META_INFO = {
35
 
    'name':         'breezy',
36
 
    'version':      breezy.__version__,
37
 
    'maintainer':   'Breezy Developers',
38
 
    'maintainer_email':   'team@breezy-vcs.org',
39
 
    'url':          'https://www.breezy-vcs.org/',
40
 
    'description':  'Friendly distributed version control system',
41
 
    'license':      'GNU GPL v2',
 
43
    'name': 'breezy',
 
44
    'version': breezy.__version__,
 
45
    'maintainer': 'Breezy Developers',
 
46
    'maintainer_email': 'team@breezy-vcs.org',
 
47
    'url': 'https://www.breezy-vcs.org/',
 
48
    'description': 'Friendly distributed version control system',
 
49
    'license': 'GNU GPL v2',
42
50
    'download_url': 'https://launchpad.net/brz/+download',
43
51
    'long_description': get_long_description(),
44
52
    'classifiers': [
57
65
    'install_requires': [
58
66
        'configobj',
59
67
        'six>=1.9.0',
 
68
        'patiencediff',
60
69
        # Technically, Breezy works without these two dependencies too. But there's
61
70
        # no way to enable them by default and let users opt out.
62
71
        'fastimport>=0.9.8',
63
 
        'dulwich>=0.19.1',
 
72
        'dulwich>=0.19.11',
64
73
        ],
65
74
    'extras_require': {
66
75
        'fastimport': [],
67
76
        'git': [],
 
77
        'launchpad': ['launchpadlib>=1.6.3'],
68
78
        },
69
79
    'tests_require': [
70
80
        'testtools',
75
85
# that are part of BREEZY here.
76
86
BREEZY = {}
77
87
 
78
 
PKG_DATA = {# install files from selftest suite
79
 
            'package_data': {'breezy': ['doc/api/*.txt',
80
 
                                        'tests/test_patches_data/*',
81
 
                                        'help_topics/en/*.txt',
82
 
                                        'tests/ssl_certs/ca.crt',
83
 
                                        'tests/ssl_certs/server_without_pass.key',
84
 
                                        'tests/ssl_certs/server_with_pass.key',
85
 
                                        'tests/ssl_certs/server.crt',
86
 
                                       ]},
87
 
           }
 
88
PKG_DATA = {
 
89
    # install files from selftest suite
 
90
    'package_data': {'breezy': ['doc/api/*.txt',
 
91
                                'tests/test_patches_data/*',
 
92
                                'help_topics/en/*.txt',
 
93
                                'tests/ssl_certs/ca.crt',
 
94
                                'tests/ssl_certs/server_without_pass.key',
 
95
                                'tests/ssl_certs/server_with_pass.key',
 
96
                                'tests/ssl_certs/server.crt',
 
97
                                ]},
 
98
    }
88
99
I18N_FILES = []
89
100
for filepath in glob.glob("breezy/locale/*/LC_MESSAGES/*.mo"):
90
101
    langfile = filepath[len("breezy/locale/"):]
106
117
            if not package_path:
107
118
                package_name = 'breezy'
108
119
            else:
109
 
                package_name = ('breezy.' +
110
 
                            package_path.replace('/', '.').replace('\\', '.'))
 
120
                package_name = (
 
121
                    'breezy.' +
 
122
                    package_path.replace('/', '.').replace('\\', '.'))
111
123
            packages.append(package_name)
112
124
    return sorted(packages)
113
125
 
115
127
BREEZY['packages'] = get_breezy_packages()
116
128
 
117
129
 
118
 
from distutils import log
119
 
from distutils.core import setup
 
130
from setuptools import setup
120
131
from distutils.version import LooseVersion
121
132
from distutils.command.install_scripts import install_scripts
122
133
from distutils.command.install_data import install_data
170
181
    """
171
182
 
172
183
    sub_commands = build.sub_commands + [
173
 
            ('build_mo', lambda _: True),
174
 
            ]
 
184
        ('build_mo', lambda _: True),
 
185
        ]
175
186
 
176
187
    def run(self):
177
188
        build.run(self)
208
219
    print("")
209
220
    from distutils.command.build_ext import build_ext
210
221
else:
211
 
    have_cython = True
 
222
    minimum_cython_version = '0.29'
212
223
    cython_version_info = LooseVersion(cython_version)
 
224
    if cython_version_info < LooseVersion(minimum_cython_version):
 
225
        print("Version of Cython is too old. "
 
226
              "Current is %s, need at least %s."
 
227
              % (cython_version, minimum_cython_version))
 
228
        print("If the .c files are available, they will be built,"
 
229
              " but modifying the .pyx files will not rebuild them.")
 
230
        have_cython = False
 
231
    else:
 
232
        have_cython = True
213
233
 
214
234
 
215
235
class build_ext_if_possible(build_ext):
290
310
            source = [c_name]
291
311
    source.extend(extra_source)
292
312
    include_dirs = ['breezy']
293
 
    ext_modules.append(Extension(module_name, source,
294
 
        define_macros=define_macros, libraries=libraries,
295
 
        include_dirs=include_dirs))
 
313
    ext_modules.append(
 
314
        Extension(
 
315
            module_name, source, define_macros=define_macros,
 
316
            libraries=libraries, include_dirs=include_dirs))
296
317
 
297
318
 
298
319
add_cython_extension('breezy._simple_set_pyx')
302
323
add_cython_extension('breezy._bencode_pyx')
303
324
add_cython_extension('breezy._chunks_to_lines_pyx')
304
325
add_cython_extension('breezy.bzr._groupcompress_pyx',
305
 
                    extra_source=['breezy/bzr/diff-delta.c'])
 
326
                     extra_source=['breezy/bzr/diff-delta.c'])
306
327
add_cython_extension('breezy.bzr._knit_load_data_pyx')
307
328
add_cython_extension('breezy._known_graph_pyx')
308
329
add_cython_extension('breezy._rio_pyx')
309
330
if sys.platform == 'win32':
310
331
    add_cython_extension('breezy.bzr._dirstate_helpers_pyx',
311
 
                        libraries=['Ws2_32'])
 
332
                         libraries=['Ws2_32'])
312
333
    add_cython_extension('breezy._walkdirs_win32')
313
334
else:
314
335
    add_cython_extension('breezy.bzr._dirstate_helpers_pyx')
315
336
    add_cython_extension('breezy._readdir_pyx')
316
337
add_cython_extension('breezy.bzr._chk_map_pyx')
317
 
ext_modules.append(Extension('breezy._patiencediff_c',
318
 
                             ['breezy/_patiencediff_c.c']))
319
338
add_cython_extension('breezy.bzr._btree_serializer_pyx')
320
339
 
321
340
 
358
377
    # First always brz's icon and its in the root of the brz tree.
359
378
    icos.append(('', 'brz.ico'))
360
379
    for root, dirs, files in os.walk(ico_root):
361
 
        icos.extend([(ico_root, os.path.join(root, f)[len(ico_root)+1:])
 
380
        icos.extend([(ico_root, os.path.join(root, f)[len(ico_root) + 1:])
362
381
                     for f in files if f.endswith('.ico')])
363
382
    # allocate an icon ID for each file and the full path to the ico
364
383
    icon_resources = [(rid, os.path.join(ico_dir, ico_name))
371
390
                 for rid, (_, f) in enumerate(icos)]
372
391
    ico_map = dict(map_items)
373
392
    # Create a new resource type of 'ICON_MAP', and use ID=1
374
 
    other_resources = [ ("ICON_MAP", 1, pickle.dumps(ico_map))]
 
393
    other_resources = [("ICON_MAP", 1, pickle.dumps(ico_map))]
375
394
 
376
395
    excludes.extend("""pywin pywin.dialogs pywin.dialogs.list
377
396
                       win32ui crawler.Crawler""".split())
379
398
    # tbzrcache executables - a "console" version for debugging and a
380
399
    # GUI version that is generally used.
381
400
    tbzrcache = dict(
382
 
        script = os.path.join(tbzr_root, "scripts", "tbzrcache.py"),
383
 
        icon_resources = icon_resources,
384
 
        other_resources = other_resources,
 
401
        script=os.path.join(tbzr_root, "scripts", "tbzrcache.py"),
 
402
        icon_resources=icon_resources,
 
403
        other_resources=other_resources,
385
404
    )
386
405
    console_targets.append(tbzrcache)
387
406
 
388
407
    # Make a windows version which is the same except for the base name.
389
408
    tbzrcachew = tbzrcache.copy()
390
 
    tbzrcachew["dest_base"]="tbzrcachew"
 
409
    tbzrcachew["dest_base"] = "tbzrcachew"
391
410
    gui_targets.append(tbzrcachew)
392
411
 
393
412
    # ditto for the tbzrcommand tool
394
413
    tbzrcommand = dict(
395
 
        script = os.path.join(tbzr_root, "scripts", "tbzrcommand.py"),
396
 
        icon_resources = icon_resources,
397
 
        other_resources = other_resources,
 
414
        script=os.path.join(tbzr_root, "scripts", "tbzrcommand.py"),
 
415
        icon_resources=icon_resources,
 
416
        other_resources=other_resources,
398
417
    )
399
418
    console_targets.append(tbzrcommand)
400
419
    tbzrcommandw = tbzrcommand.copy()
401
 
    tbzrcommandw["dest_base"]="tbzrcommandw"
 
420
    tbzrcommandw["dest_base"] = "tbzrcommandw"
402
421
    gui_targets.append(tbzrcommandw)
403
 
    
 
422
 
404
423
    # A utility to see python output from both C++ and Python based shell
405
424
    # extensions
406
425
    tracer = dict(script=os.path.join(tbzr_root, "scripts", "tbzrtrace.py"))
484
503
        for root, dirs, files in os.walk('doc'):
485
504
            r = []
486
505
            for f in files:
487
 
                if (os.path.splitext(f)[1] in ('.html','.css','.png','.pdf')
488
 
                    or f == 'quick-start-summary.svg'):
 
506
                if (os.path.splitext(f)[1] in ('.html', '.css', '.png', '.pdf')
 
507
                        or f == 'quick-start-summary.svg'):
489
508
                    r.append(os.path.join(root, f))
490
509
            if r:
491
510
                relative = root[4:]
497
516
        return docs
498
517
 
499
518
    # python's distutils-based win32 installer
500
 
    ARGS = {'scripts': [ 'brz', 'tools/win32/brz-win32-bdist-postinstall.py'],
 
519
    ARGS = {'scripts': ['brz', 'tools/win32/brz-win32-bdist-postinstall.py'],
501
520
            'ext_modules': ext_modules,
502
521
            # help pages
503
522
            'data_files': find_docs(),
504
523
            # for building cython extensions
505
524
            'cmdclass': command_classes,
506
 
           }
 
525
            }
507
526
 
508
527
    ARGS.update(META_INFO)
509
528
    ARGS.update(BREEZY)
558
577
            self.outfiles.extend([f + 'o' for f in compile_names])
559
578
    # end of class install_data_with_bytecompile
560
579
 
561
 
    target = py2exe.build_exe.Target(script = "brz",
562
 
                                     dest_base = "brz",
563
 
                                     icon_resources = [(0,'brz.ico')],
564
 
                                     name = META_INFO['name'],
565
 
                                     version = version_str,
566
 
                                     description = META_INFO['description'],
567
 
                                     author = META_INFO['author'],
568
 
                                     copyright = "(c) Canonical Ltd, 2005-2010",
569
 
                                     company_name = "Canonical Ltd.",
570
 
                                     comments = META_INFO['description'],
571
 
                                    )
 
580
    target = py2exe.build_exe.Target(
 
581
        script="brz",
 
582
        dest_base="brz",
 
583
        icon_resources=[(0, 'brz.ico')],
 
584
        name=META_INFO['name'],
 
585
        version=version_str,
 
586
        description=META_INFO['description'],
 
587
        author=META_INFO['author'],
 
588
        copyright="(c) Canonical Ltd, 2005-2010",
 
589
        company_name="Canonical Ltd.",
 
590
        comments=META_INFO['description'],
 
591
    )
572
592
    gui_target = copy.copy(target)
573
593
    gui_target.dest_base = "bzrw"
574
594
 
697
717
        # at build time.  Also to stdout so it appears in the log
698
718
        for f in (sys.stderr, sys.stdout):
699
719
            f.write("Skipping TBZR binaries - "
700
 
                "please set TBZR to a directory to enable\n")
 
720
                    "please set TBZR to a directory to enable\n")
701
721
 
702
722
    # MSWSOCK.dll is a system-specific library, which py2exe accidentally pulls
703
723
    # in on Vista.
713
733
                               "dist_dir": "win32_bzr.exe",
714
734
                               "optimize": 2,
715
735
                               "custom_boot_script":
716
 
                                        "tools/win32/py2exe_boot_common.py",
717
 
                              },
718
 
                   }
 
736
                                   "tools/win32/py2exe_boot_common.py",
 
737
                               },
 
738
                    }
719
739
 
720
740
    # We want the libaray.zip to have optimize = 2, but the exe to have
721
741
    # optimize = 1, so that .py files that get compilied at run time
740
760
else:
741
761
    # ad-hoc for easy_install
742
762
    DATA_FILES = []
743
 
    if not 'bdist_egg' in sys.argv:
 
763
    if 'bdist_egg' not in sys.argv:
744
764
        # generate and install brz.1 only with plain install, not the
745
765
        # easy_install one
746
766
        DATA_FILES = [('man/man1', ['brz.1', 'breezy/git/git-remote-bzr.1'])]
756
776
            'data_files': DATA_FILES,
757
777
            'cmdclass': command_classes,
758
778
            'ext_modules': ext_modules,
759
 
           }
 
779
            }
760
780
 
761
781
    ARGS.update(META_INFO)
762
782
    ARGS.update(BREEZY)