diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-12-14 15:56:14 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-12-14 15:56:14 +0100 |
commit | 0d31d7cdc6ebdbaff868a8a03690afe1a8e8a4db (patch) | |
tree | 42e1a6f9b34cfcb4f2908d27506ebb78c1e36198 /engine/SCons/Variables/__init__.py | |
parent | 5ed7f9cf4e33468b3b75e057db461b30a81febe4 (diff) | |
parent | e18cb63b889697e54fe06be3eef8889b39f9fb4b (diff) |
Merge branch 'feature/upstream' into develop
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 |