Skip to content

Commit

Permalink
Use os.sep as a pre-replacer
Browse files Browse the repository at this point in the history
  • Loading branch information
CasperWA committed Aug 21, 2023
1 parent 69047dd commit b25acc1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ci_cd/tasks/api_reference_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,9 @@ def write_file(full_path: Path, content: str) -> None:
else f"{py_path_root}/{relpath if single_package else relpath.relative_to(package.name)}/{filename.stem}"
)

# Cast py_path to Path to ensure correct formatting (forward slashes)
py_path = str(Path(py_path)).replace("/", ".")
# Replace OS specific path separators with forward slashes before
# replacing that with dots (for Python import paths).
py_path = py_path.replace(os.sep, "/").replace("/", ".")

LOGGER.debug("filename: %s\npy_path: %s", filename, py_path)
if debug:
Expand Down

0 comments on commit b25acc1

Please sign in to comment.