~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-09-25 21:28:01 UTC
  • mfrom: (2814.4.6 install.wo.compiler)
  • Revision ID: pqm@pqm.ubuntu.com-20070925212801-8p7l0qlplb0t7h2u
`setup.py install` on systems without C-compiler

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, DistutilsPlatformError
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 run(self):
 
175
        try:
 
176
            build_ext.run(self)
 
177
        except DistutilsPlatformError, e:
 
178
            log.warn(str(e))
 
179
            log.warn('Extensions cannot be built, '
 
180
                     'will use the Python versions instead')
 
181
 
 
182
    def build_extension(self, ext):
 
183
        try:
 
184
            build_ext.build_extension(self, ext)
 
185
        except CCompilerError:
 
186
            log.warn('Building of "%s" extension failed, '
 
187
                     'will use the Python version instead' % (ext.name,))
 
188
 
 
189
 
168
190
# Override the build_ext if we have Pyrex available
169
 
command_classes['build_ext'] = build_ext
 
191
command_classes['build_ext'] = build_ext_if_possible
170
192
unavailable_files = []
171
193
 
172
194
 
230
252
            # help pages
231
253
            'data_files': find_docs(),
232
254
            # for building pyrex extensions
233
 
            'cmdclass': {'build_ext': build_ext},
 
255
            'cmdclass': {'build_ext': build_ext_if_possible},
234
256
           }
235
257
 
236
258
    ARGS.update(META_INFO)