Skip to content

Commit

Permalink
v0.27.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels authored Jul 7, 2023
2 parents df37970 + 9f49589 commit 4a724b6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pyVHDLModel/DesignUnit.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,13 +615,13 @@ def Library(self, library: 'Library') -> None:

def __str__(self) -> str:
lib = self._library._identifier if self._library is not None else "%"
ent = self._entity._identifier if self._entity is not None else "%"
ent = self._entity._name._identifier if self._entity is not None else "%"

return f"Architecture: {lib}.{ent}({self._identifier})"

def __repr__(self) -> str:
lib = self._library._identifier if self._library is not None else "%"
ent = self._entity.Name._identifier if self._entity is not None else "%"
ent = self._entity._name._identifier if self._entity is not None else "%"

return f"{lib}.{ent}({self._identifier})"

Expand Down
13 changes: 13 additions & 0 deletions pyVHDLModel/Exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
The module ``Exceptions`` contains all structured errors that are raised by pyVHDLModel. Besides a default error
message in english, each exception object contains one or multiple references to the exception's context.
"""
from sys import version_info
from typing import List

from pyTooling.Decorators import export

from pyVHDLModel.Symbol import Symbol
Expand All @@ -44,6 +47,16 @@
class VHDLModelException(Exception):
"""Base-class for all exceptions (errors) raised by pyVHDLModel."""

# WORKAROUND: for Python <3.11
# Implementing a dummy method for Python versions before
__notes__: List[str]
if version_info < (3, 11): # pragma: no cover
def add_note(self, message: str):
try:
self.__notes__.append(message)
except AttributeError:
self.__notes__ = [message]


@export
class LibraryExistsInDesignError(VHDLModelException):
Expand Down
6 changes: 4 additions & 2 deletions pyVHDLModel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
__email__ = "[email protected]"
__copyright__ = "2016-2023, Patrick Lehmann"
__license__ = "Apache License, Version 2.0"
__version__ = "0.27.0"
__version__ = "0.27.1"


from enum import unique, Enum, Flag, auto
Expand Down Expand Up @@ -979,7 +979,9 @@ def LinkLibraryReferences(self) -> None:
try:
library = self._libraries[libraryIdentifier]
except KeyError:
raise VHDLModelException(f"Library '{librarySymbol.Name.Identifier}' referenced by library clause of design unit '{designUnit.Identifier}' doesn't exist in design.")
ex = VHDLModelException(f"Library '{librarySymbol.Name.Identifier}' referenced by library clause of design unit '{designUnit.Identifier}' doesn't exist in design.")
ex.add_note(f"""Known libraries: '{"', '".join(library for library in self._libraries)}'""")
raise ex

librarySymbol.Library = library
designUnit._referencedLibraries[libraryIdentifier] = library
Expand Down

0 comments on commit 4a724b6

Please sign in to comment.