18
18
19
19
SELF_PATH = Path (__file__ )
20
20
ETC_DIR = SELF_PATH .parent
21
- ROOT_DIR = ETC_DIR .parent
21
+ LIBM_DIR = ETC_DIR .parent . joinpath ( "libm" )
22
22
23
23
# These files do not trigger a retest.
24
24
IGNORED_SOURCES = ["src/libm_helper.rs" , "src/math/support/float_traits.rs" ]
@@ -75,7 +75,7 @@ def get_rustdoc_json() -> dict[Any, Any]:
75
75
"-Zunstable-options" ,
76
76
"-o-" ,
77
77
],
78
- cwd = ROOT_DIR ,
78
+ cwd = LIBM_DIR ,
79
79
text = True ,
80
80
)
81
81
j = json .loads (j )
@@ -121,8 +121,8 @@ def _init_defs(self, index: IndexTy) -> None:
121
121
122
122
# A lot of the `arch` module is often configured out so doesn't show up in docs. Use
123
123
# string matching as a fallback.
124
- for fname in glob ("src/math/arch/**.rs" , root_dir = ROOT_DIR ):
125
- contents = (ROOT_DIR .joinpath (fname )).read_text ()
124
+ for fname in glob ("src/math/arch/**.rs" , root_dir = LIBM_DIR ):
125
+ contents = (LIBM_DIR .joinpath (fname )).read_text ()
126
126
127
127
for name in self .public_functions :
128
128
if f"fn { name } " in contents :
@@ -188,10 +188,10 @@ def tidy_lists(self) -> None:
188
188
include all public API.
189
189
"""
190
190
191
- flist = sp .check_output (["git" , "ls-files" ], cwd = ROOT_DIR , text = True )
191
+ flist = sp .check_output (["git" , "ls-files" ], cwd = LIBM_DIR , text = True )
192
192
193
193
for path in flist .splitlines ():
194
- fpath = ROOT_DIR .joinpath (path )
194
+ fpath = LIBM_DIR .joinpath (path )
195
195
if fpath .is_dir () or fpath == SELF_PATH :
196
196
continue
197
197
@@ -229,7 +229,7 @@ def ensure_contains_api(self, fpath: Path, line_num: int, lines: list[str]):
229
229
if len (not_found ) == 0 :
230
230
return
231
231
232
- relpath = fpath .relative_to (ROOT_DIR )
232
+ relpath = fpath .relative_to (LIBM_DIR )
233
233
eprint (f"functions not found at { relpath } :{ line_num } : { not_found } " )
234
234
exit (1 )
235
235
@@ -244,7 +244,7 @@ def validate_delimited_block(
244
244
"""Identify blocks of code wrapped within `start` and `end`, collect their contents
245
245
to a list of strings, and call `validate` for each of those lists.
246
246
"""
247
- relpath = fpath .relative_to (ROOT_DIR )
247
+ relpath = fpath .relative_to (LIBM_DIR )
248
248
block_lines = []
249
249
block_start_line : None | int = None
250
250
for line_num , line in enumerate (lines ):
@@ -274,7 +274,7 @@ def validate_delimited_block(
274
274
275
275
def ensure_sorted (fpath : Path , block_start_line : int , lines : list [str ]) -> None :
276
276
"""Ensure that a list of lines is sorted, otherwise print a diff and exit."""
277
- relpath = fpath .relative_to (ROOT_DIR )
277
+ relpath = fpath .relative_to (LIBM_DIR )
278
278
diff_and_exit (
279
279
"\n " .join (lines ),
280
280
"\n " .join (sorted (lines )),
0 commit comments