Files
zulip/tools/circleci/generate-dockerfiles
Anders Kaseorg 8dd83228e7 python: Convert "".format to Python 3.6 f-strings.
Generated by pyupgrade --py36-plus --keep-percent-format, but with the
NamedTuple changes reverted (see commit
ba7906a3c6, #15132).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-08 15:31:20 -07:00

26 lines
705 B
Python
Executable File

#!/usr/bin/env python3
import os
import yaml
if __name__ == "__main__":
os.chdir(os.path.abspath(os.path.dirname(__file__)))
with open("Dockerfile.template") as f:
docker_template = f.read()
with open("images.yml") as f:
dockerfile_settings = yaml.safe_load(f)
for distro in dockerfile_settings:
dockerfile_path = f"images/{distro}/Dockerfile"
os.makedirs(os.path.dirname(dockerfile_path), exist_ok=True)
with open(dockerfile_path, "w") as f:
f.write("""\
# THIS IS A GENERATED FILE. DO NOT EDIT.
# See template: tools/circleci/Dockerfile.template
""")
f.write(docker_template.format_map(dockerfile_settings[distro]))