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
206
207
build_ext.run(self)
207
except DistutilsPlatformError, e:
208
except DistutilsPlatformError:
209
e = sys.exc_info()[1]
208
210
if not self.allow_python_fallback:
209
211
log.warn('\n Cannot build extensions.\n'
210
212
' Use "build_ext --allow-python-fallback" to use'
281
283
add_pyrex_extension('bzrlib._dirstate_helpers_pyx',
282
284
libraries=['Ws2_32'])
283
285
add_pyrex_extension('bzrlib._walkdirs_win32')
286
287
if have_pyrex and pyrex_version_info[:3] == (0,9,4):
287
288
# Pyrex 0.9.4.1 fails to compile this extension correctly
290
291
# which is NULL safe with PY_DECREF which is not.)
291
292
# <https://bugs.edge.launchpad.net/bzr/+bug/449372>
292
293
# <https://bugs.edge.launchpad.net/bzr/+bug/276868>
293
print 'Cannot build extension "bzrlib._dirstate_helpers_pyx" using'
294
print 'your version of pyrex "%s". Please upgrade your pyrex' % (
296
print 'install. For now, the non-compiled (python) version will'
297
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.')
299
300
add_pyrex_extension('bzrlib._dirstate_helpers_pyx')
300
301
add_pyrex_extension('bzrlib._readdir_pyx')
302
add_pyrex_extension('bzrlib._chk_map_pyx', libraries=[z_lib])
302
add_pyrex_extension('bzrlib._chk_map_pyx')
303
303
ext_modules.append(Extension('bzrlib._patiencediff_c',
304
304
['bzrlib/_patiencediff_c.c']))
305
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'
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
312
# TODO: Should this be a fatal error?
314
314
# We only need 0.9.6.3 to build _simple_set_pyx, but static_tuple depends
322
322
if unavailable_files:
323
print 'C extension(s) not found:'
324
print ' %s' % ('\n '.join(unavailable_files),)
325
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.')
329
329
def get_tbzr_py2exe_info(includes, excludes, packages, console_targets,
534
534
install_data.run(self)
536
536
py2exe = self.distribution.get_command_obj('py2exe', False)
537
optimize = py2exe.optimize
537
# GZ 2010-04-19: Setup has py2exe.optimize as 2, but give plugins
538
# time before living with docstring stripping
538
540
compile_names = [f for f in self.outfiles if f.endswith('.py')]
541
# Round mtime to nearest even second so that installing on a FAT
542
# filesystem bytecode internal and script timestamps will match
543
for f in compile_names:
544
mtime = os.stat(f).st_mtime
545
remainder = mtime % 2
548
os.utime(f, (mtime, mtime))
539
549
byte_compile(compile_names,
540
550
optimize=optimize,
541
551
force=self.force, prefix=self.install_dir,
542
552
dry_run=self.dry_run)
547
self.outfiles.extend([f + suffix for f in compile_names])
553
self.outfiles.extend([f + 'o' for f in compile_names])
548
554
# end of class install_data_with_bytecompile
550
556
target = py2exe.build_exe.Target(script = "bzr",
681
687
# print this warning to stderr as output is redirected, so it is seen
682
688
# at build time. Also to stdout so it appears in the log
683
689
for f in (sys.stderr, sys.stdout):
685
"Skipping TBZR binaries - please set TBZR to a directory to enable"
690
f.write("Skipping TBZR binaries - "
691
"please set TBZR to a directory to enable\n")
687
693
# MSWSOCK.dll is a system-specific library, which py2exe accidentally pulls
692
698
"excludes": excludes,
693
699
"dll_excludes": dll_excludes,
694
700
"dist_dir": "win32_bzr.exe",
699
setup(options=options_list,
700
console=console_targets,
702
zipfile='lib/library.zip',
703
data_files=data_files,
704
cmdclass={'install_data': install_data_with_bytecompile},
704
if __name__ == '__main__':
705
setup(options=options_list,
706
console=console_targets,
708
zipfile='lib/library.zip',
709
data_files=data_files,
710
cmdclass={'install_data': install_data_with_bytecompile},
708
714
# ad-hoc for easy_install