From 9dba3e9e8672d3bb74540921e140d63380fe0c89 Mon Sep 17 00:00:00 2001 From: Bill Little Date: Mon, 21 Oct 2024 14:58:31 +0100 Subject: [PATCH] fix for lock2yaml (#1171) --- requirements/locks/lock2yaml.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements/locks/lock2yaml.py b/requirements/locks/lock2yaml.py index 1793b26b..3bfb4578 100755 --- a/requirements/locks/lock2yaml.py +++ b/requirements/locks/lock2yaml.py @@ -8,6 +8,7 @@ from __future__ import annotations +from pathlib import Path import sys from jinja2 import Environment, FileSystemLoader, select_autoescape @@ -22,15 +23,14 @@ template = environment.get_template("lock2yaml.txt") # default to linux-64 only -env = sys.argv[1] +env = f"{sys.argv[1]}-lock" lock = f"{env}-linux-64.txt" name = f"geovista-{env}" yaml = f"{env}-linux-64.yml" -# TODO @bjlittle: use Path.open when >=py311 and remove .ruff.toml ignore -with open(lock) as fin: +with Path(lock).open(mode="r") as fin: content = template.render(file=fin, name=name) -with open(yaml, mode="w", encoding="utf-8") as fout: +with Path(yaml).open(mode="w", encoding="utf-8") as fout: fout.write(content) fout.write("\n")