Skip to content

Commit

Permalink
cellref: Better name checking
Browse files Browse the repository at this point in the history
Fix RTD not including source with warning
`WARNING: invalid signature for autocellsource ('/home/docs/checkouts/readthedocs.org/user_builds/yosys/checkouts/manual-rewrite/source/generated/simlib.v:$alu::__source')`.
  • Loading branch information
KrystalDelusion committed May 20, 2024
1 parent 2f53e7b commit 15257dc
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions docs/util/cellref.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# cell signature
cell_ext_sig_re = re.compile(
r'''^ (?:([\w._/]+):)? # explicit file name
r'''^ (?:([^:\s]+):)? # explicit file name
([\w$._]+?)? # module and/or class name(s)
(?:\.([\w_]+))? # optional: thing name
(::[\w_]+)? # attribute
Expand Down Expand Up @@ -147,9 +147,18 @@ def import_object(self, raiseerror: bool = False) -> bool:
try:
parsed_lib = self.parsed_libs[objpath]
except KeyError:
parsed_lib = load_cell_lib(objpath)
try:
parsed_lib = load_cell_lib(objpath)
except FileNotFoundError:
logger.warning(
f"unable to find cell lib at {'/'.join(self.objpath)}",
type = 'cellref',
subtype = 'import_object'
)
return False
self.parsed_libs[objpath] = parsed_lib


# get cell
try:
self.object = parsed_lib[self.modname]
Expand Down Expand Up @@ -264,7 +273,12 @@ def generate(
)
return

self.import_object()
if not self.import_object():
logger.warning(
f"unable to load {self.name}",
type = 'cellref'
)
return

# check __module__ of object (for members not given explicitly)
# if check_module:
Expand Down

0 comments on commit 15257dc

Please sign in to comment.