Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.27.1 #75

Merged
merged 3 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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__ = "Paebbels@gmail.com"
__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
Loading