37
37
'version': bzrlib.__version__,
38
38
'author': 'Canonical Ltd',
39
39
'author_email': 'bazaar@lists.canonical.com',
40
'url': 'http://www.bazaar-vcs.org/',
40
'url': 'http://bazaar.canonical.com/',
41
41
'description': 'Friendly distributed version control system',
42
42
'license': 'GNU GPL v2',
43
43
'download_url': 'https://launchpad.net/bzr/+download',
125
125
f = file(batch_path, "w")
126
126
f.write(batch_str)
128
print "Created:", batch_path
130
print "ERROR: Unable to create %s: %s" % (batch_path, e)
128
print("Created: %s" % batch_path)
130
e = sys.exc_info()[1]
131
print("ERROR: Unable to create %s: %s" % (batch_path, e))
132
133
def _quoted_path(self, path):
171
172
from Pyrex.Distutils import build_ext
172
173
from Pyrex.Compiler.Version import version as pyrex_version
173
174
except ImportError:
174
print "No Pyrex, trying Cython..."
175
print("No Pyrex, trying Cython...")
175
176
from Cython.Distutils import build_ext
176
177
from Cython.Compiler.Version import version as pyrex_version
177
178
except ImportError:
178
179
have_pyrex = False
179
180
# try to build the extension from the prior generated source.
181
print ("The python package 'Pyrex' is not available."
182
" If the .c files are available,")
183
print ("they will be built,"
184
" but modifying the .pyx files will not rebuild them.")
182
print("The python package 'Pyrex' is not available."
183
" If the .c files are available,")
184
print("they will be built,"
185
" but modifying the .pyx files will not rebuild them.")
186
187
from distutils.command.build_ext import build_ext
188
189
have_pyrex = True
190
pyrex_version_info = tuple(map(int, pyrex_version.split('.')))
191
193
class build_ext_if_possible(build_ext):
280
283
add_pyrex_extension('bzrlib._dirstate_helpers_pyx',
281
284
libraries=['Ws2_32'])
282
285
add_pyrex_extension('bzrlib._walkdirs_win32')
285
if have_pyrex and pyrex_version.startswith('0.9.4'):
287
if have_pyrex and pyrex_version_info[:3] == (0,9,4):
286
288
# Pyrex 0.9.4.1 fails to compile this extension correctly
287
289
# The code it generates re-uses a "local" pointer and
288
290
# calls "PY_DECREF" after having set it to NULL. (It mixes PY_XDECREF
289
291
# which is NULL safe with PY_DECREF which is not.)
290
292
# <https://bugs.edge.launchpad.net/bzr/+bug/449372>
291
293
# <https://bugs.edge.launchpad.net/bzr/+bug/276868>
292
print 'Cannot build extension "bzrlib._dirstate_helpers_pyx" using'
293
print 'your version of pyrex "%s". Please upgrade your pyrex' % (
295
print 'install. For now, the non-compiled (python) version will'
296
print 'be used instead.'
294
print('Cannot build extension "bzrlib._dirstate_helpers_pyx" using')
295
print('your version of pyrex "%s". Please upgrade your pyrex' % (
297
print('install. For now, the non-compiled (python) version will')
298
print('be used instead.')
298
300
add_pyrex_extension('bzrlib._dirstate_helpers_pyx')
299
301
add_pyrex_extension('bzrlib._readdir_pyx')
301
add_pyrex_extension('bzrlib._chk_map_pyx', libraries=[z_lib])
302
add_pyrex_extension('bzrlib._chk_map_pyx')
302
303
ext_modules.append(Extension('bzrlib._patiencediff_c',
303
304
['bzrlib/_patiencediff_c.c']))
304
add_pyrex_extension('bzrlib._simple_set_pyx')
305
ext_modules.append(Extension('bzrlib._static_tuple_c',
306
['bzrlib/_static_tuple_c.c']))
305
if have_pyrex and pyrex_version_info < (0, 9, 6, 3):
307
print('Your Pyrex/Cython version %s is too old to build the simple_set' % (
309
print('and static_tuple extensions.')
310
print('Please upgrade to at least Pyrex 0.9.6.3')
312
# TODO: Should this be a fatal error?
314
# We only need 0.9.6.3 to build _simple_set_pyx, but static_tuple depends
316
add_pyrex_extension('bzrlib._simple_set_pyx')
317
ext_modules.append(Extension('bzrlib._static_tuple_c',
318
['bzrlib/_static_tuple_c.c']))
307
319
add_pyrex_extension('bzrlib._btree_serializer_pyx')
310
322
if unavailable_files:
311
print 'C extension(s) not found:'
312
print ' %s' % ('\n '.join(unavailable_files),)
313
print 'The python versions will be used instead.'
323
print('C extension(s) not found:')
324
print(' %s' % ('\n '.join(unavailable_files),))
325
print('The python versions will be used instead.')
317
329
def get_tbzr_py2exe_info(includes, excludes, packages, console_targets,
521
534
install_data.run(self)
523
536
py2exe = self.distribution.get_command_obj('py2exe', False)
524
optimize = py2exe.optimize
537
# GZ 2010-04-19: Setup has py2exe.optimize as 2, but give plugins
538
# time before living with docstring stripping
525
540
compile_names = [f for f in self.outfiles if f.endswith('.py')]
526
541
byte_compile(compile_names,
527
542
optimize=optimize,
528
543
force=self.force, prefix=self.install_dir,
529
544
dry_run=self.dry_run)
534
self.outfiles.extend([f + suffix for f in compile_names])
545
self.outfiles.extend([f + 'o' for f in compile_names])
535
546
# end of class install_data_with_bytecompile
537
548
target = py2exe.build_exe.Target(script = "bzr",
541
552
version = version_str,
542
553
description = META_INFO['description'],
543
554
author = META_INFO['author'],
544
copyright = "(c) Canonical Ltd, 2005-2009",
555
copyright = "(c) Canonical Ltd, 2005-2010",
545
556
company_name = "Canonical Ltd.",
546
557
comments = META_INFO['description'],
612
623
excludes.extend(["bzrlib.plugins." + d for d in dirs])
615
if os.path.splitext(i)[1] not in [".py", ".pyd", ".dll", ".mo"]:
626
# Throw away files we don't want packaged. Note that plugins may
627
# have data files with all sorts of extensions so we need to
628
# be conservative here about what we ditch.
629
ext = os.path.splitext(i)[1]
630
if ext.endswith('~') or ext in [".pyc", ".swp"]:
617
632
if i == '__init__.py' and root == 'bzrlib/plugins':
664
679
# print this warning to stderr as output is redirected, so it is seen
665
680
# at build time. Also to stdout so it appears in the log
666
681
for f in (sys.stderr, sys.stdout):
668
"Skipping TBZR binaries - please set TBZR to a directory to enable"
682
f.write("Skipping TBZR binaries - "
683
"please set TBZR to a directory to enable\n")
670
685
# MSWSOCK.dll is a system-specific library, which py2exe accidentally pulls
675
690
"excludes": excludes,
676
691
"dll_excludes": dll_excludes,
677
692
"dist_dir": "win32_bzr.exe",
682
setup(options=options_list,
683
console=console_targets,
685
zipfile='lib/library.zip',
686
data_files=data_files,
687
cmdclass={'install_data': install_data_with_bytecompile},
696
if __name__ == '__main__':
697
setup(options=options_list,
698
console=console_targets,
700
zipfile='lib/library.zip',
701
data_files=data_files,
702
cmdclass={'install_data': install_data_with_bytecompile},
691
706
# ad-hoc for easy_install
695
710
# easy_install one
696
711
DATA_FILES = [('man/man1', ['bzr.1'])]
713
if sys.platform != 'win32':
714
# see https://wiki.kubuntu.org/Apport/DeveloperHowTo
716
# checking the paths and hardcoding the check for root is a bit gross,
717
# but I don't see a cleaner way to find out the locations in a way
718
# that's going to align with the hardcoded paths in apport.
719
if os.geteuid() == 0:
721
('/usr/share/apport/package-hooks',
722
['apport/source_bzr.py']),
723
('/etc/apport/crashdb.conf.d/',
724
['apport/bzr-crashdb.conf']),]
699
727
ARGS = {'scripts': ['bzr'],
700
728
'data_files': DATA_FILES,