1818
1919SELF_PATH = Path (__file__ )
2020ETC_DIR = SELF_PATH .parent
21- ROOT_DIR = ETC_DIR .parent
21+ LIBM_DIR = ETC_DIR .parent . joinpath ( "libm" )
2222
2323# These files do not trigger a retest.
2424IGNORED_SOURCES = ["src/libm_helper.rs" , "src/math/support/float_traits.rs" ]
@@ -75,7 +75,7 @@ def get_rustdoc_json() -> dict[Any, Any]:
7575 "-Zunstable-options" ,
7676 "-o-" ,
7777 ],
78- cwd = ROOT_DIR ,
78+ cwd = LIBM_DIR ,
7979 text = True ,
8080 )
8181 j = json .loads (j )
@@ -121,8 +121,8 @@ def _init_defs(self, index: IndexTy) -> None:
121121
122122 # A lot of the `arch` module is often configured out so doesn't show up in docs. Use
123123 # 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 ()
126126
127127 for name in self .public_functions :
128128 if f"fn { name } " in contents :
@@ -188,10 +188,10 @@ def tidy_lists(self) -> None:
188188 include all public API.
189189 """
190190
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 )
192192
193193 for path in flist .splitlines ():
194- fpath = ROOT_DIR .joinpath (path )
194+ fpath = LIBM_DIR .joinpath (path )
195195 if fpath .is_dir () or fpath == SELF_PATH :
196196 continue
197197
@@ -229,7 +229,7 @@ def ensure_contains_api(self, fpath: Path, line_num: int, lines: list[str]):
229229 if len (not_found ) == 0 :
230230 return
231231
232- relpath = fpath .relative_to (ROOT_DIR )
232+ relpath = fpath .relative_to (LIBM_DIR )
233233 eprint (f"functions not found at { relpath } :{ line_num } : { not_found } " )
234234 exit (1 )
235235
@@ -244,7 +244,7 @@ def validate_delimited_block(
244244 """Identify blocks of code wrapped within `start` and `end`, collect their contents
245245 to a list of strings, and call `validate` for each of those lists.
246246 """
247- relpath = fpath .relative_to (ROOT_DIR )
247+ relpath = fpath .relative_to (LIBM_DIR )
248248 block_lines = []
249249 block_start_line : None | int = None
250250 for line_num , line in enumerate (lines ):
@@ -274,7 +274,7 @@ def validate_delimited_block(
274274
275275def ensure_sorted (fpath : Path , block_start_line : int , lines : list [str ]) -> None :
276276 """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 )
278278 diff_and_exit (
279279 "\n " .join (lines ),
280280 "\n " .join (sorted (lines )),
0 commit comments