Skip to content

Commit

Permalink
Use absolute path instead of relative
Browse files Browse the repository at this point in the history
Fixes #7
  • Loading branch information
CasperWA committed Jul 5, 2022
1 parent 897cb25 commit 3bfdc7a
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ def write_file(full_path: Path, content: str) -> None:
no_docstring_dirs: list[str] = full_docs_dirs.split(",")

if debug:
print("unwanted_subdirs", unwanted_subdirs, flush=True)
print("unwanted_subfiles", unwanted_subfiles, flush=True)
print("no_docstring_dirs", no_docstring_dirs, flush=True)
print("unwanted_subdirs:", unwanted_subdirs, flush=True)
print("unwanted_subfiles:", unwanted_subfiles, flush=True)
print("no_docstring_dirs:", no_docstring_dirs, flush=True)

pages_template = 'title: "{name}"\n'
md_template = "# {name}\n\n::: {py_path}\n"
Expand All @@ -324,22 +324,20 @@ def write_file(full_path: Path, content: str) -> None:
for unwanted_dir in unwanted_subdirs:
if debug:
print("unwanted_dir:", unwanted_dir, flush=True)
print("dirnames;", dirnames, flush=True)
print("dirnames:", dirnames, flush=True)
if unwanted_dir in dirnames:
# Avoid walking into or through unwanted directories
dirnames.remove(unwanted_dir)

relpath = Path(dirpath).relative_to(package_dir)
abspath = (package_dir / relpath).resolve()
if debug:
print("relpath:", relpath, flush=True)
print("abspath:", abspath, flush=True)

if not (package_dir.name / relpath / "__init__.py").exists():
if not (abspath / "__init__.py").exists():
# Avoid paths that are not included in the public Python API
print(
"does not exist:",
package_dir.name / relpath / "__init__.py",
flush=True,
)
print("does not exist:", abspath / "__init__.py", flush=True)
continue

# Create `.pages`
Expand Down

0 comments on commit 3bfdc7a

Please # to comment.