[PATCH 1 of 1] setup: ignore failure to build optional inotify extension
Christian Boos
cboos at neuf.fr
Wed Jun 23 12:06:52 CDT 2010
On 6/23/2010 5:29 PM, Nicolas Dumazet wrote:
> Hello!
>
> I like the overall idea.
>
> 2010/6/23<cboos at neuf.fr>:
>
>> +class hgbuildext(build_ext):
>> +
>> + def build_extensions(self):
>> + # First, sanity-check the 'extensions' list
>> + self.check_extensions_list(self.extensions)
>> +
>> + for ext in self.extensions:
>> + try:
>> + self.build_extension(ext)
>> + except CCompilerError:
>> + if not hasattr(ext, 'optional') or not ext.optional:
>> + raise
>> + log.warn("Failed to build optional extension '%s' (skipping)",
>> + ext.name)
>> +
>>
> What about "simply" extending self.build_extension? The problem with
> adapting an existing method is that we'll run into problems if for
> some reasons the distutils gurus change the logic of build_extensions
> and add more stuff in there.
>
> So :
>
>
> def build_extension(self, extension):
> try:
> super(hgbuildext, self).build_extension(extension)
> except CCompilerError:
> # catch here and ignore if "optional"
>
>
> Isnt it better?
>
In Python 2.x the distutils Command is an old-style class, so we can't
use super. But yes, we can achieve this by calling
build_ext.build_extension(self, extension) directly. I'll resubmit.
-- Christian
More information about the Mercurial-devel
mailing list