-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accept
linksmith inventory
without INFILES
argument
This implements auto-discovery of `objects.inv` in local current working directory.
- Loading branch information
Showing
7 changed files
with
100 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from pathlib import Path | ||
|
||
|
||
class LocalObjectsInv: | ||
""" | ||
Support discovering an `objects.inv` in current working directory. | ||
""" | ||
|
||
# Candidate paths where to look for `objects.inv` in current working directory. | ||
objects_inv_candidates = [ | ||
Path("objects.inv"), | ||
Path("doc") / "_build" / "objects.inv", | ||
Path("docs") / "_build" / "objects.inv", | ||
Path("doc") / "_build" / "html" / "objects.inv", | ||
Path("docs") / "_build" / "html" / "objects.inv", | ||
Path("doc") / "build" / "html" / "objects.inv", | ||
Path("docs") / "build" / "html" / "objects.inv", | ||
] | ||
|
||
@classmethod | ||
def discover(cls, project_root: Path) -> Path: | ||
""" | ||
Return `Path` instance of discovered `objects.inv` in current working directory. | ||
""" | ||
for candidate in cls.objects_inv_candidates: | ||
path = project_root / candidate | ||
if path.exists(): | ||
return path | ||
raise FileNotFoundError("No objects.inv found in working directory") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters