From 7144cf56430cff650a34ef102ad64ce5feb1d9cd Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 11 Oct 2017 14:34:14 -0400 Subject: Add cmp to SCons.Util as py3 no longer provides it --- src/engine/SCons/Util.py | 11 +++++++++++ src/engine/SCons/Variables/VariablesTests.py | 7 +------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 11bcf2e..7ed9706 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -1619,6 +1619,17 @@ def to_str (s): return s return str (s, 'utf-8') + + +# No cmp in py3, so we'll define it. +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) + + # Local Variables: # tab-width:4 # indent-tabs-mode:nil diff --git a/src/engine/SCons/Variables/VariablesTests.py b/src/engine/SCons/Variables/VariablesTests.py index 7ee66ca..b260d54 100644 --- a/src/engine/SCons/Variables/VariablesTests.py +++ b/src/engine/SCons/Variables/VariablesTests.py @@ -32,6 +32,7 @@ import TestUnit import SCons.Variables import SCons.Subst import SCons.Warnings +from SCons.Util import cmp class Environment(object): @@ -49,12 +50,6 @@ class Environment(object): return key in self.dict -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) def check(key, value, env): -- cgit v0.12