From 9b548d12c766e8fe5aae9db1e8d6c8f63f5dbbd1 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Wed, 29 Jun 2022 16:27:31 +0200 Subject: [PATCH] stages/oci-archive: specify encoding for `open` This is a pyling warning `W1514` "using open without explicitly specifying an encoding" in newer version, so fix this. --- stages/org.osbuild.oci-archive | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stages/org.osbuild.oci-archive b/stages/org.osbuild.oci-archive index 9b3c0299..158717e4 100755 --- a/stages/org.osbuild.oci-archive +++ b/stages/org.osbuild.oci-archive @@ -196,7 +196,7 @@ def blobs_add_file(blobs: str, path: str, mtype: str): def blobs_add_json(blobs: str, js: str, mtype: str): js_file = os.path.join(blobs, "temporary.js") - with open(js_file, "w") as f: + with open(js_file, "w", encoding="utf-8") as f: json.dump(js, f) return blobs_add_file(blobs, js_file, mtype) @@ -326,11 +326,13 @@ def create_oci_dir(inputs, output_dir, options, create_time): # index print("writing index") - with open(os.path.join(output_dir, "index.json"), "w") as f: + index_path = os.path.join(output_dir, "index.json") + with open(index_path, "w", encoding="utf-8") as f: json.dump(index, f) # oci-layout tag - with open(os.path.join(output_dir, "oci-layout"), "w") as f: + layout_path = os.path.join(output_dir, "oci-layout") + with open(layout_path, "w", encoding="utf-8") as f: json.dump({"imageLayoutVersion": "1.0.0"}, f)