diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 155183dd7..775526b2e 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -297,12 +297,12 @@ jobs: RUN apk add -U --no-cache graphviz EOF - - name: 🛳️ Build documentation from './pyVHDLModel/doc' + - name: 🛳️ Build documentation from './pyVHDLModel/doc' and publish to GitHub Pages uses: buildthedocs/btd@v0 with: token: ${{ github.token }} - - name: 📤 Upload artifacts to GitHub Pages + - name: 📤 Upload artifacts uses: actions/upload-artifact@master with: name: doc diff --git a/doc/_extensions/.gitempty b/doc/_extensions/.gitempty new file mode 100644 index 000000000..e69de29bb diff --git a/doc/conf.py b/doc/conf.py index 6e13ad593..387ba9039 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -36,8 +36,8 @@ def _LatestTagName(): return check_output(["git", "describe", "--abbrev=0", "--tags"], universal_newlines=True).strip() # The full version, including alpha/beta/rc tags -version = "0.12" # The short X.Y version. -release = "0.12.0" # The full version, including alpha/beta/rc tags. +version = "0.13" # The short X.Y version. +release = "0.13.0" # The full version, including alpha/beta/rc tags. try: if _IsUnderGitControl: latestTagName = _LatestTagName()[1:] # remove prefix "v" diff --git a/doc/requirements.txt b/doc/requirements.txt index da63251ac..210a45816 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,6 +1,6 @@ -r ../requirements.txt # Enforce latest version on ReadTheDocs -sphinx>=4.1.2 +sphinx>=4.2.0 # Sphinx Extenstions #sphinx.ext.coverage diff --git a/pyVHDLModel/__init__.py b/pyVHDLModel/__init__.py index e4fba2bc9..d62310e54 100644 --- a/pyVHDLModel/__init__.py +++ b/pyVHDLModel/__init__.py @@ -41,12 +41,12 @@ :license: Apache License, Version 2.0 """ from enum import IntEnum, unique, Enum -from typing import List, Iterable, Union, Optional as Nullable +from typing import List, Iterable, Union, Optional as Nullable, Dict from pydecor import export -__version__ = "0.12.0" +__version__ = "0.13.0" SimpleOrAttribute = Union['SimpleName', 'AttributeName'] @@ -86,6 +86,90 @@ 'ContextReference' ] + +@export +@unique +class VHDLVersion(Enum): + """ + An enumeration for all possible version numbers for VHDL. + + A version can be given as integer or string and is represented as a unified + enumeration value. + + This enumeration supports compare operators. + """ + + VHDL87 = 87 + VHDL93 = 93 + VHDL2002 = 2002 + VHDL2008 = 2008 + VHDL2019 = 2019 + + __VERSION_MAPPINGS__: Dict[Union[int, str], Enum] = { + 87: VHDL87, + 93: VHDL93, + 2: VHDL2002, + 8: VHDL2008, + 19: VHDL2019, + 1987: VHDL87, + 1993: VHDL93, + 2002: VHDL2002, + 2008: VHDL2008, + 2019: VHDL2019, + "87": VHDL87, + "93": VHDL93, + "02": VHDL2002, + "08": VHDL2008, + "19": VHDL2019, + "1987": VHDL87, + "1993": VHDL93, + "2002": VHDL2002, + "2008": VHDL2008, + "2019": VHDL2019 + } + + def __init__(self, *_) -> None: + """Patch the embedded MAP dictionary""" + for k, v in self.__class__.__VERSION_MAPPINGS__.items(): + if ((not isinstance(v, self.__class__)) and (v == self.value)): + self.__class__.__VERSION_MAPPINGS__[k] = self + + @classmethod + def Parse(cls, value: Union[int, str]) -> 'Enum': + try: + return cls.__VERSION_MAPPINGS__[value] + except KeyError: + ValueError("Value '{0!s}' cannot be parsed to member of {1}.".format(value, cls.__name__)) + + def __lt__(self, other: Enum) -> bool: + return self.value < other.value + + def __le__(self, other: Enum) -> bool: + return self.value <= other.value + + def __gt__(self, other: Enum) -> bool: + return self.value > other.value + + def __ge__(self, other: Enum) -> bool: + return self.value >= other.value + + def __ne__(self, other: Enum) -> bool: + return self.value != other.value + + def __eq__(self, other: Enum) -> bool: + if ((self is self.__class__.Any) or (other is self.__class__.Any)): + return True + else: + return (self.value == other.value) + + + def __str__(self) -> str: + return "VHDL'" + str(self.value)[-2:] + + def __repr__(self) -> str: + return str(self.value) + + @export @unique class Direction(Enum): diff --git a/setup.py b/setup.py index 8f90bd7ee..dd6ae4414 100644 --- a/setup.py +++ b/setup.py @@ -53,7 +53,7 @@ # Assemble all package information setuptools_setup( name=projectName, - version="0.12.0", + version="0.13.0", author="Patrick Lehmann", author_email="Paebbels@gmail.com", diff --git a/tests/unit/Instantiate.py b/tests/unit/Instantiate.py index a021ca1d1..60bf68abd 100644 --- a/tests/unit/Instantiate.py +++ b/tests/unit/Instantiate.py @@ -10,10 +10,6 @@ # # Python unittest: Instantiation tests for the language model. # -# Description: -# ------------------------------------ -# TODO: -# # License: # ============================================================================== # Copyright 2017-2021 Patrick Lehmann - Boetzingen, Germany