Skip to content

Commit 6091025

Browse files
committed
[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
1 parent 258cd1f commit 6091025

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

libcxx/utils/libcxx/test/header_information.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,28 +130,22 @@ def is_header(file):
130130
and file.name != "libcxx.imp"
131131
)
132132

133-
monorepo_root = pathlib.Path(
134-
os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
135-
)
136-
include = pathlib.Path(os.path.join(monorepo_root, "libcxx", "include"))
137-
test = pathlib.Path(os.path.join(monorepo_root, "libcxx", "test"))
138-
assert monorepo_root.exists()
133+
libcxx_root = pathlib.Path(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
134+
include = pathlib.Path(os.path.join(libcxx_root, "include"))
135+
test = pathlib.Path(os.path.join(libcxx_root, "test"))
136+
assert libcxx_root.exists()
139137

140138
toplevel_headers = sorted(
141-
str(p.relative_to(include)) for p in include.glob("[a-z]*") if is_header(p)
139+
p.relative_to(include).as_posix() for p in include.glob("[a-z]*") if is_header(p)
142140
)
143141
experimental_headers = sorted(
144-
str(p.relative_to(include))
145-
for p in include.glob("experimental/[a-z]*")
146-
if is_header(p)
142+
p.relative_to(include).as_posix() for p in include.glob("experimental/[a-z]*") if is_header(p)
147143
)
148144
public_headers = toplevel_headers + experimental_headers
149145
private_headers = sorted(
150-
str(p.relative_to(include))
151-
for p in include.rglob("*")
152-
if is_header(p)
153-
and str(p.relative_to(include)).startswith("__")
154-
and not p.name.startswith("pstl")
146+
p.relative_to(include).as_posix() for p in include.rglob("*") if is_header(p)
147+
and str(p.relative_to(include)).startswith("__")
148+
and not p.name.startswith("pstl")
155149
)
156150
variables = {
157151
"toplevel_headers": toplevel_headers,

0 commit comments

Comments
 (0)