summaryrefslogtreecommitdiff
path: root/engine/SCons/Variables/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'engine/SCons/Variables/__init__.py')
-rw-r--r--engine/SCons/Variables/__init__.py9
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