Mercurial > repos > davidvanzessen > shm_csr
view create_container_hash.py @ 93:8fcf31272f6e draft
planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
author | rhpvorderman |
---|---|
date | Mon, 06 Mar 2023 11:36:32 +0000 |
parents | 6809c63d9161 |
children |
line wrap: on
line source
#!/usr/bin/env python3 import sys from xml.etree import ElementTree from xml.etree.ElementTree import Element DEFAULT_BASE_IMAGE = "bgruening/busybox-bash:0.1" def main(): try: base_image = sys.argv[1] except IndexError: base_image = DEFAULT_BASE_IMAGE tool = ElementTree.parse("shm_csr.xml").getroot() requirements: Element = tool.find("requirements") packages = [] for req in requirements.findall("requirement"): if req.get("type") == "package": name = req.text version = req.get("version") package_string = f"{name}={version}" packages.append(package_string) with open("container_hash.tsv", mode="wt") as container_hash_file: container_hash_file.write("#targets\tbase_image\timage_build\n") container_hash_file.write(",".join(packages) + f"\t{base_image}\t0\n") if __name__ == "__main__": main()