From c59dd31434018e74b44b0b5c8a79552a96c829a1 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 2 Aug 2019 11:31:23 +0200 Subject: fix Allocator.build() if sources are None --- src/allocator.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/allocator.py') diff --git a/src/allocator.py b/src/allocator.py index dcb6511..2e223fe 100644 --- a/src/allocator.py +++ b/src/allocator.py @@ -152,12 +152,12 @@ class Allocator (object): print_info2("Create allocator dictionary") for attr in ["LD_PRELOAD", "cmd_prefix"]: - try: - value = getattr(self, attr) - setattr(self, attr, value.format(**{"dir": self.dir, - "srcdir": self.sources.dir})) - except AttributeError: - setattr(self, attr, "") + value = getattr(self, attr, "") or "" + paths = {"dir": self.dir} + paths["srcdir"] = self.sources.dir if self.sources is not None else "" + + value = value.format(**paths) + setattr(self, attr, value) res_dict = {"cmd_prefix": self.cmd_prefix, "binary_suffix": self.binary_suffix or "", -- cgit v1.2.3