From 15257dcff0042f3bb75a464759671220a60c223f Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 20 May 2024 16:45:23 +1200 Subject: [PATCH] cellref: Better name checking 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')`. --- docs/util/cellref.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/util/cellref.py b/docs/util/cellref.py index 63e6dd543d7..4b970310158 100644 --- a/docs/util/cellref.py +++ b/docs/util/cellref.py @@ -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 @@ -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] @@ -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: