aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2020-03-09 19:43:26 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2020-03-09 19:43:26 +0100
commitcd0ed87c8cf26914d0f51b8efe12c771e0ae991b (patch)
tree6c60d3fc673189b845eb3bcc6429ab3edf0939ec /src
parent3884a7712b74c09d4216b856464d6c3cdd9e3476 (diff)
downloadallocbench-cd0ed87c8cf26914d0f51b8efe12c771e0ae991b.tar.gz
allocbench-cd0ed87c8cf26914d0f51b8efe12c771e0ae991b.zip
improve artifact code
don't override format don't override Artifact.provide with lesser parameters
Diffstat (limited to 'src')
-rw-r--r--src/artifact.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/artifact.py b/src/artifact.py
index 9df01c8..6f8b871 100644
--- a/src/artifact.py
+++ b/src/artifact.py
@@ -43,7 +43,7 @@ class Artifact:
self.name = name
self.basedir = os.path.join(ARTIFACT_STORE_DIR, name)
- def retrieve(self, cmd):
+ def _retrieve(self, cmd):
"""Run cmd to retrieve the artifact"""
os.makedirs(self.basedir, exist_ok=True)
@@ -61,7 +61,7 @@ class GitArtifact(Artifact):
def retrieve(self):
"""clone the git repo"""
- super().retrieve(
+ super()._retrieve(
["git", "clone", "--recursive", "--bare", self.url, "repo"])
def provide(self, checkout, location=None):
@@ -73,12 +73,12 @@ class GitArtifact(Artifact):
if os.path.exists(location):
try:
run_cmd(["git", "fetch"], output_verbosity=1, cwd=location)
- except CalledProcessError as e:
+ except CalledProcessError:
print_error(f"Failed to update {location}")
raise
try:
run_cmd(["git", "reset", "--hard", checkout], output_verbosity=1, cwd=location)
- except CalledProcessError as e:
+ except CalledProcessError:
print_error(f"Failed to update {location}")
raise
return location
@@ -91,7 +91,7 @@ class GitArtifact(Artifact):
print_status(f'Updating git repository "{self.name}" ...')
try:
run_cmd(["git", "fetch"], output_verbosity=1, cwd=self.repo)
- except CalledProcessError as e:
+ except CalledProcessError:
print_error(f"Failed to update {self.name}")
raise
@@ -100,7 +100,7 @@ class GitArtifact(Artifact):
f"in {self.repo}")
try:
run_cmd(worktree_cmd, output_verbosity=1, cwd=self.repo)
- except CalledProcessError as e:
+ except CalledProcessError:
print_error(f"Failed to provide {self.name}")
raise
@@ -117,20 +117,20 @@ class ArchiveArtifact(Artifact):
"""External archive"""
supported_formats = ["tar"]
- def __init__(self, name, url, format, checksum):
+ def __init__(self, name, url, archive_format, checksum):
super().__init__(name)
self.url = url
- if format not in self.supported_formats:
+ if archive_format not in self.supported_formats:
raise Exception(
f'Archive format "{format}" not in supported list {self.supported_formats}'
)
- self.format = format
- self.archive = os.path.join(self.basedir, f"{self.name}.{self.format}")
+ self.archive_format = archive_format
+ self.archive = os.path.join(self.basedir, f"{self.name}.{self.archive_format}")
self.checksum = checksum
def retrieve(self):
"""download the archive"""
- super().retrieve(["wget", "-O", self.archive, self.url])
+ super()._retrieve(["wget", "-O", self.archive, self.url])
def provide(self, location=None):
"""extract the archive"""
@@ -155,7 +155,7 @@ class ArchiveArtifact(Artifact):
os.makedirs(location, exist_ok=True)
# Extract archive
- if self.format == "tar":
+ if self.archive_format == "tar":
cmd = ["tar", "Cxf", location, self.archive]
print_debug(f"extract archive by running: {cmd} in {self.basedir}")