/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: Robert Collins
  • Date: 2010-05-06 11:08:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506110810-h3j07fh5gmw54s25
Cleaner matcher matching revised unlocking protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
                f = file(batch_path, "w")
126
126
                f.write(batch_str)
127
127
                f.close()
128
 
                print("Created: %s" % batch_path)
129
 
            except Exception:
130
 
                e = sys.exc_info()[1]
131
 
                print("ERROR: Unable to create %s: %s" % (batch_path, e))
 
128
                print "Created:", batch_path
 
129
            except Exception, e:
 
130
                print "ERROR: Unable to create %s: %s" % (batch_path, e)
132
131
 
133
132
    def _quoted_path(self, path):
134
133
        if ' ' in path:
172
171
        from Pyrex.Distutils import build_ext
173
172
        from Pyrex.Compiler.Version import version as pyrex_version
174
173
    except ImportError:
175
 
        print("No Pyrex, trying Cython...")
 
174
        print "No Pyrex, trying Cython..."
176
175
        from Cython.Distutils import build_ext
177
176
        from Cython.Compiler.Version import version as pyrex_version
178
177
except ImportError:
179
178
    have_pyrex = False
180
179
    # try to build the extension from the prior generated source.
181
 
    print("")
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
 
    print("")
 
180
    print
 
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.")
 
185
    print
187
186
    from distutils.command.build_ext import build_ext
188
187
else:
189
188
    have_pyrex = True
205
204
    def run(self):
206
205
        try:
207
206
            build_ext.run(self)
208
 
        except DistutilsPlatformError:
209
 
            e = sys.exc_info()[1]
 
207
        except DistutilsPlatformError, e:
210
208
            if not self.allow_python_fallback:
211
209
                log.warn('\n  Cannot build extensions.\n'
212
210
                         '  Use "build_ext --allow-python-fallback" to use'
283
281
    add_pyrex_extension('bzrlib._dirstate_helpers_pyx',
284
282
                        libraries=['Ws2_32'])
285
283
    add_pyrex_extension('bzrlib._walkdirs_win32')
 
284
    z_lib = 'zdll'
286
285
else:
287
286
    if have_pyrex and pyrex_version_info[:3] == (0,9,4):
288
287
        # Pyrex 0.9.4.1 fails to compile this extension correctly
291
290
        # which is NULL safe with PY_DECREF which is not.)
292
291
        # <https://bugs.edge.launchpad.net/bzr/+bug/449372>
293
292
        # <https://bugs.edge.launchpad.net/bzr/+bug/276868>
294
 
        print('Cannot build extension "bzrlib._dirstate_helpers_pyx" using')
295
 
        print('your version of pyrex "%s". Please upgrade your pyrex' % (
296
 
            pyrex_version,))
297
 
        print('install. For now, the non-compiled (python) version will')
298
 
        print('be used instead.')
 
293
        print 'Cannot build extension "bzrlib._dirstate_helpers_pyx" using'
 
294
        print 'your version of pyrex "%s". Please upgrade your pyrex' % (
 
295
            pyrex_version,)
 
296
        print 'install. For now, the non-compiled (python) version will'
 
297
        print 'be used instead.'
299
298
    else:
300
299
        add_pyrex_extension('bzrlib._dirstate_helpers_pyx')
301
300
    add_pyrex_extension('bzrlib._readdir_pyx')
302
 
add_pyrex_extension('bzrlib._chk_map_pyx')
 
301
    z_lib = 'z'
 
302
add_pyrex_extension('bzrlib._chk_map_pyx', libraries=[z_lib])
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):
306
 
    print("")
307
 
    print('Your Pyrex/Cython version %s is too old to build the simple_set' % (
308
 
        pyrex_version))
309
 
    print('and static_tuple extensions.')
310
 
    print('Please upgrade to at least Pyrex 0.9.6.3')
311
 
    print("")
 
306
    print
 
307
    print 'Your Pyrex/Cython version %s is too old to build the simple_set' % (
 
308
        pyrex_version)
 
309
    print 'and static_tuple extensions.'
 
310
    print 'Please upgrade to at least Pyrex 0.9.6.3'
 
311
    print
312
312
    # TODO: Should this be a fatal error?
313
313
else:
314
314
    # We only need 0.9.6.3 to build _simple_set_pyx, but static_tuple depends
320
320
 
321
321
 
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.')
326
 
    print("")
 
323
    print 'C extension(s) not found:'
 
324
    print '   %s' % ('\n  '.join(unavailable_files),)
 
325
    print 'The python versions will be used instead.'
 
326
    print
327
327
 
328
328
 
329
329
def get_tbzr_py2exe_info(includes, excludes, packages, console_targets,
534
534
            install_data.run(self)
535
535
 
536
536
            py2exe = self.distribution.get_command_obj('py2exe', False)
537
 
            # GZ 2010-04-19: Setup has py2exe.optimize as 2, but give plugins
538
 
            #                time before living with docstring stripping
539
 
            optimize = 1
 
537
            optimize = py2exe.optimize
540
538
            compile_names = [f for f in self.outfiles if f.endswith('.py')]
541
539
            byte_compile(compile_names,
542
540
                         optimize=optimize,
543
541
                         force=self.force, prefix=self.install_dir,
544
542
                         dry_run=self.dry_run)
545
 
            self.outfiles.extend([f + 'o' for f in compile_names])
 
543
            if optimize:
 
544
                suffix = 'o'
 
545
            else:
 
546
                suffix = 'c'
 
547
            self.outfiles.extend([f + suffix for f in compile_names])
546
548
    # end of class install_data_with_bytecompile
547
549
 
548
550
    target = py2exe.build_exe.Target(script = "bzr",
679
681
        # print this warning to stderr as output is redirected, so it is seen
680
682
        # at build time.  Also to stdout so it appears in the log
681
683
        for f in (sys.stderr, sys.stdout):
682
 
            f.write("Skipping TBZR binaries - "
683
 
                "please set TBZR to a directory to enable\n")
 
684
            print >> f, \
 
685
                "Skipping TBZR binaries - please set TBZR to a directory to enable"
684
686
 
685
687
    # MSWSOCK.dll is a system-specific library, which py2exe accidentally pulls
686
688
    # in on Vista.
690
692
                               "excludes": excludes,
691
693
                               "dll_excludes": dll_excludes,
692
694
                               "dist_dir": "win32_bzr.exe",
693
 
                               "optimize": 2,
 
695
                               "optimize": 1,
694
696
                              },
695
697
                   }
696
 
    if __name__ == '__main__':
697
 
        setup(options=options_list,
698
 
              console=console_targets,
699
 
              windows=gui_targets,
700
 
              zipfile='lib/library.zip',
701
 
              data_files=data_files,
702
 
              cmdclass={'install_data': install_data_with_bytecompile},
703
 
              )
 
698
 
 
699
    setup(options=options_list,
 
700
          console=console_targets,
 
701
          windows=gui_targets,
 
702
          zipfile='lib/library.zip',
 
703
          data_files=data_files,
 
704
          cmdclass={'install_data': install_data_with_bytecompile},
 
705
          )
704
706
 
705
707
else:
706
708
    # ad-hoc for easy_install
734
736
    ARGS.update(BZRLIB)
735
737
    ARGS.update(PKG_DATA)
736
738
 
737
 
    if __name__ == '__main__':
738
 
        setup(**ARGS)
 
739
    setup(**ARGS)