util/glsl2spirv: don't store preprocessed files in source tree
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Sun, 20 Nov 2022 22:00:22 +0000 (00:00 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 22 Nov 2022 12:25:12 +0000 (12:25 +0000)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Dylan Baker <dylan.c.baker@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19893>

src/util/glsl2spirv.py

index 8a1fba2..dbe53e5 100644 (file)
@@ -125,8 +125,8 @@ def postprocess_file(args: Arguments) -> None:
         w.writelines(lines)
 
 
-def preprocess_file(args: Arguments, origin_file: T.TextIO) -> str:
-    with open(origin_file.name + ".copy", "w") as copy_file:
+def preprocess_file(args: Arguments, origin_file: T.TextIO, directory: os.PathLike) -> str:
+    with open(os.path.join(directory, os.path.basename(origin_file.name)), "w") as copy_file:
         lines = origin_file.readlines()
 
         if args.create_entry is not None:
@@ -142,7 +142,8 @@ def preprocess_file(args: Arguments, origin_file: T.TextIO) -> str:
 
 def process_file(args: Arguments) -> None:
     with open(args.input, "r") as infile:
-        copy_file = preprocess_file(args, infile)
+        copy_file = preprocess_file(args, infile,
+                                    os.path.dirname(args.output))
 
     cmd_list = [args.glslang]