[macports-ports] branch master updated: py-protobuf3: fix build on older systems

Fred Wright fw at fwright.net
Fri May 25 20:18:57 UTC 2018


On Fri, 25 May 2018, Ryan Schmidt wrote:
> On May 25, 2018, at 11:04, Ken Cunningham wrote:
>
> > On 2018-05-25, at 8:38 AM, Ryan Schmidt wrote:
> >
> >> If this is supposed to help 10.6...
> >>
> >>
> >>> +@@ -197,6 +197,8 @@
> >>> +       v = float('.'.join(v.split('.')[:2]))
> >>> +       if v >= 10.12:
> >>> +         extra_compile_args.append('-std=c++11')
> >>> ++        extra_compile_args.append('@@MACPORTS_STDLIB@@')
> >>> ++        extra_compile_args.append('@@MACPORTS_EXTRAARG@@')
> >>
> >> ...why is it inside an if statement that's for 10.12 and later?
> >
> >
> > Yeah, their logic for the test must be busted.  My guess is that testing for 10.12 passes everything 10.1 and above,
>
> Right.
>
> > but I defer to someone who can read python. Can you fix that v.float () business for them?
>
> I've never looked at this code before; I won't presume to know what the correct fix would be.

You don't want to use float() when the '.' is a delimiter rather than a
decimal point.  Python is perfectly capable of comparing lists directly,
but:

1) The lengths of the lists matter, so you may need either padding or
truncation to make the comparison correct.

2) Comparing lists of strings uses a "naive" comparison of the elements.
If they're known to be purely numeric, that can be fixed with int().

In this particular case, you should be able to replace the first two
lines with:

	if map(int, v.split('.')[:2]) >= [10, 12]:

Fred Wright


More information about the macports-dev mailing list