Module: Mesa
Branch: main
Commit: c6ebf9d643e4fbed68232f21c018856d858e86b0
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c6ebf9d643e4fbed68232f21c018856d858e86b0

Author: Eric Engestrom <[email protected]>
Date:   Sun Aug  7 19:42:28 2022 +0100

vk/update-aliases.py: allow specifying the files we want to update

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26484>

---

 src/vulkan/registry/update-aliases.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/vulkan/registry/update-aliases.py 
b/src/vulkan/registry/update-aliases.py
index 77071bcd8dd..f44b7607aa2 100755
--- a/src/vulkan/registry/update-aliases.py
+++ b/src/vulkan/registry/update-aliases.py
@@ -56,7 +56,7 @@ def chunks(lst: list, n: int):
         yield lst[i:i + n]
 
 
-def main():
+def main(paths: list[str]):
     """
     Entrypoint; perform the search for all the aliases and replace them.
     """
@@ -93,10 +93,10 @@ def main():
             'grep',
             '-rlP',
             '|'.join(aliases_chunk),
-            'src/'
-        ], stderr=subprocess.DEVNULL).decode()
+        ] + paths, stderr=subprocess.DEVNULL).decode()
         files_with_aliases.update(search_output.splitlines())
 
+
     def file_matches_path(file: str, path: str) -> bool:
         # if path is a folder; match any file within
         if path.endswith('/') and file.startswith(path):
@@ -128,5 +128,9 @@ def main():
 
 if __name__ == '__main__':
     parser = argparse.ArgumentParser()
+    parser.add_argument('paths',
+                        nargs=argparse.ZERO_OR_MORE,
+                        default=['src/'],
+                        help='Limit script to these paths (default: `src/`)')
     args = parser.parse_args()
     main(**vars(args))

Reply via email to