aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
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