/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: Daniel Watkins
  • Date: 2007-11-06 09:33:05 UTC
  • mfrom: (2967 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2993.
  • Revision ID: d.m.watkins@warwick.ac.uk-20071106093305-zfef3c0jbcvunnuz
Merged bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
                os.execvp(python, [python] + sys.argv)
56
56
            except OSError:
57
57
                pass
58
 
    print >>sys.stderr, "bzr: error: cannot find a suitable python interpreter"
59
 
    print >>sys.stderr, "  (need %d.%d or later)" % NEED_VERS
 
58
    sys.stderr.write("bzr: error: cannot find a suitable python interpreter\n")
 
59
    sys.stderr.write("  (need %d.%d or later)" % NEED_VERS)
 
60
    sys.stderr.write('\n')
60
61
    sys.exit(1)
61
62
if getattr(os, "unsetenv", None) is not None:
62
63
    os.unsetenv(REINVOKE)
149
150
 
150
151
command_classes = {'install_scripts': my_install_scripts,
151
152
                   'build': bzr_build}
 
153
from distutils import log
 
154
from distutils.errors import CCompilerError, DistutilsPlatformError
152
155
from distutils.extension import Extension
153
156
ext_modules = []
154
157
try:
165
168
    from distutils.command.build_ext import build_ext
166
169
else:
167
170
    have_pyrex = True
 
171
 
 
172
 
 
173
class build_ext_if_possible(build_ext):
 
174
 
 
175
    def run(self):
 
176
        try:
 
177
            build_ext.run(self)
 
178
        except DistutilsPlatformError, e:
 
179
            log.warn(str(e))
 
180
            log.warn('Extensions cannot be built, '
 
181
                     'will use the Python versions instead')
 
182
 
 
183
    def build_extension(self, ext):
 
184
        try:
 
185
            build_ext.build_extension(self, ext)
 
186
        except CCompilerError:
 
187
            log.warn('Building of "%s" extension failed, '
 
188
                     'will use the Python version instead' % (ext.name,))
 
189
 
 
190
 
168
191
# Override the build_ext if we have Pyrex available
169
 
command_classes['build_ext'] = build_ext
 
192
command_classes['build_ext'] = build_ext_if_possible
170
193
unavailable_files = []
171
194
 
172
195
 
230
253
            # help pages
231
254
            'data_files': find_docs(),
232
255
            # for building pyrex extensions
233
 
            'cmdclass': {'build_ext': build_ext},
 
256
            'cmdclass': {'build_ext': build_ext_if_possible},
234
257
           }
235
258
 
236
259
    ARGS.update(META_INFO)