[libcxx-commits] [libcxx] 6091025 - [libc++] Make sure we use POSIX paths in header_information.py

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 1 19:56:26 PDT 2023


Author: Louis Dionne
Date: 2023-06-01T19:56:06-07:00
New Revision: 6091025b857ac1d24c98dffe0eaa0cb38cb7d4b5

URL: https://github.com/llvm/llvm-project/commit/6091025b857ac1d24c98dffe0eaa0cb38cb7d4b5
DIFF: https://github.com/llvm/llvm-project/commit/6091025b857ac1d24c98dffe0eaa0cb38cb7d4b5.diff

LOG: [libc++] Make sure we use POSIX paths in header_information.py

Otherwise, the various lists of headers have different content based
on whether they are run on Windows or other platforms, which makes it
really difficult to write .gen.py tests correctly.

Differential Revision: https://reviews.llvm.org/D151913

Added: 
    

Modified: 
    libcxx/utils/libcxx/test/header_information.py

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/libcxx/test/header_information.py b/libcxx/utils/libcxx/test/header_information.py
index 4f0dd3341e184..db4cf72543d55 100644
--- a/libcxx/utils/libcxx/test/header_information.py
+++ b/libcxx/utils/libcxx/test/header_information.py
@@ -130,28 +130,22 @@ def is_header(file):
         and file.name != "libcxx.imp"
     )
 
-monorepo_root = pathlib.Path(
-    os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
-)
-include = pathlib.Path(os.path.join(monorepo_root, "libcxx", "include"))
-test = pathlib.Path(os.path.join(monorepo_root, "libcxx", "test"))
-assert monorepo_root.exists()
+libcxx_root = pathlib.Path(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
+include = pathlib.Path(os.path.join(libcxx_root, "include"))
+test = pathlib.Path(os.path.join(libcxx_root, "test"))
+assert libcxx_root.exists()
 
 toplevel_headers = sorted(
-    str(p.relative_to(include)) for p in include.glob("[a-z]*") if is_header(p)
+    p.relative_to(include).as_posix() for p in include.glob("[a-z]*") if is_header(p)
 )
 experimental_headers = sorted(
-    str(p.relative_to(include))
-    for p in include.glob("experimental/[a-z]*")
-    if is_header(p)
+    p.relative_to(include).as_posix() for p in include.glob("experimental/[a-z]*") if is_header(p)
 )
 public_headers = toplevel_headers + experimental_headers
 private_headers = sorted(
-    str(p.relative_to(include))
-    for p in include.rglob("*")
-    if is_header(p)
-    and str(p.relative_to(include)).startswith("__")
-    and not p.name.startswith("pstl")
+    p.relative_to(include).as_posix() for p in include.rglob("*") if is_header(p)
+                                                                     and str(p.relative_to(include)).startswith("__")
+                                                                     and not p.name.startswith("pstl")
 )
 variables = {
     "toplevel_headers": toplevel_headers,


        


More information about the libcxx-commits mailing list