16
16
sys.stderr.write("[ERROR] Not a supported Python version. Need 2.7+\n")
23
sys.stderr.write("[ERROR] Please install setuptools\n")
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
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',
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(),
75
85
# that are part of BREEZY here.
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',
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',
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'
109
package_name = ('breezy.' +
110
package_path.replace('/', '.').replace('\\', '.'))
122
package_path.replace('/', '.').replace('\\', '.'))
111
123
packages.append(package_name)
112
124
return sorted(packages)
115
127
BREEZY['packages'] = get_breezy_packages()
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
172
183
sub_commands = build.sub_commands + [
173
('build_mo', lambda _: True),
184
('build_mo', lambda _: True),
209
220
from distutils.command.build_ext import build_ext
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.")
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))
315
module_name, source, define_macros=define_macros,
316
libraries=libraries, include_dirs=include_dirs))
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')
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')
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))]
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,
386
405
console_targets.append(tbzrcache)
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)
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,
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)
404
423
# A utility to see python output from both C++ and Python based shell
406
425
tracer = dict(script=os.path.join(tbzr_root, "scripts", "tbzrtrace.py"))
484
503
for root, dirs, files in os.walk('doc'):
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))
491
510
relative = root[4:]
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,
503
522
'data_files': find_docs(),
504
523
# for building cython extensions
505
524
'cmdclass': command_classes,
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
561
target = py2exe.build_exe.Target(script = "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'],
580
target = py2exe.build_exe.Target(
583
icon_resources=[(0, 'brz.ico')],
584
name=META_INFO['name'],
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'],
572
592
gui_target = copy.copy(target)
573
593
gui_target.dest_base = "bzrw"
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")
702
722
# MSWSOCK.dll is a system-specific library, which py2exe accidentally pulls
713
733
"dist_dir": "win32_bzr.exe",
715
735
"custom_boot_script":
716
"tools/win32/py2exe_boot_common.py",
736
"tools/win32/py2exe_boot_common.py",
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
741
761
# ad-hoc for easy_install
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'])]