Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
mlin committed Jan 31, 2022
1 parent 0069303 commit 35d566d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions WDL/Bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@ def build_layout(doc, ref=None):

ans: Dict[str, Any] = {} if not input else {"input": input}
ans["layout"] = build_layout(doc)
ans["sources"] = sources

# strip common prefix from all abspaths, making bundle reproducible across machines
if len(ans["sources"]) > 1:
prefix = os.path.commonprefix([source["abspath"] for source in ans["sources"]]).rstrip("/")
for source in ans["sources"]:
if len(sources) > 1:
prefix = os.path.commonprefix([source["abspath"] for source in sources]).rstrip("/")
for source in sources:
assert source["abspath"].startswith(prefix)
source["abspath"] = source["abspath"][len(prefix) :]
else:
ans["sources"][0]["abspath"] = "/" + os.path.basename(ans["sources"][0]["abspath"])
sources[0]["abspath"] = "/" + os.path.basename(sources[0]["abspath"])

ans["sources"] = sources

return ans

Expand Down

0 comments on commit 35d566d

Please sign in to comment.