~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Lukáš Lalinský
  • Date: 2007-09-11 08:06:21 UTC
  • mto: (2814.7.1 0.91-integration)
  • mto: This revision was merged to the branch mainline in revision 2866.
  • Revision ID: lalinsky@gmail.com-20070911080621-kru223e15w1fkzaa
Don't abort ``python setup.py install`` if building of a C extension is not possible.

Show diffs side-by-side

added added

removed removed

Lines of Context:
149
149
 
150
150
command_classes = {'install_scripts': my_install_scripts,
151
151
                   'build': bzr_build}
 
152
from distutils import log
 
153
from distutils.errors import CCompilerError
152
154
from distutils.extension import Extension
153
155
ext_modules = []
154
156
try:
165
167
    from distutils.command.build_ext import build_ext
166
168
else:
167
169
    have_pyrex = True
 
170
 
 
171
 
 
172
class build_ext_if_possible(build_ext):
 
173
 
 
174
    def build_extension(self, ext):
 
175
        try:
 
176
            build_ext.build_extension(self, ext)
 
177
        except CCompilerError:
 
178
            log.warn("building of '%s' extension failed, will "
 
179
                     "use the Python version instead" % (ext.name,))
 
180
 
 
181
 
168
182
# Override the build_ext if we have Pyrex available
169
 
command_classes['build_ext'] = build_ext
 
183
command_classes['build_ext'] = build_ext_if_possible
170
184
unavailable_files = []
171
185
 
172
186
 
230
244
            # help pages
231
245
            'data_files': find_docs(),
232
246
            # for building pyrex extensions
233
 
            'cmdclass': {'build_ext': build_ext},
 
247
            'cmdclass': {'build_ext': build_ext_if_possible},
234
248
           }
235
249
 
236
250
    ARGS.update(META_INFO)