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...
24
24
def get_long_description():
25
25
dirname = os.path.dirname(__file__)
36
36
# see http://docs.python.org/dist/meta-data.html
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',
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',
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]))
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"""
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'
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)
104
BZRLIB['packages'] = get_brzlib_packages()
104
BZRLIB['packages'] = get_breezy_packages()
107
107
from distutils import log
288
288
define_macros=define_macros, libraries=libraries))
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')
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.')
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"):
324
324
print('Your Pyrex/Cython version %s is too old to build the simple_set' % (
331
331
# We only need 0.9.6.3 to build _simple_set_pyx, but static_tuple depends
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')
339
339
if unavailable_files:
363
363
# TBZR points to the TBZR directory
364
364
tbzr_root = os.environ["TBZR"]
366
# Ensure tbrzlib itself is on sys.path
366
# Ensure tbreezy itself is on sys.path
367
367
sys.path.append(tbzr_root)
369
packages.append("tbrzlib")
369
packages.append("tbreezy")
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'))
590
590
gui_target.dest_base = "bzrw"
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')]
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)
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)]
640
640
# built-in plugins
643
643
# which hard-codes the list of plugins, gets more upset if modules are
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])
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"]:
664
if i == '__init__.py' and root == 'brzlib/plugins':
664
if i == '__init__.py' and root == 'breezy/plugins':
666
666
x.append(os.path.join(root, i))
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)