aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-04-13 23:59:48 +0300
committerGitHub <noreply@github.com>2017-04-13 23:59:48 +0300
commitb951e60f0683c9198d62004a5ef3d4c1cb9ba38f (patch)
treeaaf098f0a1367ce5ebe5e6a239f02e27b5df0269 /mesonbuild/mesonlib.py
parentf0a077e55b1792ea67e1df4d747476bdf5f40eec (diff)
parent2db11f1383e3d9c59f54f4a742bd44ad85dce226 (diff)
downloadmeson-b951e60f0683c9198d62004a5ef3d4c1cb9ba38f.zip
meson-b951e60f0683c9198d62004a5ef3d4c1cb9ba38f.tar.gz
meson-b951e60f0683c9198d62004a5ef3d4c1cb9ba38f.tar.bz2
Merge pull request #1548 from ssssam/sam/stable-ordering
Stable ordering of some commandlines generated by 'gnome' module
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index 0a8478b..ae2f88c 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -16,6 +16,7 @@
import stat
import platform, subprocess, operator, os, shutil, re
+import collections
from glob import glob
@@ -685,3 +686,18 @@ def get_filenames_templates_dict(inputs, outputs):
if values['@OUTDIR@'] == '':
values['@OUTDIR@'] = '.'
return values
+
+class OrderedSet(collections.OrderedDict):
+ '''
+ A 'set' equivalent that preserves the order in which items are added.
+
+ This is a hack implementation that wraps OrderedDict. It may not be the
+ most efficient solution and might need fixing to override more methods.
+ '''
+ def __init__(self, iterable=None):
+ if iterable:
+ self.update(iterable)
+
+ def update(self, iterable):
+ for item in iterable:
+ self[item] = True