comparison create_container_hash.py @ 57:33412e85e669 draft

"planemo upload commit 2a9ed3adf321f18047c3746735a5e79a4586798d"
author rhpvorderman
date Wed, 02 Feb 2022 10:50:01 +0000
parents
children
comparison
equal deleted inserted replaced
56:7ae6b6b5d890 57:33412e85e669
1 #!/usr/bin/env python3
2
3 import sys
4
5 from xml.etree import ElementTree
6 from xml.etree.ElementTree import Element
7
8 DEFAULT_BASE_IMAGE = "bgruening/busybox-bash:latest"
9 def main():
10 try:
11 base_image = sys.argv[1]
12 except IndexError:
13 base_image = DEFAULT_BASE_IMAGE
14 tool = ElementTree.parse("complete_immunerepertoire.xml").getroot()
15 requirements: Element = tool.find("requirements")
16 packages = []
17 for req in requirements.findall("requirement"):
18 if req.get("type") == "package":
19 name = req.text
20 version = req.get("version")
21 package_string = f"{name}={version}"
22 packages.append(package_string)
23 with open("container_hash.tsv", mode="wt") as container_hash_file:
24 container_hash_file.write("#targets\tbase_image\timage_build\n")
25 container_hash_file.write(",".join(packages) + f"\t{base_image}\t0\n")
26
27
28 if __name__ == "__main__":
29 main()