diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2019-08-25 00:36:26 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2019-08-25 00:36:26 +0200 |
| commit | 7ea7b89464e4ea9dc2213fa8419069cada18dac0 (patch) | |
| tree | 3dc47c371cda667a733b9c29affc0aaaa95d8267 | |
| parent | 1629a0463972cb86fd7e73b7a11834dc02d2b6ff (diff) | |
| download | allocbench-7ea7b89464e4ea9dc2213fa8419069cada18dac0.tar.gz allocbench-7ea7b89464e4ea9dc2213fa8419069cada18dac0.zip | |
don't permanently store substitutions
this fixes that multiple calls to Allocator.build() lose their {{fmt}}
formatting strings.
| -rw-r--r-- | src/allocator.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/allocator.py b/src/allocator.py index ae22620..e917f10 100644 --- a/src/allocator.py +++ b/src/allocator.py @@ -152,19 +152,21 @@ class Allocator (object): f.write(str(datetime.now().timestamp())) print_info2("Create allocator dictionary") + res_dict = {"cmd_prefix": self.cmd_prefix or "", + "binary_suffix": self.binary_suffix or "", + "LD_PRELOAD": self.LD_PRELOAD or "", + "LD_LIBRARY_PATH": self.LD_LIBRARY_PATH or "", + "color": self.color} + + paths = {"dir": self.dir} + paths["srcdir"] = self.sources.dir if self.sources is not None else "" + for attr in ["LD_PRELOAD", "LD_LIBRARY_PATH", "cmd_prefix"]: value = getattr(self, attr, "") or "" - paths = {"dir": self.dir} - paths["srcdir"] = self.sources.dir if self.sources is not None else "" + if value != "": + value = value.format(**paths) + res_dict[attr] = value - value = value.format(**paths) - setattr(self, attr, value) - - res_dict = {"cmd_prefix": self.cmd_prefix, - "binary_suffix": self.binary_suffix or "", - "LD_PRELOAD": self.LD_PRELOAD, - "LD_LIBRARY_PATH": self.LD_LIBRARY_PATH, - "color": self.color} print_debug("Resulting dictionary:", res_dict) return res_dict |
