[Scons-users] sort function changes

Tim Jenness tjenness at lsst.org
Wed Oct 11 14:55:05 EDT 2017


The docstring is missing the "sort" definition. Can we make it default to False rather than None to make it clearer it’s a boolean?

> On Oct 11, 2017, at 11:52 , Eric Fahlgren <ericfahlgren at gmail.com> wrote:
> 
> But isn't the 'sort' parameter just a bool, so no need for a function?
> 
>     def GenerateHelpText(self, env, sort=None):
>         """
>         Generate the help text for the options.
> 
>         env - an environment that is used to get the current values
>               of the options.
>         """
> 
>         if sort:
>             options = sorted(self.options, key=lambda x: x.key)
> 
> On Wed, Oct 11, 2017 at 11:35 AM, Bill Deegan <bill at baddogconsulting.com <mailto:bill at baddogconsulting.com>> wrote:
> Added this:
> 
> Please comment
> https://github.com/SConsProject/scons/pull/12 <https://github.com/SConsProject/scons/pull/12>
> 
> On Wed, Oct 11, 2017 at 11:31 AM, Bill Deegan <bill at baddogconsulting.com <mailto:bill at baddogconsulting.com>> wrote:
> We ran into same issue in our VariablesTests.py (a unit test).
> 
> Here's the implementation we used:
> 
> def cmp(a, b):
>     """
>     Define cmp because it's no longer available in python3
>     Works under python 2 as well
>     """
>     return (a > b) - (a < b)
> 
> I'll make a note and see if we can provision this into SConscript/SConstruct environment..
> 
> On Wed, Oct 11, 2017 at 8:03 AM, Mats Wichmann <mats at wichmann.us <mailto:mats at wichmann.us>> wrote:
> 
> This does not work with Python3, since cmp is gone:
> 
>     Help(help_vars.GenerateHelpText(env, sort=cmp))
> 
> 
> Quick suggestion?
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org <mailto:Scons-users at scons.org>
> https://pairlist4.pair.net/mailman/listinfo/scons-users <https://pairlist4.pair.net/mailman/listinfo/scons-users>
> 
> 
> 
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org <mailto:Scons-users at scons.org>
> https://pairlist4.pair.net/mailman/listinfo/scons-users <https://pairlist4.pair.net/mailman/listinfo/scons-users>
> 
> 
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20171011/b0c3449f/attachment.html>


More information about the Scons-users mailing list