diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-12-14 14:37:42 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-12-14 14:37:42 +0100 |
commit | cd2ab5002aa2359575088bbc3183a9a91cc50c31 (patch) | |
tree | 810f2b7be99b16aee13a80daf4ca71597b42ecd6 /engine/SCons/Variables/__init__.py | |
parent | 7c651e273c4db37f4babd91aaecf26800c50dd79 (diff) |
New upstream version 3.0.1upstream/3.0.1
Diffstat (limited to 'engine/SCons/Variables/__init__.py')
-rw-r--r-- | engine/SCons/Variables/__init__.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/engine/SCons/Variables/__init__.py b/engine/SCons/Variables/__init__.py index 784f795..2c48da6 100644 --- a/engine/SCons/Variables/__init__.py +++ b/engine/SCons/Variables/__init__.py @@ -26,10 +26,11 @@ customizable variables to an SCons build. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "src/engine/SCons/Variables/__init__.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" +__revision__ = "src/engine/SCons/Variables/__init__.py 74b2c53bc42290e911b334a6b44f187da698a668 2017/11/14 13:16:53 bdbaddog" import os.path import sys +from functools import cmp_to_key import SCons.Environment import SCons.Errors @@ -287,9 +288,13 @@ class Variables(object): env - an environment that is used to get the current values of the options. + cmp - Either a function as follows: The specific sort function should take two arguments and return -1, 0 or 1 + or a boolean to indicate if it should be sorted. """ - if sort: + if callable(sort): + options = sorted(self.options, key=cmp_to_key(lambda x,y: sort(x.key,y.key))) + elif sort is True: options = sorted(self.options, key=lambda x: x.key) else: options = self.options |