aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-12-18 17:56:31 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-12-18 17:56:31 +0100
commit4926cd110c2bad4e8feab8019ab7f825c912feb4 (patch)
tree220baa6f765e94a5e8cebdbc3b976f8aeeaa1ea6
parent83e2b9aa120bb1e3468e589f9e0fd6ff0871ad28 (diff)
downloadallocbench-4926cd110c2bad4e8feab8019ab7f825c912feb4.tar.gz
allocbench-4926cd110c2bad4e8feab8019ab7f825c912feb4.zip
fix allocator.py
* Don't override members of subclasses * Fix patching
-rw-r--r--src/allocator.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/allocator.py b/src/allocator.py
index b754a8e..1ff29f3 100644
--- a/src/allocator.py
+++ b/src/allocator.py
@@ -62,16 +62,16 @@ class Allocator:
self.patchdir = os.path.join(os.path.splitext(self.class_file)[0])
# members known by the base class
- self.binary_suffix = None
- self.cmd_prefix = None
- self.LD_PRELOAD = None
- self.LD_LIBRARY_PATH = None
- self.color = None
- self.sources = None
- self.version = None
- self.patches = []
- self.prepare_cmds = []
- self.build_cmds = []
+ self.binary_suffix = self.binary_suffix if hasattr(self, "binary_suffix") else None
+ self.cmd_prefix = self.cmd_prefix if hasattr(self, "cmd_prefix") else None
+ self.LD_PRELOAD = self.LD_PRELOAD if hasattr(self, "LD_PRELOAD") else None
+ self.LD_LIBRARY_PATH = self.LD_LIBRARY_PATH if hasattr(self, "LD_LIBRARY_PATH") else None
+ self.color = self.color if hasattr(self, "color") else None
+ self.sources = self.sources if hasattr(self, "sources") else None
+ self.version = self.version if hasattr(self, "version") else None
+ self.patches = self.patches if hasattr(self, "patches") else []
+ self.prepare_cmds = self.prepare_cmds if hasattr(self, "prepare_cmds") else []
+ self.build_cmds = self.build_cmds if hasattr(self, "build_cmds") else []
# Update attributes
for attr, value in kwargs.items():
@@ -98,14 +98,14 @@ class Allocator:
patch_content = patch_file.read()
# check if patch is already applied
- already_patched = run_cmd(
- ["patch", "-R", "-p0", "-s", "-f", "--dry-run"],
+ not_patched = run_cmd(
+ ["patch", "-R", "-p0", "-s", "-f", "--dry-run", "--verbose"],
cwd=cwd,
input=patch_content,
check=False).returncode
- if not already_patched:
+ if not_patched:
try:
- run_cmd(["patch", "-p0"], cwd=cwd, input=patch_content)
+ run_cmd(["patch", "-p0", "--verbose"], cwd=cwd, input=patch_content)
except CalledProcessError as e:
print_debug(e.stderr, file=sys.stderr)
print_error(f"Patching of {self.name} failed.")