[PATCH] waf: Fix the build on openbsd

Alexander Bokovoy ab at samba.org
Tue Feb 3 02:47:41 MST 2015


On Tue, Feb 03, 2015 at 10:33:31AM +0100, Volker Lendecke wrote:
> On Tue, Feb 03, 2015 at 11:06:47AM +0200, Alexander Bokovoy wrote:
> > > +                        pattern = '%s.%s' % (pattern, nums[0])
> > > +                        if len(nums) >= 2:
> > > +                                pattern += '.%s' % nums[1]
> > I wonder if using a bit more of a Python would work too:
> >     pattern = '.'.join([pattern]+[str(d) for d in nums])
> > 
> > It works like this:
> >  >>> pattern='name.so'
> >  >>> nums=[0,2]
> >  >>> '.'.join([pattern]+[str(d) for d in nums])
> >  'name.so.0.2'
> >  >>> nums=[0]
> >  >>> '.'.join([pattern]+[str(d) for d in nums])
> >  'name.so.0'
> >  >>> 
> 
> That would behave differently for nums with more than 2
> entries. Is that wanted?
We can limit by adding a range to the resulting array:
 >>> nums=[0,2,3,4,5]
 >>> '.'.join([pattern]+[str(d) for d in nums][:2])
 'name.so.0.2'
 >>> nums=[0]
 >>> '.'.join([pattern]+[str(d) for d in nums][:2])
 'name.so.0'
 >>> 

-- 
/ Alexander Bokovoy


More information about the samba-technical mailing list