From 8ee82412de53a6092cdc41d103070955e6fccc1e Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 8 Jul 2023 00:45:05 +0200 Subject: [PATCH 01/48] Bumped version to v0.3.0. --- pyEDAA/CLITool/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyEDAA/CLITool/__init__.py b/pyEDAA/CLITool/__init__.py index 58ff636e..fb9daf9f 100644 --- a/pyEDAA/CLITool/__init__.py +++ b/pyEDAA/CLITool/__init__.py @@ -34,5 +34,5 @@ __email__ = "Paebbels@gmail.com" __copyright__ = "2014-2023, Patrick Lehmann, Unai Martinez-Corral" __license__ = "Apache License, Version 2.0" -__version__ = "0.2.1" +__version__ = "0.3.0" __keywords__ = ["cli", "abstraction layer", "eda"] From 41d51c5d2bbc2bcbe03af549618a099eb0355f02 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 8 Jul 2023 00:51:12 +0200 Subject: [PATCH 02/48] Reactivate job combinations. --- .github/workflows/Pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 977ed38f..2de5c543 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -12,7 +12,7 @@ jobs: uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev with: name: pyEDAA.CLITool - disable_list: "mingw64:3.10 windows:3.7 windows:3.8 windows:3.9 windows:3.10 windows:3.11" +# disable_list: "mingw64:3.10 windows:3.7 windows:3.8 windows:3.9 windows:3.10 windows:3.11" UnitTesting: uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@dev From c37c2e8e4ea6fb87f3457a1d96ffc504421a2d56 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 8 Jul 2023 01:02:45 +0200 Subject: [PATCH 03/48] Bumped dependencies. --- doc/Dependency.rst | 2 +- tests/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/Dependency.rst b/doc/Dependency.rst index 4de58bb2..1408d1fe 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -73,7 +73,7 @@ the mandatory dependencies too. +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `Coverage `__ | ≥7.0 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `mypy `__ | ≥0.990 | `MIT `__ | *Not yet evaluated.* | +| `mypy `__ | ≥1.2 | `MIT `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `lxml `__ | ≥4.9 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ diff --git a/tests/requirements.txt b/tests/requirements.txt index 7719481f..6407e55c 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -8,5 +8,5 @@ pytest>=7.2.0 pytest-cov>=4.0.0 # Static Type Checking -mypy>=0.990 +mypy >= 1.2 lxml>=4.9 From 807336f78f4a2c301528644307bf5fc8a947856b Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 8 Jul 2023 19:53:05 +0200 Subject: [PATCH 04/48] Improved GHDL. --- pyEDAA/CLITool/GHDL.py | 131 +++++++++++++++++++++++++++++++++++-- pyEDAA/CLITool/__init__.py | 8 +++ tests/unit/GHDL.py | 58 ++++++++++++++-- 3 files changed, 188 insertions(+), 9 deletions(-) diff --git a/pyEDAA/CLITool/GHDL.py b/pyEDAA/CLITool/GHDL.py index 815813c0..bce7a656 100644 --- a/pyEDAA/CLITool/GHDL.py +++ b/pyEDAA/CLITool/GHDL.py @@ -30,10 +30,11 @@ # ==================================================================================================================== # # """This module contains the CLI abstraction layer for `GHDL `__.""" -from typing import Union, Iterable +from re import search as re_search +from typing import Union, Iterable, Tuple from pyTooling.Decorators import export -from pyVHDLModel import VHDLVersion +from pyVHDLModel import VHDLVersion from pyTooling.CLIAbstraction import CLIArgument, Executable from pyTooling.CLIAbstraction.Argument import PathListArgument, StringArgument @@ -43,6 +44,107 @@ from pyTooling.CLIAbstraction.ValuedFlag import ShortValuedFlag, LongValuedFlag from pyTooling.CLIAbstraction.KeyValueFlag import ShortKeyValueFlag +from pyEDAA.CLITool import CLIToolException + + +@export +class GHDLVersion: + _major: int + _minor: int + _micro: int + _dev: bool + _commitsSinceLastTag: int + _gitHash: str + _dirty: bool + _edition: str + _gnatCompiler: Tuple[int, int, int] + _backend: str + + def __init__(self, versionLine: str, gnatLine: str, backendLine: str): + match = re_search( + r"GHDL" + r"\s(?P\d+)" + r"\.(?P\d+)" + r"\.(?P\d+)" + r"(?:-(?Pdev))?" + r"\s\(" + r"(?P\d+)" + r"\.(?P\d+)" + r"\.(?P\d+)" + r"\.(?:r(?P\d+))" + r"\.(?:g(?P[0-9a-f]+))" + r"(?:\.(?Pdirty))?" + r"\)\s" + r"\[(?P[\w\s]+)\]", + versionLine) + + if match is None: + raise CLIToolException(f"Unknown first GHDL version string '{versionLine}'.") + + self._major = int(match["major"]) + self._minor = int(match["minor"]) + self._micro = int(match["micro"]) + self._dev = "dev" in match.groups() + self._commitsSinceLastTag = int(match["cslt"]) + self._gitHash = match["hash"] + self._dirty = "dirty" in match.groups() + self._edition = match["edition"] + + match = re_search( + r"\s*[\w\s]+:\s(?P\d+)\.(?P\d+)\.(?P\d+)", gnatLine) + + if match is None: + raise CLIToolException(f"Unknown second GHDL version string '{gnatLine}'.") + + self._gnatCompiler = (match["major"], match["minor"], match["micro"]) + + match = re_search( + r"\s*(?P\w+)\scode\sgenerator", backendLine) + + if match is None: + raise CLIToolException(f"Unknown third GHDL version string '{backendLine}'.") + + self._backend = match["backend"] + + @property + def Major(self) -> int: + return self._major + + @property + def Minor(self) -> int: + return self._minor + + @property + def Micro(self) -> int: + return self._micro + + @property + def Dev(self) -> bool: + return self._dev + + @property + def CommitsSinceLastTag(self) -> int: + return self._commitsSinceLastTag + + @property + def GitHash(self) -> str: + return self._gitHash + + @property + def Dirty(self) -> bool: + return self._dirty + + @property + def Edition(self) -> str: + return self._edition + + def __str__(self) -> str: + dev = f"-dev" if self._dev else "" + return f"{self._major}.{self._minor}.{self._micro}{dev}" + + def __repr__(self) -> str: + return f"{self.__str__()} (Backend: {self._backend}; Git: {self._gitHash})" + @export class GHDL(Executable): @@ -227,8 +329,8 @@ class FlagSyntesisBindingRule(ShortFlag, name="error", pattern="-W{0}"): """Turns warnings into errors.""" @CLIArgument() - class OptionPath(PathListArgument): - """Add VHDL file to analyze.""" + class OptionPaths(PathListArgument): + """Add list of VHDL files to analyze.""" @CLIArgument() class OptionTopLevel(StringArgument): @@ -335,3 +437,24 @@ def GetGHDLAsSimulator(self, std: VHDLVersion = None, ieee: str = None): self._SetParameters(tool, std, ieee) return tool + + def Help(self): + tool = GHDL(executablePath=self._executablePath) + + tool[tool.CommandHelp] = True + + tool.StartProcess() + return "\n".join(tool.GetLineReader()) + + def Version(self): + tool = GHDL(executablePath=self._executablePath) + + tool[tool.CommandVersion] = True + + tool.StartProcess() + iterator = iter(tool.GetLineReader()) + firstLine = next(iterator) + secondLine = next(iterator) + thirdLine = next(iterator) + + return GHDLVersion(firstLine, secondLine, thirdLine) diff --git a/pyEDAA/CLITool/__init__.py b/pyEDAA/CLITool/__init__.py index fb9daf9f..b8517b81 100644 --- a/pyEDAA/CLITool/__init__.py +++ b/pyEDAA/CLITool/__init__.py @@ -36,3 +36,11 @@ __license__ = "Apache License, Version 2.0" __version__ = "0.3.0" __keywords__ = ["cli", "abstraction layer", "eda"] + +from pyTooling.Decorators import export +from pyTooling.Exceptions import ExceptionBase + + +@export +class CLIToolException(ExceptionBase): + pass diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index 802c93a8..1e81e6f5 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -39,11 +39,11 @@ class CommonOptions(TestCase, Helper): - _binaryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/local")) / "bin" + _binaryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")) / "../../bin" @classmethod def setUpClass(cls) -> None: - print(f"\nPlatform: {sys_platform}") + # print(f"\nPlatform: {sys_platform}") if sys_platform in ("linux", "darwin"): ghdlBinaryPath: Path = cls._binaryDirectoryPath / "ghdl" print(f"Creating dummy file '{ghdlBinaryPath}': ", end="") @@ -51,33 +51,46 @@ def setUpClass(cls) -> None: print(f"DONE" if ghdlBinaryPath.exists() else f"FAILED") def test_Help(self): + print() + tool = GHDL(binaryDirectoryPath=self._binaryDirectoryPath) tool[tool.CommandHelp] = True executable = self.getExecutablePath("ghdl", self._binaryDirectoryPath) self.assertEqual(f"[\"{executable}\", \"help\"]", repr(tool)) + helpText = tool.Help() + print(helpText) + def test_Version(self): + print() + tool = GHDL(binaryDirectoryPath=self._binaryDirectoryPath) tool[tool.CommandVersion] = True executable = self.getExecutablePath("ghdl", self._binaryDirectoryPath) self.assertEqual(f"[\"{executable}\", \"version\"]", repr(tool)) + version = tool.Version() + print(str(version)) + print(repr(version)) + class Analyze(TestCase, Helper): - _binaryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/local")) / "bin" + _binaryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")) / "../../bin" @classmethod def setUpClass(cls) -> None: - print(f"\nPlatform: {sys_platform}") + # print(f"\nPlatform: {sys_platform}") if sys_platform in ("linux", "darwin"): ghdlBinaryPath: Path = cls._binaryDirectoryPath / "ghdl" print(f"Creating dummy file '{ghdlBinaryPath}': ", end="") ghdlBinaryPath.touch() print(f"DONE" if ghdlBinaryPath.exists() else f"FAILED") - def test_AnalyzeFile(self): + def test_Analyze(self): + print() + tool = GHDL(binaryDirectoryPath=self._binaryDirectoryPath) tool[tool.CommandAnalyze] = True tool[tool.FlagVHDLStandard] = "08" @@ -90,7 +103,37 @@ def test_AnalyzeFile(self): executable = self.getExecutablePath("ghdl", self._binaryDirectoryPath) self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\"]", repr(tool)) + tool.StartProcess() + for line in tool.GetLineReader(): + print(line) + tool.Terminate() + print(tool.ExitCode) + + def test_AnalyzeFile(self): + print() + + tool = GHDL(binaryDirectoryPath=self._binaryDirectoryPath) + tool[tool.CommandAnalyze] = True + tool[tool.FlagVHDLStandard] = "08" + tool[tool.FlagSynopsys] = True + tool[tool.FlagRelaxed] = True + tool[tool.FlagExplicit] = True + tool[tool.FlagMultiByteComments] = True + tool[tool.FlagLibrary] = "lib_Test" + tool[tool.OptionPaths] = (Path("example/file_A1.vhdl"), ) + + executable = self.getExecutablePath("ghdl", self._binaryDirectoryPath) + self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\", \"example\\file_A1.vhdl\"]", repr(tool)) + + tool.StartProcess() + for line in tool.GetLineReader(): + print(line) + tool.Terminate() + print(tool.ExitCode) + def test_DeriveAnalyzer(self): + print() + tool = GHDL(binaryDirectoryPath=self._binaryDirectoryPath) tool[tool.FlagVHDLStandard] = "08" tool[tool.FlagSynopsys] = True @@ -103,3 +146,8 @@ def test_DeriveAnalyzer(self): executable = self.getExecutablePath("ghdl", self._binaryDirectoryPath) self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\"]", repr(derived)) + + derived.StartProcess() + for line in derived.GetLineReader(): + print(line) + print(derived.ExitCode) From 6d594160e903a69cfd4ae59b3934484baf116fdf Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 8 Jul 2023 22:11:28 +0200 Subject: [PATCH 05/48] Improved test cases. --- tests/project/designA/file_A1.vhdl | 17 ++++++ tests/project/designA/file_A2.vhdl | 20 +++++++ tests/project/designB/file_B1.vhdl | 14 +++++ tests/project/lib/file_P1.vhdl | 8 +++ tests/project/lib/file_P2.vhdl | 10 ++++ tests/unit/GHDL.py | 95 +++++++++++++++++++++++------- 6 files changed, 143 insertions(+), 21 deletions(-) create mode 100644 tests/project/designA/file_A1.vhdl create mode 100644 tests/project/designA/file_A2.vhdl create mode 100644 tests/project/designB/file_B1.vhdl create mode 100644 tests/project/lib/file_P1.vhdl create mode 100644 tests/project/lib/file_P2.vhdl diff --git a/tests/project/designA/file_A1.vhdl b/tests/project/designA/file_A1.vhdl new file mode 100644 index 00000000..0d7a991d --- /dev/null +++ b/tests/project/designA/file_A1.vhdl @@ -0,0 +1,17 @@ +library IEEE; +use IEEE.std_logic_1164.all; + +library libCommon; +use libCommon.P1.all; + +entity A1 is + port ( + signal Clock : in std_logic + ); +end entity; + +architecture rtl of A1 is + +begin + +end architecture; diff --git a/tests/project/designA/file_A2.vhdl b/tests/project/designA/file_A2.vhdl new file mode 100644 index 00000000..e48cb1c0 --- /dev/null +++ b/tests/project/designA/file_A2.vhdl @@ -0,0 +1,20 @@ +library IEEE; +use IEEE.std_logic_1164.all; + +library libCommon; +use libCommon.P2.all; + +entity A2 is + port ( + signal Clock : in std_logic + ); +end entity; + +architecture rtl of A2 is + +begin + a : entity work.A1 + port map ( + Clock => Clock + ); +end architecture; diff --git a/tests/project/designB/file_B1.vhdl b/tests/project/designB/file_B1.vhdl new file mode 100644 index 00000000..31ae73f7 --- /dev/null +++ b/tests/project/designB/file_B1.vhdl @@ -0,0 +1,14 @@ + +library libraryCommon; +use libraryCommon.P2.all; + +entity B1 is + +end entity; + +architecture rtl of B1 is + +begin + +end architecture; + diff --git a/tests/project/lib/file_P1.vhdl b/tests/project/lib/file_P1.vhdl new file mode 100644 index 00000000..27a2d8d5 --- /dev/null +++ b/tests/project/lib/file_P1.vhdl @@ -0,0 +1,8 @@ + +package P1 is + +end package; + +package body P1 is + +end package body; diff --git a/tests/project/lib/file_P2.vhdl b/tests/project/lib/file_P2.vhdl new file mode 100644 index 00000000..b9a22059 --- /dev/null +++ b/tests/project/lib/file_P2.vhdl @@ -0,0 +1,10 @@ + +use work.P1.all; + +package P2 is + +end package; + +package body P2 is + +end package body; diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index 1e81e6f5..b87393c6 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -109,45 +109,98 @@ def test_Analyze(self): tool.Terminate() print(tool.ExitCode) - def test_AnalyzeFile(self): - print() - + def _GetAnalyzer(self) -> GHDL: tool = GHDL(binaryDirectoryPath=self._binaryDirectoryPath) - tool[tool.CommandAnalyze] = True tool[tool.FlagVHDLStandard] = "08" tool[tool.FlagSynopsys] = True tool[tool.FlagRelaxed] = True tool[tool.FlagExplicit] = True tool[tool.FlagMultiByteComments] = True + + return tool + + def test_AnalyzeFaultyFile(self): + print() + + tool = self._GetAnalyzer() + tool[tool.CommandAnalyze] = True tool[tool.FlagLibrary] = "lib_Test" - tool[tool.OptionPaths] = (Path("example/file_A1.vhdl"), ) + tool[tool.OptionPaths] = (Path("project/designB/file_B1.vhdl"), ) executable = self.getExecutablePath("ghdl", self._binaryDirectoryPath) - self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\", \"example\\file_A1.vhdl\"]", repr(tool)) + self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\", \"project\\designB\\file_B1.vhdl\"]", repr(tool)) tool.StartProcess() for line in tool.GetLineReader(): print(line) tool.Terminate() - print(tool.ExitCode) - def test_DeriveAnalyzer(self): + self.assertEqual(1, tool.ExitCode) + + def test_AnalyzeSingleFiles(self): print() - tool = GHDL(binaryDirectoryPath=self._binaryDirectoryPath) - tool[tool.FlagVHDLStandard] = "08" - tool[tool.FlagSynopsys] = True - tool[tool.FlagRelaxed] = True - tool[tool.FlagExplicit] = True - tool[tool.FlagMultiByteComments] = True + libraryFiles = ( + Path("project/lib/file_P1.vhdl"), + Path("project/lib/file_P2.vhdl"), + ) + designFiles = ( + Path("project/designA/file_A1.vhdl"), + Path("project/designA/file_A2.vhdl"), + ) + + analyzer = self._GetAnalyzer() + for file in libraryFiles: + tool = analyzer.GetGHDLAsAnalyzer() + tool[tool.FlagLibrary] = "libCommon" + tool[tool.OptionPaths] = (file, ) + tool.StartProcess() + for line in tool.GetLineReader(): + print(line) + tool.Terminate() + + self.assertEqual(0, tool.ExitCode) + + for file in designFiles: + tool = analyzer.GetGHDLAsAnalyzer() + tool[tool.FlagLibrary] = "libDesign" + tool[tool.OptionPaths] = (file, ) + tool.StartProcess() + for line in tool.GetLineReader(): + print(line) + tool.Terminate() + + self.assertEqual(0, tool.ExitCode) + + def test_AnalyzeMultipleFiles(self): + print() - derived = tool.GetGHDLAsAnalyzer() - derived[derived.FlagLibrary] = "lib_Test" + libraryFiles = ( + Path("project/lib/file_P1.vhdl"), + Path("project/lib/file_P2.vhdl"), + ) + designFiles = ( + Path("project/designA/file_A1.vhdl"), + Path("project/designA/file_A2.vhdl"), + ) + + analyzer = self._GetAnalyzer() + tool = analyzer.GetGHDLAsAnalyzer() + tool[tool.FlagLibrary] = "libCommon" + tool[tool.OptionPaths] = libraryFiles + tool.StartProcess() + for line in tool.GetLineReader(): + print(line) + tool.Terminate() - executable = self.getExecutablePath("ghdl", self._binaryDirectoryPath) - self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\"]", repr(derived)) + self.assertEqual(0, tool.ExitCode) - derived.StartProcess() - for line in derived.GetLineReader(): + tool = analyzer.GetGHDLAsAnalyzer() + tool[tool.FlagLibrary] = "libDesign" + tool[tool.OptionPaths] = designFiles + tool.StartProcess() + for line in tool.GetLineReader(): print(line) - print(derived.ExitCode) + tool.Terminate() + + self.assertEqual(0, tool.ExitCode) From 4bcb1a2c2116be677682becafc01f1c7bd3c3379 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 8 Jul 2023 22:55:55 +0200 Subject: [PATCH 06/48] Applied ExtendedType metaclass. --- pyEDAA/CLITool/GHDL.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pyEDAA/CLITool/GHDL.py b/pyEDAA/CLITool/GHDL.py index bce7a656..744b71ab 100644 --- a/pyEDAA/CLITool/GHDL.py +++ b/pyEDAA/CLITool/GHDL.py @@ -30,11 +30,12 @@ # ==================================================================================================================== # # """This module contains the CLI abstraction layer for `GHDL `__.""" -from re import search as re_search -from typing import Union, Iterable, Tuple +from re import search as re_search +from typing import Union, Iterable, Tuple, ClassVar, Dict -from pyTooling.Decorators import export -from pyVHDLModel import VHDLVersion +from pyTooling.Decorators import export +from pyTooling.MetaClasses import ExtendedType +from pyVHDLModel import VHDLVersion from pyTooling.CLIAbstraction import CLIArgument, Executable from pyTooling.CLIAbstraction.Argument import PathListArgument, StringArgument @@ -48,7 +49,7 @@ @export -class GHDLVersion: +class GHDLVersion(metaclass=ExtendedType, slots=True): _major: int _minor: int _micro: int @@ -148,7 +149,7 @@ def __repr__(self) -> str: @export class GHDL(Executable): - _executableNames = { + _executableNames: ClassVar[Dict[str, str]] = { "Darwin": "ghdl", "Linux": "ghdl", "Windows": "ghdl.exe" From 36c35116f1248ab8790fbcfcc490ae133a638277 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 15 Jul 2023 22:51:42 +0200 Subject: [PATCH 07/48] Bumped dependencies. --- dist/requirements.txt | 4 ++-- doc/Dependency.rst | 6 +++--- pyproject.toml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/requirements.txt b/dist/requirements.txt index e4718c94..a414030a 100644 --- a/dist/requirements.txt +++ b/dist/requirements.txt @@ -1,2 +1,2 @@ -wheel>=0.38.1 -twine +wheel >= 0.40.0 +twine >= 4.0.2 diff --git a/doc/Dependency.rst b/doc/Dependency.rst index 1408d1fe..9afbc887 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -141,7 +141,7 @@ install the mandatory dependencies too. +============================================================================+==============+==========================================================================================================+======================================================================================================================================================+ | `pyTooling `__ | ≥5.0.0 | `Apache License, 2.0 `__ | *None* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `wheel `__ | ≥0.38.1 | `MIT `__ | *Not yet evaluated.* | +| `wheel `__ | ≥0.40.0 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -170,7 +170,7 @@ install the mandatory dependencies too. +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ | **Package** | **Version** | **License** | **Dependencies** | +==========================================================+==============+===========================================================================================+======================+ -| `wheel `__ | ≥0.38.1 | `MIT `__ | *Not yet evaluated.* | +| `wheel `__ | ≥0.40.0 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ -| `Twine `__ | any | `Apache License, 2.0 `__ | *Not yet evaluated.* | +| `Twine `__ | ≥4.0.2 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ diff --git a/pyproject.toml b/pyproject.toml index 64c33a0b..1281d4b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [build-system] requires = [ "pyTooling >= 5.0.0", - "setuptools >= 59.6.0", - "wheel >= 0.38.1" + "setuptools >= 68.0.0", + "wheel >= 0.40.0" ] build-backend = "setuptools.build_meta" From c6ab39f471175e2f12203616b2094840a90604f2 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 29 Jul 2023 23:24:04 +0200 Subject: [PATCH 08/48] Updated pyproject file. --- pyproject.toml | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1281d4b5..41559d37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,36 +1,55 @@ [build-system] requires = [ - "pyTooling >= 5.0.0", - "setuptools >= 68.0.0", - "wheel >= 0.40.0" + "setuptools >= 68.0.0", + "wheel >= 0.40.0", + "pyTooling >= 5.0.0" ] build-backend = "setuptools.build_meta" [tool.black] line-length = 120 +[tool.mypy] +python_version = "3.11" +namespace_packages = true + +pretty = true +show_error_context = true + +html_report = "report/typing" + [tool.pytest.ini_options] # Don't set 'python_classes = *' otherwise, pytest doesn't search for classes # derived from unittest.Testcase python_files = "*" python_functions = "test_*" +filterwarnings = [ + "error::DeprecationWarning", + "error::PendingDeprecationWarning" +] [tool.coverage.run] branch = true omit = [ "*site-packages*", - "setup.py" + "setup.py", + "tests/*" ] [tool.coverage.report] -skip_covered = true +skip_covered = false skip_empty = true exclude_lines = [ + "pragma: no cover", "raise NotImplementedError" ] +omit = [ + "tests/*" +] [tool.coverage.html] directory = "report/coverage/html" +title="Code Coverage of pyEDAA.CLITool" [tool.coverage.xml] output = "report/coverage/coverage.xml" From 0a87b20f9d6ff5f5f311c3d7ece6d5a1185baea8 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 13 Aug 2023 23:27:12 +0200 Subject: [PATCH 09/48] Fixed InterSphinx configuration. --- doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 2f602b54..5b8af954 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -207,7 +207,7 @@ extlinks = { "ghissue": ("https://GitHub.com/edaa-org/pyEDAA.CLITool/issues/%s", "issue #"), "ghpull": ("https://GitHub.com/edaa-org/pyEDAA.CLITool/pull/%s", "pull request #"), - "ghsrc": ("https://GitHub.com/edaa-org/pyEDAA.CLITool/blob/main/%s", ""), + "ghsrc": ("https://GitHub.com/edaa-org/pyEDAA.CLITool/blob/main/%s", None), } From 806b16f1ea730471deba47d81d57f2d5615657a2 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 13 Aug 2023 23:27:30 +0200 Subject: [PATCH 10/48] Bumped dependencies. --- doc/Dependency.rst | 28 +++++++++++++++------------- tests/requirements.txt | 9 +++++---- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/doc/Dependency.rst b/doc/Dependency.rst index 9afbc887..8aefbeaa 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -64,19 +64,21 @@ the mandatory dependencies too. .. rubric:: Dependency List -+-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| **Package** | **Version** | **License** | **Dependencies** | -+===========================================================+=============+========================================================================================+======================+ -| `pytest `__ | ≥7.2.0 | `MIT `__ | *Not yet evaluated.* | -+-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `pytest-cov `__ | ≥4.0.0 | `MIT `__ | *Not yet evaluated.* | -+-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `Coverage `__ | ≥7.0 | `Apache License, 2.0 `__ | *Not yet evaluated.* | -+-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `mypy `__ | ≥1.2 | `MIT `__ | *Not yet evaluated.* | -+-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `lxml `__ | ≥4.9 | `BSD 3-Clause `__ | *Not yet evaluated.* | -+-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| **Package** | **Version** | **License** | **Dependencies** | ++=====================================================================+=============+========================================================================================+======================+ +| `pytest `__ | ≥7.4.0 | `MIT `__ | *Not yet evaluated.* | ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `pytest-cov `__ | ≥4.1.0 | `MIT `__ | *Not yet evaluated.* | ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `Coverage `__ | ≥7.3 | `Apache License, 2.0 `__ | *Not yet evaluated.* | ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `mypy `__ | ≥1.5 | `MIT `__ | *Not yet evaluated.* | ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `typing-extensions `__ | ≥4.7.1 | `PSF-2.0 `__ | *Not yet evaluated.* | ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `lxml `__ | ≥4.9 | `BSD 3-Clause `__ | *Not yet evaluated.* | ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ .. _dependency-documentation: diff --git a/tests/requirements.txt b/tests/requirements.txt index 6407e55c..6904298c 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,12 +1,13 @@ -r ../requirements.txt # Coverage collection -Coverage>=7.0 +Coverage >= 7.3 # Test Runner -pytest>=7.2.0 -pytest-cov>=4.0.0 +pytest >= 7.4.0 +pytest-cov >= 4.1.0 # Static Type Checking -mypy >= 1.2 +mypy >= 1.5 +typing_extensions >= 4.7.1 lxml>=4.9 From 54a23e802ba098966757e06c5c59a583c0f10d67 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 18 Jun 2024 20:58:19 +0200 Subject: [PATCH 11/48] General code update and bumped versions. --- dist/requirements.txt | 4 ++-- doc/Dependency.rst | 36 ++++++++++++---------------- doc/conf.py | 6 ++--- doc/requirements.txt | 6 ++--- pyEDAA/CLITool/Aldec/ActiveHDL.py | 2 +- pyEDAA/CLITool/Aldec/RivieraPRO.py | 2 +- pyEDAA/CLITool/Aldec/__init__.py | 2 +- pyEDAA/CLITool/Docker.py | 2 +- pyEDAA/CLITool/GHDL.py | 12 +++++----- pyEDAA/CLITool/GTKWave.py | 2 +- pyEDAA/CLITool/IntelFPGA/Quartus.py | 2 +- pyEDAA/CLITool/IntelFPGA/__init__.py | 2 +- pyEDAA/CLITool/Lattice/Diamond.py | 2 +- pyEDAA/CLITool/Lattice/__init__.py | 2 +- pyEDAA/CLITool/Mentor/ModelSim.py | 6 ++--- pyEDAA/CLITool/Mentor/__init__.py | 2 +- pyEDAA/CLITool/Xilinx/ISE.py | 2 +- pyEDAA/CLITool/Xilinx/Vivado.py | 2 +- pyEDAA/CLITool/Xilinx/__init__.py | 2 +- pyEDAA/CLITool/__init__.py | 4 ++-- pyproject.toml | 6 ++--- requirements.txt | 4 ++-- setup.py | 2 +- tests/requirements.txt | 12 +++++----- tests/unit/Docker.py | 6 ++--- tests/unit/GHDL.py | 14 +++++------ tests/unit/GHDLInDocker.py | 10 ++++---- tests/unit/__init__.py | 4 ++-- 28 files changed, 76 insertions(+), 82 deletions(-) diff --git a/dist/requirements.txt b/dist/requirements.txt index a414030a..5be2dd07 100644 --- a/dist/requirements.txt +++ b/dist/requirements.txt @@ -1,2 +1,2 @@ -wheel >= 0.40.0 -twine >= 4.0.2 +wheel ~= 0.43 +twine ~= 5.0 diff --git a/doc/Dependency.rst b/doc/Dependency.rst index 8aefbeaa..dae00939 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -27,15 +27,9 @@ pyEDAA.CLITool Package +---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=======================================================================================+=============+==========================================================================================================+=============================================================================================================================================================+ -| `pyTooling `__ | ≥5.0.0 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥6.3 | `Apache License, 2.0 `__ | *None* | +---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `pyTooling.CLIAbstraction `__ | ≥0.4.1 | `Apache License, 2.0 `__ | * `pyTooling `__ (`Apache License, 2.0 `__) | -| | | | * `pyAttributes `__ (`Apache License, 2.0 `__) | -| | | | | -| | | | * `pyTooling `__ (`Apache License, 2.0 `__) | -| | | | * `argcomplete `__ (`Apache License, 2.0 `__) | -+---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `pyVHDLModel `__ | ≥0.27.1 | `Apache License, 2.0 `__ | * `pyTooling `__ (`Apache License, 2.0 `__) | +| `pyVHDLModel `__ | ≥0.28 | `Apache License, 2.0 `__ | * `pyTooling `__ (`Apache License, 2.0 `__) | +---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. # @@ -67,17 +61,17 @@ the mandatory dependencies too. +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=====================================================================+=============+========================================================================================+======================+ -| `pytest `__ | ≥7.4.0 | `MIT `__ | *Not yet evaluated.* | +| `pytest `__ | ≥8.2 | `MIT `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `pytest-cov `__ | ≥4.1.0 | `MIT `__ | *Not yet evaluated.* | +| `pytest-cov `__ | ≥5.0 | `MIT `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `Coverage `__ | ≥7.3 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +| `Coverage `__ | ≥7.5 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `mypy `__ | ≥1.5 | `MIT `__ | *Not yet evaluated.* | +| `mypy `__ | ≥1.10 | `MIT `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `typing-extensions `__ | ≥4.7.1 | `PSF-2.0 `__ | *Not yet evaluated.* | +| `typing-extensions `__ | ≥4.11 | `PSF-2.0 `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `lxml `__ | ≥4.9 | `BSD 3-Clause `__ | *Not yet evaluated.* | +| `lxml `__ | ≥5.1 | `BSD 3-Clause `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ @@ -105,15 +99,15 @@ the mandatory dependencies too. +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=================================================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥5.0.0 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥6.3 | `Apache License, 2.0 `__ | *None* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `Sphinx `__ | ≥5.3.0 | `BSD 3-Clause `__ | *Not yet evaluated.* | +| `Sphinx `__ | ≥7.3 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `sphinx_btd_theme `__ | ≥0.5.2 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | !! `sphinx_fontawesome `__ | ≥0.0.6 | `GPL 2.0 `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `sphinx_autodoc_typehints `__ | ≥1.19.5 | `MIT `__ | *Not yet evaluated.* | +| `sphinx_autodoc_typehints `__ | ≥2.1 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -141,9 +135,9 @@ install the mandatory dependencies too. +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +============================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥5.0.0 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥6.3 | `Apache License, 2.0 `__ | *None* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `wheel `__ | ≥0.40.0 | `MIT `__ | *Not yet evaluated.* | +| `wheel `__ | ≥0.43 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -172,7 +166,7 @@ install the mandatory dependencies too. +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ | **Package** | **Version** | **License** | **Dependencies** | +==========================================================+==============+===========================================================================================+======================+ -| `wheel `__ | ≥0.40.0 | `MIT `__ | *Not yet evaluated.* | +| `wheel `__ | ≥0.43 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ -| `Twine `__ | ≥4.0.2 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +| `Twine `__ | ≥5.0 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ diff --git a/doc/conf.py b/doc/conf.py index 5b8af954..afa11812 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -62,7 +62,7 @@ # ============================================================================== prologPath = Path("prolog.inc") try: - with prologPath.open("r") as fileHandle: + with prologPath.open("r", encoding="utf-8") as fileHandle: rst_prolog = fileHandle.read() except Exception as ex: print(f"[ERROR:] While reading '{prologPath}'.") @@ -205,8 +205,8 @@ # Sphinx.Ext.ExtLinks # ============================================================================== extlinks = { - "ghissue": ("https://GitHub.com/edaa-org/pyEDAA.CLITool/issues/%s", "issue #"), - "ghpull": ("https://GitHub.com/edaa-org/pyEDAA.CLITool/pull/%s", "pull request #"), + "ghissue": ("https://GitHub.com/edaa-org/pyEDAA.CLITool/issues/%s", "issue #%s"), + "ghpull": ("https://GitHub.com/edaa-org/pyEDAA.CLITool/pull/%s", "pull request #%s"), "ghsrc": ("https://GitHub.com/edaa-org/pyEDAA.CLITool/blob/main/%s", None), } diff --git a/doc/requirements.txt b/doc/requirements.txt index 8c659351..aceaa08a 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,12 +1,12 @@ -r ../requirements.txt -pyTooling >= 5.0.0 +pyTooling ~= 6.3 # Enforce latest version on ReadTheDocs -sphinx>=5.3.0 +sphinx ~= 7.3 # Sphinx Extenstions sphinxcontrib-mermaid>=0.7.1 autoapi>=2.0.1 sphinx_fontawesome>=0.0.6 -sphinx_autodoc_typehints>=1.19.5 +sphinx_autodoc_typehints ~= 2.1 diff --git a/pyEDAA/CLITool/Aldec/ActiveHDL.py b/pyEDAA/CLITool/Aldec/ActiveHDL.py index 1c1d6e8a..cfed51fb 100644 --- a/pyEDAA/CLITool/Aldec/ActiveHDL.py +++ b/pyEDAA/CLITool/Aldec/ActiveHDL.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # diff --git a/pyEDAA/CLITool/Aldec/RivieraPRO.py b/pyEDAA/CLITool/Aldec/RivieraPRO.py index a4c270a4..932fbe3f 100644 --- a/pyEDAA/CLITool/Aldec/RivieraPRO.py +++ b/pyEDAA/CLITool/Aldec/RivieraPRO.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # diff --git a/pyEDAA/CLITool/Aldec/__init__.py b/pyEDAA/CLITool/Aldec/__init__.py index 506c48a5..057fdf40 100644 --- a/pyEDAA/CLITool/Aldec/__init__.py +++ b/pyEDAA/CLITool/Aldec/__init__.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # diff --git a/pyEDAA/CLITool/Docker.py b/pyEDAA/CLITool/Docker.py index 98d663d5..74ade303 100644 --- a/pyEDAA/CLITool/Docker.py +++ b/pyEDAA/CLITool/Docker.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2021-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2021-2024 Patrick Lehmann - Boetzingen, Germany # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # diff --git a/pyEDAA/CLITool/GHDL.py b/pyEDAA/CLITool/GHDL.py index 744b71ab..c8be69dd 100644 --- a/pyEDAA/CLITool/GHDL.py +++ b/pyEDAA/CLITool/GHDL.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # @@ -412,7 +412,7 @@ def _SetParameters(self, tool: "GHDL", std: VHDLVersion = None, ieee: str = None if ieee is not None: tool[self.FlagVHDLStandard] = ieee - def GetGHDLAsAnalyzer(self, std: VHDLVersion = None, ieee: str = None): + def GetGHDLAsAnalyzer(self, std: VHDLVersion = None, ieee: str = None) -> "GHDL": tool = GHDL(executablePath=self._executablePath) tool[tool.CommandAnalyze] = True @@ -421,7 +421,7 @@ def GetGHDLAsAnalyzer(self, std: VHDLVersion = None, ieee: str = None): return tool - def GetGHDLAsElaborator(self, std: VHDLVersion = None, ieee: str = None): + def GetGHDLAsElaborator(self, std: VHDLVersion = None, ieee: str = None) -> "GHDL": tool = GHDL(executablePath=self._executablePath) tool[tool.CommandElaborate] = True @@ -430,7 +430,7 @@ def GetGHDLAsElaborator(self, std: VHDLVersion = None, ieee: str = None): return tool - def GetGHDLAsSimulator(self, std: VHDLVersion = None, ieee: str = None): + def GetGHDLAsSimulator(self, std: VHDLVersion = None, ieee: str = None) -> "GHDL": tool = GHDL(executablePath=self._executablePath) tool[tool.CommandRun] = True @@ -439,7 +439,7 @@ def GetGHDLAsSimulator(self, std: VHDLVersion = None, ieee: str = None): return tool - def Help(self): + def Help(self) -> str: tool = GHDL(executablePath=self._executablePath) tool[tool.CommandHelp] = True @@ -447,7 +447,7 @@ def Help(self): tool.StartProcess() return "\n".join(tool.GetLineReader()) - def Version(self): + def Version(self) -> GHDLVersion: tool = GHDL(executablePath=self._executablePath) tool[tool.CommandVersion] = True diff --git a/pyEDAA/CLITool/GTKWave.py b/pyEDAA/CLITool/GTKWave.py index 1c26945c..e0dd5212 100644 --- a/pyEDAA/CLITool/GTKWave.py +++ b/pyEDAA/CLITool/GTKWave.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # diff --git a/pyEDAA/CLITool/IntelFPGA/Quartus.py b/pyEDAA/CLITool/IntelFPGA/Quartus.py index 66cd54d4..0a4b2436 100644 --- a/pyEDAA/CLITool/IntelFPGA/Quartus.py +++ b/pyEDAA/CLITool/IntelFPGA/Quartus.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # diff --git a/pyEDAA/CLITool/IntelFPGA/__init__.py b/pyEDAA/CLITool/IntelFPGA/__init__.py index 27420884..ae121076 100644 --- a/pyEDAA/CLITool/IntelFPGA/__init__.py +++ b/pyEDAA/CLITool/IntelFPGA/__init__.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # diff --git a/pyEDAA/CLITool/Lattice/Diamond.py b/pyEDAA/CLITool/Lattice/Diamond.py index b12ac842..2bba1048 100644 --- a/pyEDAA/CLITool/Lattice/Diamond.py +++ b/pyEDAA/CLITool/Lattice/Diamond.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # diff --git a/pyEDAA/CLITool/Lattice/__init__.py b/pyEDAA/CLITool/Lattice/__init__.py index 0f1f9b20..80377853 100644 --- a/pyEDAA/CLITool/Lattice/__init__.py +++ b/pyEDAA/CLITool/Lattice/__init__.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # diff --git a/pyEDAA/CLITool/Mentor/ModelSim.py b/pyEDAA/CLITool/Mentor/ModelSim.py index f22cd3ea..a108ad96 100644 --- a/pyEDAA/CLITool/Mentor/ModelSim.py +++ b/pyEDAA/CLITool/Mentor/ModelSim.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # @@ -75,7 +75,7 @@ class VHDLCompilerCoverageOptions(Flags): StateMachine = "f" Toggle = "t" - def __str__(self): + def __str__(self) -> str: return "".join([i.value for i in self]) @@ -86,7 +86,7 @@ class VHDLCompilerFSMVerbosityLevel(Enum): TransitionTable = "t" AnyWarning = "w" - def __str__(self): + def __str__(self) -> str: return self.value diff --git a/pyEDAA/CLITool/Mentor/__init__.py b/pyEDAA/CLITool/Mentor/__init__.py index 891ead26..7b58cf19 100644 --- a/pyEDAA/CLITool/Mentor/__init__.py +++ b/pyEDAA/CLITool/Mentor/__init__.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # diff --git a/pyEDAA/CLITool/Xilinx/ISE.py b/pyEDAA/CLITool/Xilinx/ISE.py index 55def0e9..cbf9d9ce 100644 --- a/pyEDAA/CLITool/Xilinx/ISE.py +++ b/pyEDAA/CLITool/Xilinx/ISE.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # diff --git a/pyEDAA/CLITool/Xilinx/Vivado.py b/pyEDAA/CLITool/Xilinx/Vivado.py index 809ec38c..ed63873c 100644 --- a/pyEDAA/CLITool/Xilinx/Vivado.py +++ b/pyEDAA/CLITool/Xilinx/Vivado.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # diff --git a/pyEDAA/CLITool/Xilinx/__init__.py b/pyEDAA/CLITool/Xilinx/__init__.py index 2f1628ab..946b4ed8 100644 --- a/pyEDAA/CLITool/Xilinx/__init__.py +++ b/pyEDAA/CLITool/Xilinx/__init__.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # diff --git a/pyEDAA/CLITool/__init__.py b/pyEDAA/CLITool/__init__.py index b8517b81..882f8bc1 100644 --- a/pyEDAA/CLITool/__init__.py +++ b/pyEDAA/CLITool/__init__.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universitaet Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # @@ -32,7 +32,7 @@ """An abstraction layer of EDA CLI tools.""" __author__ = "Patrick Lehmann" __email__ = "Paebbels@gmail.com" -__copyright__ = "2014-2023, Patrick Lehmann, Unai Martinez-Corral" +__copyright__ = "2014-2024, Patrick Lehmann, Unai Martinez-Corral" __license__ = "Apache License, Version 2.0" __version__ = "0.3.0" __keywords__ = ["cli", "abstraction layer", "eda"] diff --git a/pyproject.toml b/pyproject.toml index 41559d37..d04e12e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [build-system] requires = [ - "setuptools >= 68.0.0", - "wheel >= 0.40.0", - "pyTooling >= 5.0.0" + "setuptools ~= 70.0", + "wheel ~= 0.43", + "pyTooling ~= 6.3" ] build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt index f316e197..4dfd3b78 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -pyTooling.CLIAbstraction >= 0.4.1 -pyVHDLModel >= 0.27.1 +pyTooling ~= 6.3 +pyVHDLModel ~= 0.28.0 diff --git a/setup.py b/setup.py index 9af5e3bb..e52d55d7 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # Copyright 2014-2016 Technische Universität Dresden - Germany, Chair of VLSI-Design, Diagnostics and Architecture # # # # Licensed under the Apache License, Version 2.0 (the "License"); # diff --git a/tests/requirements.txt b/tests/requirements.txt index 6904298c..d7bdbde9 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,13 +1,13 @@ -r ../requirements.txt # Coverage collection -Coverage >= 7.3 +Coverage ~= 7.5 # Test Runner -pytest >= 7.4.0 -pytest-cov >= 4.1.0 +pytest ~= 8.2 +pytest-cov ~= 5.0 # Static Type Checking -mypy >= 1.5 -typing_extensions >= 4.7.1 -lxml>=4.9 +mypy ~= 1.10 +typing_extensions ~= 4.11 +lxml ~= 5.1 diff --git a/tests/unit/Docker.py b/tests/unit/Docker.py index 7bc3a1f8..9864984a 100644 --- a/tests/unit/Docker.py +++ b/tests/unit/Docker.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # @@ -39,7 +39,7 @@ @mark.skipif(sys_platform == "win32", reason="Don't run these tests on Windows.") class CommonOptions(TestCase, Helper): - def test_Version(self): + def test_Version(self) -> None: tool = Docker(dryRun=True) tool[tool.CommandVersion] = True @@ -49,7 +49,7 @@ def test_Version(self): @mark.skipif(sys_platform == "win32", reason="Don't run these tests on Windows.") class Analyze(TestCase, Helper): - def test_Alpine(self): + def test_Alpine(self) -> None: tool = Docker(dryRun=True) tool[tool.CommandContainer] = True tool[tool.CommandRun] = True diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index b87393c6..85f3fc4b 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # @@ -50,7 +50,7 @@ def setUpClass(cls) -> None: ghdlBinaryPath.touch() print(f"DONE" if ghdlBinaryPath.exists() else f"FAILED") - def test_Help(self): + def test_Help(self) -> None: print() tool = GHDL(binaryDirectoryPath=self._binaryDirectoryPath) @@ -62,7 +62,7 @@ def test_Help(self): helpText = tool.Help() print(helpText) - def test_Version(self): + def test_Version(self) -> None: print() tool = GHDL(binaryDirectoryPath=self._binaryDirectoryPath) @@ -88,7 +88,7 @@ def setUpClass(cls) -> None: ghdlBinaryPath.touch() print(f"DONE" if ghdlBinaryPath.exists() else f"FAILED") - def test_Analyze(self): + def test_Analyze(self) -> None: print() tool = GHDL(binaryDirectoryPath=self._binaryDirectoryPath) @@ -119,7 +119,7 @@ def _GetAnalyzer(self) -> GHDL: return tool - def test_AnalyzeFaultyFile(self): + def test_AnalyzeFaultyFile(self) -> None: print() tool = self._GetAnalyzer() @@ -137,7 +137,7 @@ def test_AnalyzeFaultyFile(self): self.assertEqual(1, tool.ExitCode) - def test_AnalyzeSingleFiles(self): + def test_AnalyzeSingleFiles(self) -> None: print() libraryFiles = ( @@ -172,7 +172,7 @@ def test_AnalyzeSingleFiles(self): self.assertEqual(0, tool.ExitCode) - def test_AnalyzeMultipleFiles(self): + def test_AnalyzeMultipleFiles(self) -> None: print() libraryFiles = ( diff --git a/tests/unit/GHDLInDocker.py b/tests/unit/GHDLInDocker.py index f63e1bed..982afa34 100644 --- a/tests/unit/GHDLInDocker.py +++ b/tests/unit/GHDLInDocker.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # @@ -40,7 +40,7 @@ class GHDLInDocker(Docker, GHDL): - def __init__(self, executablePath: Path = None, binaryDirectoryPath: Path = None, dryRun: bool = False): + def __init__(self, executablePath: Path = None, binaryDirectoryPath: Path = None, dryRun: bool = False) -> None: super().__init__(executablePath, binaryDirectoryPath, dryRun) self.__cliParameters__[Docker.ValueCommand] = Docker.ValueCommand("ghdl") @@ -48,7 +48,7 @@ def __init__(self, executablePath: Path = None, binaryDirectoryPath: Path = None class CommonOptions(TestCase, Helper): @mark.xfail - def test_Help(self): + def test_Help(self) -> None: tool = GHDLInDocker(dryRun=True) tool[GHDL.CommandHelp] = True tool[Docker.CommandContainer] = True @@ -60,7 +60,7 @@ def test_Help(self): self.assertEqual(f"[\"{executable}\", \"container\", \"run\", \"--rm\", \"ghdl:latest\", \"ghdl\", \"help\"]", repr(tool)) @mark.xfail - def test_Version(self): + def test_Version(self) -> None: tool = GHDLInDocker(dryRun=True) tool[Docker.CommandContainer] = True tool[Docker.CommandRun] = True @@ -74,7 +74,7 @@ def test_Version(self): class Analyze(TestCase, Helper): @mark.xfail - def test_AnalyzeFile(self): + def test_AnalyzeFile(self) -> None: tool = GHDLInDocker(dryRun=True) tool[tool.CommandAnalyze] = True tool[tool.FlagVHDLStandard] = "08" diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index eb2158fc..d4beeee0 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2017-2023 Patrick Lehmann - Bötzingen, Germany # +# Copyright 2017-2024 Patrick Lehmann - Bötzingen, Germany # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # @@ -31,7 +31,7 @@ """ Helper classes for unit tests. -:copyright: Copyright 2007-2023 Patrick Lehmann - Bötzingen, Germany +:copyright: Copyright 2007-2024 Patrick Lehmann - Bötzingen, Germany :license: Apache License, Version 2.0 """ from pathlib import Path From 7add85de9ea7efa83e0a81a8f7a2cb9472ffd3fb Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 18 Jun 2024 21:28:12 +0200 Subject: [PATCH 12/48] Modification for pyTooling v6.0+. --- pyEDAA/CLITool/GHDL.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyEDAA/CLITool/GHDL.py b/pyEDAA/CLITool/GHDL.py index c8be69dd..6eaa34b8 100644 --- a/pyEDAA/CLITool/GHDL.py +++ b/pyEDAA/CLITool/GHDL.py @@ -149,7 +149,7 @@ def __repr__(self) -> str: @export class GHDL(Executable): - _executableNames: ClassVar[Dict[str, str]] = { + _executableNames = { "Darwin": "ghdl", "Linux": "ghdl", "Windows": "ghdl.exe" From 678acebc8410f3ffcbdc40b132799c5a081802eb Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 18 Jun 2024 21:54:08 +0200 Subject: [PATCH 13/48] Updated pipeline. --- .github/workflows/Pipeline.yml | 203 +++++++++++++++++++++------------ pyproject.toml | 31 +++-- 2 files changed, 152 insertions(+), 82 deletions(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 2de5c543..b28fd773 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -4,124 +4,179 @@ on: push: workflow_dispatch: schedule: - - cron: '0 0 * * 5' +# Every Friday at 22:00 - rerun pipeline to check for dependency-based issues + - cron: '0 22 * * 5' jobs: - - Params: - uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev + UnitTestingParams: + uses: pyTooling/Actions/.github/workflows/Parameters.yml@r1 with: name: pyEDAA.CLITool -# disable_list: "mingw64:3.10 windows:3.7 windows:3.8 windows:3.9 windows:3.10 windows:3.11" + python_version_list: "3.9 3.10 3.11 3.12 pypy-3.9 pypy-3.10" UnitTesting: uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@dev needs: - - Params + - UnitTestingParams with: - jobs: ${{ needs.Params.outputs.python_jobs }} - artifact: ${{ fromJson(needs.Params.outputs.artifact_names).unittesting_xml }} + jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }} + unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} + coverage_sqlite_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }} - Coverage: - uses: pyTooling/Actions/.github/workflows/CoverageCollection.yml@dev + StaticTypeCheck: + uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r1 needs: - - Params + - UnitTestingParams with: - python_version: ${{ needs.Params.outputs.python_version }} - artifact: ${{ fromJson(needs.Params.outputs.artifact_names).codecoverage_html }} - secrets: - codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }} + python_version: ${{ needs.UnitTestingParams.outputs.python_version }} + commands: | + touch pyEDAA/__init__.py + mypy --html-report htmlmypy -p pyEDAA.CLITool + html_report: 'htmlmypy' + html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }} - StaticTypeCheck: - uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@dev + DocCoverage: + uses: pyTooling/Actions/.github/workflows/CheckDocumentation.yml@r1 needs: - - Params + - UnitTestingParams with: - python_version: ${{ needs.Params.outputs.python_version }} - requirements: '-r tests/requirements.txt' - commands: | - cd pyEDAA - mypy --html-report ../htmlmypy -p CLITool - html_artifact: ${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }} + python_version: ${{ needs.UnitTestingParams.outputs.python_version }} + directory: pyEDAA/CLITool +# fail_below: 70 - PublishTestResults: - uses: pyTooling/Actions/.github/workflows/PublishTestResults.yml@dev + Package: + uses: pyTooling/Actions/.github/workflows/Package.yml@r1 needs: + - UnitTestingParams - UnitTesting + with: + python_version: ${{ needs.UnitTestingParams.outputs.python_version }} + artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }} - Package: - uses: pyTooling/Actions/.github/workflows/Package.yml@dev + PublishCoverageResults: + uses: pyTooling/Actions/.github/workflows/PublishCoverageResults.yml@r1 needs: - - Params - - Coverage + - UnitTestingParams + - UnitTesting with: - python_version: ${{ needs.Params.outputs.python_version }} - artifact: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }} +# coverage_sqlite_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }} +# coverage_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_xml }} + coverage_json_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_json }} + coverage_html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_html }} + secrets: + codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }} - Release: - uses: pyTooling/Actions/.github/workflows/Release.yml@dev - if: startsWith(github.ref, 'refs/tags') + PublishTestResults: + uses: pyTooling/Actions/.github/workflows/PublishTestResults.yml@dev needs: + - UnitTestingParams - UnitTesting - - Coverage - - StaticTypeCheck - - Package + with: + merged_junit_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} - PublishOnPyPI: - uses: pyTooling/Actions/.github/workflows/PublishOnPyPI.yml@dev - if: startsWith(github.ref, 'refs/tags') + IntermediateCleanUp: + uses: pyTooling/Actions/.github/workflows/IntermediateCleanUp.yml@r1 needs: - - Params - - Release - - Package + - UnitTestingParams + - PublishCoverageResults + - PublishTestResults + - HTMLDocumentation with: - python_version: ${{ needs.Params.outputs.python_version }} - requirements: -r dist/requirements.txt - artifact: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }} - secrets: - PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + sqlite_coverage_artifacts_prefix: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }}- + xml_unittest_artifacts_prefix: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}- # VerifyDocs: -# uses: pyTooling/Actions/.github/workflows/VerifyDocs.yml@dev +# uses: pyTooling/Actions/.github/workflows/VerifyDocs.yml@r1 # needs: -# - Params +# - UnitTestingParams # with: -# python_version: ${{ needs.Params.outputs.python_version }} +# python_version: ${{ needs.UnitTestingParams.outputs.python_version }} + + HTMLDocumentation: + uses: pyTooling/Actions/.github/workflows/SphinxDocumentation.yml@r1 + needs: + - UnitTestingParams + - PublishTestResults + - PublishCoverageResults +# - VerifyDocs + with: + python_version: ${{ needs.UnitTestingParams.outputs.python_version }} + unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}-ubuntu-native-3.12 + coverage_json_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_json }} + html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_html }} + latex_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_latex }} - BuildTheDocs: - uses: pyTooling/Actions/.github/workflows/BuildTheDocs.yml@dev + PDFDocumentation: + uses: pyTooling/Actions/.github/workflows/LaTeXDocumentation.yml@r1 needs: - - Params - #- VerifyDocs + - UnitTestingParams + - HTMLDocumentation with: - artifact: ${{ fromJson(needs.Params.outputs.artifact_names).documentation_html }} + document: pyEDAA.CLITool + latex_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_latex }} + pdf_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_pdf }} PublishToGitHubPages: - uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@dev + uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@r1 needs: - - Params - - BuildTheDocs - - Coverage + - UnitTestingParams + - HTMLDocumentation +# - PDFDocumentation + - PublishCoverageResults - StaticTypeCheck with: - doc: ${{ fromJson(needs.Params.outputs.artifact_names).documentation_html }} - coverage: ${{ fromJson(needs.Params.outputs.artifact_names).codecoverage_html }} - typing: ${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }} + doc: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_html }} +# coverage: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_html }} + typing: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }} + + ReleasePage: + uses: pyTooling/Actions/.github/workflows/Release.yml@r1 + if: startsWith(github.ref, 'refs/tags') + needs: + - Package + - PublishToGitHubPages + + PublishOnPyPI: + uses: pyTooling/Actions/.github/workflows/PublishOnPyPI.yml@r1 + if: startsWith(github.ref, 'refs/tags') + needs: + - UnitTestingParams + - ReleasePage + with: + python_version: ${{ needs.UnitTestingParams.outputs.python_version }} + requirements: -r dist/requirements.txt + artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }} + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} ArtifactCleanUp: - uses: pyTooling/Actions/.github/workflows/ArtifactCleanUp.yml@dev + uses: pyTooling/Actions/.github/workflows/ArtifactCleanUp.yml@r1 needs: - - Params + - UnitTestingParams - UnitTesting - - Coverage - StaticTypeCheck - - BuildTheDocs - - PublishToGitHubPages + - HTMLDocumentation + - PDFDocumentation - PublishTestResults + - PublishCoverageResults + - PublishToGitHubPages +# - PublishOnPyPI with: - package: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }} + package: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }} remaining: | - ${{ fromJson(needs.Params.outputs.artifact_names).unittesting_xml }}-* - ${{ fromJson(needs.Params.outputs.artifact_names).codecoverage_html }} - ${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }} - ${{ fromJson(needs.Params.outputs.artifact_names).documentation_html }} + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}-* + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_html }}-* + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }}-* + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_xml }}-* + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_json }}-* + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_html }}-* + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_html }} + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }} + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_xml }} + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_json }} + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_html }} + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }} + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_html }} + ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_latex }} +# ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_pdf }} diff --git a/pyproject.toml b/pyproject.toml index d04e12e9..f3808af1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,12 +10,14 @@ build-backend = "setuptools.build_meta" line-length = 120 [tool.mypy] -python_version = "3.11" -namespace_packages = true - +files = ["pyEDAA.CLITool"] +python_version = "3.12" +#ignore_missing_imports = true +strict = true pretty = true show_error_context = true - +show_error_codes = true +namespace_packages = true html_report = "report/typing" [tool.pytest.ini_options] @@ -27,13 +29,23 @@ filterwarnings = [ "error::DeprecationWarning", "error::PendingDeprecationWarning" ] +junit_logging = "all" + +[tool.interrogate] +color = true +verbose = 1 # possible values: 0 (minimal output), 1 (-v), 2 (-vv) +fail-under = 80 +#generate-badge = "." +#badge-format = "png" +ignore-setters = true [tool.coverage.run] branch = true +relative_files = true omit = [ "*site-packages*", "setup.py", - "tests/*" + "tests/unit/*" ] [tool.coverage.report] @@ -47,9 +59,12 @@ omit = [ "tests/*" ] +[tool.coverage.xml] +output = "report/coverage/coverage.xml" + +[tool.coverage.json] +output = "report/coverage/coverage.json" + [tool.coverage.html] directory = "report/coverage/html" title="Code Coverage of pyEDAA.CLITool" - -[tool.coverage.xml] -output = "report/coverage/coverage.xml" From 4a298bf7de15443e085b15125c9a37c2065ce51a Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 18 Jun 2024 22:36:40 +0200 Subject: [PATCH 14/48] Added ToolMixin. --- .github/workflows/Pipeline.yml | 2 +- pyEDAA/CLITool/__init__.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index b28fd773..f5e99db3 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -36,7 +36,7 @@ jobs: html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }} DocCoverage: - uses: pyTooling/Actions/.github/workflows/CheckDocumentation.yml@r1 + uses: pyTooling/Actions/.github/workflows/CheckDocumentation.yml@dev needs: - UnitTestingParams with: diff --git a/pyEDAA/CLITool/__init__.py b/pyEDAA/CLITool/__init__.py index 882f8bc1..457f2583 100644 --- a/pyEDAA/CLITool/__init__.py +++ b/pyEDAA/CLITool/__init__.py @@ -44,3 +44,13 @@ @export class CLIToolException(ExceptionBase): pass + + +class ToolMixIn: + def __init__(self, platform, dryrun, binaryDirectoryPath, version, logger=None): + self._platform = platform + self._dryrun = dryrun + self._binaryDirectoryPath = binaryDirectoryPath + self._version = version + self._logger = logger + # self._environment = Environment() From 9f464e9834dec88099b63d6280f556bb08951523 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 18 Jun 2024 22:45:41 +0200 Subject: [PATCH 15/48] Added missing dependency. --- doc/Dependency.rst | 4 ++++ pyEDAA/CLITool/Xilinx/Vivado.py | 1 + pyEDAA/CLITool/__init__.py | 11 ++++++++++- pyproject.toml | 9 +++++++-- requirements.txt | 1 + 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/doc/Dependency.rst b/doc/Dependency.rst index dae00939..1991b623 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -32,6 +32,10 @@ pyEDAA.CLITool Package | `pyVHDLModel `__ | ≥0.28 | `Apache License, 2.0 `__ | * `pyTooling `__ (`Apache License, 2.0 `__) | +---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ +.. todo:: investigate dependencies and licenses of pyTooling with CLIAbstraction and pyAttributes/argcomplete. + +.. todo:: investigate dependencies of py-flags 1.1.4 => MIT. + .. # | `pyAttributes `__ | ≥2.5.1 | `Apache License, 2.0 `__ | * `pyTooling `__ (`Apache License, 2.0 `__) | | | | | * `argcomplete `__ (`Apache License, 2.0 `__) | diff --git a/pyEDAA/CLITool/Xilinx/Vivado.py b/pyEDAA/CLITool/Xilinx/Vivado.py index ed63873c..703f1494 100644 --- a/pyEDAA/CLITool/Xilinx/Vivado.py +++ b/pyEDAA/CLITool/Xilinx/Vivado.py @@ -36,6 +36,7 @@ from pyTooling.CLIAbstraction.Flag import ShortFlag from pyTooling.CLIAbstraction.ValuedFlag import ShortValuedFlag from pyTooling.CLIAbstraction.ValuedTupleFlag import ShortTupleFlag + from pyEDAA.CLITool import ToolMixIn diff --git a/pyEDAA/CLITool/__init__.py b/pyEDAA/CLITool/__init__.py index 457f2583..c5df7798 100644 --- a/pyEDAA/CLITool/__init__.py +++ b/pyEDAA/CLITool/__init__.py @@ -37,6 +37,9 @@ __version__ = "0.3.0" __keywords__ = ["cli", "abstraction layer", "eda"] +from pathlib import Path +from typing import Any, Optional as Nullable + from pyTooling.Decorators import export from pyTooling.Exceptions import ExceptionBase @@ -47,7 +50,13 @@ class CLIToolException(ExceptionBase): class ToolMixIn: - def __init__(self, platform, dryrun, binaryDirectoryPath, version, logger=None): + _platform: str + _dryrun: bool + _binaryDirectoryPath: Path + _version: str + _logger: Any + + def __init__(self, platform: str, dryrun: bool, binaryDirectoryPath: Path, version: str, logger: Nullable[Any] =None): self._platform = platform self._dryrun = dryrun self._binaryDirectoryPath = binaryDirectoryPath diff --git a/pyproject.toml b/pyproject.toml index f3808af1..86a5ad8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,8 +35,13 @@ junit_logging = "all" color = true verbose = 1 # possible values: 0 (minimal output), 1 (-v), 2 (-vv) fail-under = 80 -#generate-badge = "." -#badge-format = "png" +exclude = [ + "build", + "dist", + "doc", + "tests", + "setup.py" +] ignore-setters = true [tool.coverage.run] diff --git a/requirements.txt b/requirements.txt index 4dfd3b78..e0b49f06 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ pyTooling ~= 6.3 pyVHDLModel ~= 0.28.0 +py-flags ~= 1.1 From a7b6cc26a5f3b83ccbe3c5596f792167dcd57f55 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 18 Jun 2024 23:27:52 +0200 Subject: [PATCH 16/48] Fixed more mypy messages. --- pyEDAA/CLITool/GHDL.py | 16 ++++++++-------- pyEDAA/CLITool/Xilinx/Vivado.py | 2 +- tests/unit/GHDLInDocker.py | 3 ++- tests/unit/__init__.py | 6 +++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/pyEDAA/CLITool/GHDL.py b/pyEDAA/CLITool/GHDL.py index 6eaa34b8..508e7572 100644 --- a/pyEDAA/CLITool/GHDL.py +++ b/pyEDAA/CLITool/GHDL.py @@ -31,7 +31,7 @@ # """This module contains the CLI abstraction layer for `GHDL `__.""" from re import search as re_search -from typing import Union, Iterable, Tuple, ClassVar, Dict +from typing import Union, Iterable, Tuple, Optional as Nullable from pyTooling.Decorators import export from pyTooling.MetaClasses import ExtendedType @@ -97,7 +97,7 @@ def __init__(self, versionLine: str, gnatLine: str, backendLine: str): if match is None: raise CLIToolException(f"Unknown second GHDL version string '{gnatLine}'.") - self._gnatCompiler = (match["major"], match["minor"], match["micro"]) + self._gnatCompiler = (int(match["major"]), int(match["minor"]), int(match["micro"])) match = re_search( r"\s*(?P\w+)\scode\sgenerator", backendLine) @@ -322,11 +322,11 @@ class FlagWarnOthersSpecifications(ShortFlag, name="specs", pattern="-W{0}"): """Warns if an all/others specification does not apply.""" @CLIArgument() - class FlagSyntesisBindingRule(ShortFlag, name="unused", pattern="-W{0}"): + class FlagUnused(ShortFlag, name="unused", pattern="-W{0}"): """Warns for unused subprograms.""" @CLIArgument() - class FlagSyntesisBindingRule(ShortFlag, name="error", pattern="-W{0}"): + class FlagError(ShortFlag, name="error", pattern="-W{0}"): """Turns warnings into errors.""" @CLIArgument() @@ -405,14 +405,14 @@ def _CopyParameters(self, tool: "GHDL") -> None: else: tool.__cliParameters__[key] = key() - def _SetParameters(self, tool: "GHDL", std: VHDLVersion = None, ieee: str = None): + def _SetParameters(self, tool: "GHDL", std: Nullable[VHDLVersion] = None, ieee: Nullable[str] = None): if std is not None: tool[self.FlagVHDLStandard] = str(std) if ieee is not None: tool[self.FlagVHDLStandard] = ieee - def GetGHDLAsAnalyzer(self, std: VHDLVersion = None, ieee: str = None) -> "GHDL": + def GetGHDLAsAnalyzer(self, std: Nullable[VHDLVersion] = None, ieee: Nullable[str] = None) -> "GHDL": tool = GHDL(executablePath=self._executablePath) tool[tool.CommandAnalyze] = True @@ -421,7 +421,7 @@ def GetGHDLAsAnalyzer(self, std: VHDLVersion = None, ieee: str = None) -> "GHDL" return tool - def GetGHDLAsElaborator(self, std: VHDLVersion = None, ieee: str = None) -> "GHDL": + def GetGHDLAsElaborator(self, std: Nullable[VHDLVersion] = None, ieee: Nullable[str] = None) -> "GHDL": tool = GHDL(executablePath=self._executablePath) tool[tool.CommandElaborate] = True @@ -430,7 +430,7 @@ def GetGHDLAsElaborator(self, std: VHDLVersion = None, ieee: str = None) -> "GHD return tool - def GetGHDLAsSimulator(self, std: VHDLVersion = None, ieee: str = None) -> "GHDL": + def GetGHDLAsSimulator(self, std: Nullable[VHDLVersion] = None, ieee: Nullable[str] = None) -> "GHDL": tool = GHDL(executablePath=self._executablePath) tool[tool.CommandRun] = True diff --git a/pyEDAA/CLITool/Xilinx/Vivado.py b/pyEDAA/CLITool/Xilinx/Vivado.py index 703f1494..87f626bf 100644 --- a/pyEDAA/CLITool/Xilinx/Vivado.py +++ b/pyEDAA/CLITool/Xilinx/Vivado.py @@ -34,7 +34,7 @@ from pyTooling.CLIAbstraction import CLIArgument, Executable from pyTooling.CLIAbstraction.Argument import StringArgument, StringListArgument from pyTooling.CLIAbstraction.Flag import ShortFlag -from pyTooling.CLIAbstraction.ValuedFlag import ShortValuedFlag +from pyTooling.CLIAbstraction.ValuedFlag import ShortValuedFlag from pyTooling.CLIAbstraction.ValuedTupleFlag import ShortTupleFlag from pyEDAA.CLITool import ToolMixIn diff --git a/tests/unit/GHDLInDocker.py b/tests/unit/GHDLInDocker.py index 982afa34..0bb02585 100644 --- a/tests/unit/GHDLInDocker.py +++ b/tests/unit/GHDLInDocker.py @@ -30,6 +30,7 @@ # """Unit tests for executable ``ghdl`` inside a container run via Docker.""" from pathlib import Path +from typing import Optional as Nullable from pytest import mark from unittest import TestCase @@ -40,7 +41,7 @@ class GHDLInDocker(Docker, GHDL): - def __init__(self, executablePath: Path = None, binaryDirectoryPath: Path = None, dryRun: bool = False) -> None: + def __init__(self, executablePath: Nullable[Path] = None, binaryDirectoryPath: Nullable[Path] = None, dryRun: bool = False) -> None: super().__init__(executablePath, binaryDirectoryPath, dryRun) self.__cliParameters__[Docker.ValueCommand] = Docker.ValueCommand("ghdl") diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index d4beeee0..d740371c 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -34,16 +34,16 @@ :copyright: Copyright 2007-2024 Patrick Lehmann - Bötzingen, Germany :license: Apache License, Version 2.0 """ -from pathlib import Path +from pathlib import Path from platform import system -from sys import platform as sys_platform +from typing import Optional as Nullable class Helper: _system = system() @classmethod - def getExecutablePath(cls, programName: str, binaryDirectory: Path = None) -> str: + def getExecutablePath(cls, programName: str, binaryDirectory: Nullable[Path] = None) -> str: extensions = ".exe" if cls._system == "Windows" else "" programName = f"{programName}{extensions}" if binaryDirectory is not None: From ee4f4955743e87acb54d8f72f616ad060f10695d Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 18 Jun 2024 23:40:50 +0200 Subject: [PATCH 17/48] Try to create lib/ghdl and bin directories. --- .idea/pyEDAA.CLITool.iml | 6 +++--- tests/unit/GHDL.py | 33 ++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.idea/pyEDAA.CLITool.iml b/.idea/pyEDAA.CLITool.iml index 7f5c8d97..09489b93 100644 --- a/.idea/pyEDAA.CLITool.iml +++ b/.idea/pyEDAA.CLITool.iml @@ -6,11 +6,11 @@ - + + - + - \ No newline at end of file diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index 85f3fc4b..bd049df7 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -38,18 +38,32 @@ from . import Helper -class CommonOptions(TestCase, Helper): +class GHDLTestcases(TestCase, Helper): + _libraryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")) _binaryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")) / "../../bin" @classmethod def setUpClass(cls) -> None: # print(f"\nPlatform: {sys_platform}") if sys_platform in ("linux", "darwin"): - ghdlBinaryPath: Path = cls._binaryDirectoryPath / "ghdl" + if not cls._libraryDirectoryPath.exists(): + print(f"Creating lib/ghdl directory '{cls._libraryDirectoryPath}': ", end="") + cls._libraryDirectoryPath.mkdir(parents=True) + print(f"DONE" if cls._libraryDirectoryPath.exists() and cls._libraryDirectoryPath.is_dir() else f"FAILED") + + binaryDirectoryPath = cls._binaryDirectoryPath.resolve() + if not binaryDirectoryPath.exists(): + print(f"Creating bin directory '{binaryDirectoryPath}': ", end="") + binaryDirectoryPath.mkdir(parents=True) + print(f"DONE" if binaryDirectoryPath.exists() and binaryDirectoryPath.is_dir() else f"FAILED") + + ghdlBinaryPath: Path = binaryDirectoryPath / "ghdl" print(f"Creating dummy file '{ghdlBinaryPath}': ", end="") ghdlBinaryPath.touch() - print(f"DONE" if ghdlBinaryPath.exists() else f"FAILED") + print(f"DONE" if ghdlBinaryPath.exists() and ghdlBinaryPath.is_file() else f"FAILED") + +class CommonOptions(GHDLTestcases): def test_Help(self) -> None: print() @@ -76,18 +90,7 @@ def test_Version(self) -> None: print(repr(version)) -class Analyze(TestCase, Helper): - _binaryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")) / "../../bin" - - @classmethod - def setUpClass(cls) -> None: - # print(f"\nPlatform: {sys_platform}") - if sys_platform in ("linux", "darwin"): - ghdlBinaryPath: Path = cls._binaryDirectoryPath / "ghdl" - print(f"Creating dummy file '{ghdlBinaryPath}': ", end="") - ghdlBinaryPath.touch() - print(f"DONE" if ghdlBinaryPath.exists() else f"FAILED") - +class Analyze(GHDLTestcases): def test_Analyze(self) -> None: print() From 26b18c96792ee04eb884288b9a5d46e916cfd5af Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Wed, 19 Jun 2024 00:21:13 +0200 Subject: [PATCH 18/48] Run CheckDocumentation with 75% goal. --- .github/workflows/Pipeline.yml | 2 +- tests/unit/GHDL.py | 27 +++++++++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index f5e99db3..6a6906e9 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -42,7 +42,7 @@ jobs: with: python_version: ${{ needs.UnitTestingParams.outputs.python_version }} directory: pyEDAA/CLITool -# fail_below: 70 + fail_under: 75 Package: uses: pyTooling/Actions/.github/workflows/Package.yml@r1 diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index bd049df7..d434c17b 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -39,25 +39,24 @@ class GHDLTestcases(TestCase, Helper): - _libraryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")) - _binaryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")) / "../../bin" + _libraryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")).resolve() + _binaryDirectoryPath = (Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")) / "../../bin").resolve() @classmethod def setUpClass(cls) -> None: # print(f"\nPlatform: {sys_platform}") if sys_platform in ("linux", "darwin"): - if not cls._libraryDirectoryPath.exists(): - print(f"Creating lib/ghdl directory '{cls._libraryDirectoryPath}': ", end="") - cls._libraryDirectoryPath.mkdir(parents=True) - print(f"DONE" if cls._libraryDirectoryPath.exists() and cls._libraryDirectoryPath.is_dir() else f"FAILED") - - binaryDirectoryPath = cls._binaryDirectoryPath.resolve() - if not binaryDirectoryPath.exists(): - print(f"Creating bin directory '{binaryDirectoryPath}': ", end="") - binaryDirectoryPath.mkdir(parents=True) - print(f"DONE" if binaryDirectoryPath.exists() and binaryDirectoryPath.is_dir() else f"FAILED") - - ghdlBinaryPath: Path = binaryDirectoryPath / "ghdl" + # if not cls._libraryDirectoryPath.exists(): + # print(f"Creating lib/ghdl directory '{cls._libraryDirectoryPath}': ", end="") + # cls._libraryDirectoryPath.mkdir(parents=True) + # print(f"DONE" if cls._libraryDirectoryPath.exists() and cls._libraryDirectoryPath.is_dir() else f"FAILED") + # + # if not cls._binaryDirectoryPath.exists(): + # print(f"Creating bin directory '{cls._binaryDirectoryPath}': ", end="") + # cls._binaryDirectoryPath.mkdir(parents=True) + # print(f"DONE" if cls._binaryDirectoryPath.exists() and cls._binaryDirectoryPath.is_dir() else f"FAILED") + + ghdlBinaryPath: Path = cls._binaryDirectoryPath / "ghdl" print(f"Creating dummy file '{ghdlBinaryPath}': ", end="") ghdlBinaryPath.touch() print(f"DONE" if ghdlBinaryPath.exists() and ghdlBinaryPath.is_file() else f"FAILED") From 65d10c1c88c9b070067365de8aab0ba51a7a8cf3 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Wed, 19 Jun 2024 21:59:54 +0200 Subject: [PATCH 19/48] Added FreeBSD support for GHDL, GTKwave, Docker. --- pyEDAA/CLITool/Docker.py | 1 + pyEDAA/CLITool/GHDL.py | 1 + pyEDAA/CLITool/GTKWave.py | 1 + 3 files changed, 3 insertions(+) diff --git a/pyEDAA/CLITool/Docker.py b/pyEDAA/CLITool/Docker.py index 74ade303..bbd4e885 100644 --- a/pyEDAA/CLITool/Docker.py +++ b/pyEDAA/CLITool/Docker.py @@ -42,6 +42,7 @@ class Docker(Executable): _executableNames = { "Darwin": "docker", + "FreeBSD": "docker", "Linux": "docker", "Windows": "docker.exe" } diff --git a/pyEDAA/CLITool/GHDL.py b/pyEDAA/CLITool/GHDL.py index 508e7572..92522be6 100644 --- a/pyEDAA/CLITool/GHDL.py +++ b/pyEDAA/CLITool/GHDL.py @@ -151,6 +151,7 @@ def __repr__(self) -> str: class GHDL(Executable): _executableNames = { "Darwin": "ghdl", + "FreeBSD": "ghdl", "Linux": "ghdl", "Windows": "ghdl.exe" } diff --git a/pyEDAA/CLITool/GTKWave.py b/pyEDAA/CLITool/GTKWave.py index e0dd5212..831ce772 100644 --- a/pyEDAA/CLITool/GTKWave.py +++ b/pyEDAA/CLITool/GTKWave.py @@ -40,6 +40,7 @@ class GTKWave(Executable): _executableNames = { "Darwin": "gtkwave", + "FreeBSD": "gtkwave", "Linux": "gtkwave", "Windows": "gtkwave.exe" } From f2ff5989847c931404afbb777ab74d197145ee0c Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 21 Jul 2024 19:42:15 +0200 Subject: [PATCH 20/48] Bumped dependencies. --- doc/Dependency.rst | 14 +++++++------- doc/Doc-License.rst | 2 +- doc/requirements.txt | 7 ++++--- pyproject.toml | 4 ++-- requirements.txt | 2 +- tests/requirements.txt | 4 ++-- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/doc/Dependency.rst b/doc/Dependency.rst index 1991b623..53f9826c 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -27,7 +27,7 @@ pyEDAA.CLITool Package +---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=======================================================================================+=============+==========================================================================================================+=============================================================================================================================================================+ -| `pyTooling `__ | ≥6.3 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥6.5 | `Apache License, 2.0 `__ | *None* | +---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | `pyVHDLModel `__ | ≥0.28 | `Apache License, 2.0 `__ | * `pyTooling `__ (`Apache License, 2.0 `__) | +---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -69,13 +69,13 @@ the mandatory dependencies too. +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `pytest-cov `__ | ≥5.0 | `MIT `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `Coverage `__ | ≥7.5 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +| `Coverage `__ | ≥7.6 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `mypy `__ | ≥1.10 | `MIT `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `typing-extensions `__ | ≥4.11 | `PSF-2.0 `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `lxml `__ | ≥5.1 | `BSD 3-Clause `__ | *Not yet evaluated.* | +| `lxml `__ | ≥5.2 | `BSD 3-Clause `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ @@ -103,15 +103,15 @@ the mandatory dependencies too. +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=================================================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥6.3 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥6.5 | `Apache License, 2.0 `__ | *None* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `Sphinx `__ | ≥7.3 | `BSD 3-Clause `__ | *Not yet evaluated.* | +| `Sphinx `__ | ≥7.4 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `sphinx_btd_theme `__ | ≥0.5.2 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | !! `sphinx_fontawesome `__ | ≥0.0.6 | `GPL 2.0 `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `sphinx_autodoc_typehints `__ | ≥2.1 | `MIT `__ | *Not yet evaluated.* | +| `sphinx_autodoc_typehints `__ | ≥2.2 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -139,7 +139,7 @@ install the mandatory dependencies too. +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +============================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥6.3 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥6.5 | `Apache License, 2.0 `__ | *None* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `wheel `__ | ≥0.43 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/doc/Doc-License.rst b/doc/Doc-License.rst index 1258fbc2..5267d5d4 100644 --- a/doc/Doc-License.rst +++ b/doc/Doc-License.rst @@ -17,7 +17,7 @@ licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. -.. topic:: Using Creative Commons Public Licenses +.. rubric:: Using Creative Commons Public Licenses Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of diff --git a/doc/requirements.txt b/doc/requirements.txt index aceaa08a..2bd764fb 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,12 +1,13 @@ -r ../requirements.txt -pyTooling ~= 6.3 +pyTooling ~=6.5 # Enforce latest version on ReadTheDocs -sphinx ~= 7.3 +sphinx ~= 7.4 +docutils ~= 0.20 # Sphinx Extenstions sphinxcontrib-mermaid>=0.7.1 autoapi>=2.0.1 sphinx_fontawesome>=0.0.6 -sphinx_autodoc_typehints ~= 2.1 +sphinx_autodoc_typehints ~= 2.2 diff --git a/pyproject.toml b/pyproject.toml index 86a5ad8f..1632a0ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [build-system] requires = [ - "setuptools ~= 70.0", + "setuptools ~= 70.3", "wheel ~= 0.43", - "pyTooling ~= 6.3" + "pyTooling ~= 6.5" ] build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt index e0b49f06..34f42498 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -pyTooling ~= 6.3 +pyTooling ~=6.5 pyVHDLModel ~= 0.28.0 py-flags ~= 1.1 diff --git a/tests/requirements.txt b/tests/requirements.txt index d7bdbde9..352c0971 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,7 +1,7 @@ -r ../requirements.txt # Coverage collection -Coverage ~= 7.5 +Coverage ~= 7.6 # Test Runner pytest ~= 8.2 @@ -10,4 +10,4 @@ pytest-cov ~= 5.0 # Static Type Checking mypy ~= 1.10 typing_extensions ~= 4.11 -lxml ~= 5.1 +lxml ~= 5.2 From 76dc7878236468752f93c012763b4738f31a6d9f Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 21 Jul 2024 22:05:03 +0200 Subject: [PATCH 21/48] Updated documentation. --- .gitignore | 20 +- doc/Dependency.rst | 151 ++++++--- doc/Doc-License.rst | 2 +- doc/DocCoverage.rst | 7 + doc/Glossary.rst | 7 + doc/Installation.rst | 478 +++++++++++++++++++++++++++-- doc/Makefile | 25 +- doc/_static/css/override.css | 112 +++++++ doc/_templates/autoapi/module.rst | 114 +++++-- doc/_templates/autoapi/package.rst | 14 + doc/conf.py | 179 +++++++---- doc/coverage/index.rst | 9 +- doc/index.rst | 34 +- doc/make.bat | 36 +++ doc/py-modindex.rst | 4 - doc/pyEDAA.CLITool/index.rst | 8 - doc/requirements.txt | 13 +- pyEDAA/CLITool/__init__.py | 7 +- pyproject.toml | 4 +- requirements.txt | 2 +- run.ps1 | 317 +++++++++++++++++++ setup.py | 20 +- tests/requirements.txt | 2 +- 23 files changed, 1352 insertions(+), 213 deletions(-) create mode 100644 doc/DocCoverage.rst create mode 100644 doc/Glossary.rst create mode 100644 doc/_static/css/override.css create mode 100644 doc/_templates/autoapi/package.rst create mode 100644 doc/make.bat delete mode 100644 doc/py-modindex.rst delete mode 100644 doc/pyEDAA.CLITool/index.rst create mode 100644 run.ps1 diff --git a/.gitignore b/.gitignore index 0e0b0d05..a2ec455e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ __pycache__/ .cov coverage.xml +# Generated reports +report/ + # setuptools /build/**/*.* /dist/**/*.* @@ -15,11 +18,16 @@ coverage.xml # Dependencies !requirements.txt -# Sphinx documentation -/doc/_build/ -/doc/_theme/ -/doc/pyEDAA.CLITool/**/*.* -!/doc/pyEDAA.CLITool/index.rst +# Sphinx +doc/_build/ +doc/pyEDAA.CLITool/**/*.* +!doc/pyEDAA.CLITool/index.rst + +# BuildTheDocs +doc/_theme/**/*.* -# PyCharm project +# IntelliJ project files /.idea/workspace.xml + +# Git files +!.git* diff --git a/doc/Dependency.rst b/doc/Dependency.rst index 53f9826c..863242f0 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -1,28 +1,51 @@ -.. _dependency: +.. _DEP: -Dependency -########## +Dependencies +############ .. |img-CLITool-lib-status| image:: https://img.shields.io/librariesio/release/pypi/pyEDAA.CLITool :alt: Libraries.io status for latest release :height: 22 - :target: https://libraries.io/github/edaa-org/pyEDAA.CLITool -.. |img-CLITool-req-status| image:: https://img.shields.io/requires/github/pyEDAA/pyEDAA.CLITool - :alt: Requires.io + :target: https://libraries.io/github/pyEDAA-org/pyEDAA.CLITool +.. |img-CLITool-vul-status| image:: https://img.shields.io/snyk/vulnerabilities/github/pyEDAA-org/pyEDAA.CLITool + :alt: Snyk Vulnerabilities for GitHub Repo :height: 22 - :target: https://requires.io/github/edaa-org/pyEDAA.CLITool/requirements/?branch=main + :target: https://img.shields.io/snyk/vulnerabilities/github/pyEDAA-org/pyEDAA.CLITool +------------------------------------------+------------------------------------------+ -| `Libraries.io `_ | `Requires.io `_ | +| `Libraries.io `_ | Vulnerabilities Summary | +==========================================+==========================================+ -| |img-CLITool-lib-status| | |img-CLITool-req-status| | +| |img-CLITool-lib-status| | |img-CLITool-vul-status| | +------------------------------------------+------------------------------------------+ +.. _DEP/package: -.. _dependency-package: +pyEDAA.CLITool Package (Mandatory) +********************************** -pyEDAA.CLITool Package -********************** +.. rubric:: Manually Installing Package Requirements + +Use the :file:`requirements.txt` file to install all dependencies via ``pip3`` or install the package directly from +PyPI (see :ref:`INSTALL`). + +.. tab-set:: + + .. tab-item:: Linux/MacOS + :sync: Linux + + .. code-block:: bash + + pip3 install -U -r requirements.txt + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + pip install -U -r requirements.txt + + +.. rubric:: Dependency List +---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | @@ -36,15 +59,14 @@ pyEDAA.CLITool Package .. todo:: investigate dependencies of py-flags 1.1.4 => MIT. -.. # - | `pyAttributes `__ | ≥2.5.1 | `Apache License, 2.0 `__ | * `pyTooling `__ (`Apache License, 2.0 `__) | - | | | | * `argcomplete `__ (`Apache License, 2.0 `__) | - +---------------------------------------------------------------------------------------+-------------+-------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ -.. _dependency-testing: +.. _DEP/testing: + +Unit Testing (Optional) +*********************** Unit Testing / Coverage / Type Checking (Optional) -************************************************** +================================================== Additional Python packages needed for testing, code coverage collection and static type checking. These packages are only needed for developers or on a CI server, thus sub-dependencies are not evaluated further. @@ -55,31 +77,43 @@ only needed for developers or on a CI server, thus sub-dependencies are not eval Use the :file:`tests/requirements.txt` file to install all dependencies via ``pip3``. The file will recursively install the mandatory dependencies too. -.. code-block:: shell +.. tab-set:: - pip3 install -U -r tests/requirements.txt + .. tab-item:: Linux/MacOS + :sync: Linux + .. code-block:: bash -.. rubric:: Dependency List + pip install -U -r tests/requirements.txt + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + pip3 install -U -r tests\requirements.txt + +.. rubric:: Dependency List - Unit Testing +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=====================================================================+=============+========================================================================================+======================+ -| `pytest `__ | ≥8.2 | `MIT `__ | *Not yet evaluated.* | +| `pytest `__ | ≥8.3 | `MIT `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `pytest-cov `__ | ≥5.0 | `MIT `__ | *Not yet evaluated.* | +| `pytest-cov `__ | ≥5.0.0 | `MIT `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `Coverage `__ | ≥7.6 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `mypy `__ | ≥1.10 | `MIT `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `typing-extensions `__ | ≥4.11 | `PSF-2.0 `__ | *Not yet evaluated.* | +| `typing-extensions `__ | ≥4.12 | `PSF-2.0 `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `lxml `__ | ≥5.2 | `BSD 3-Clause `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -.. _dependency-documentation: + +.. _DEP/documentation: Sphinx Documentation (Optional) ******************************* @@ -93,9 +127,21 @@ CI server, thus sub-dependencies are not evaluated further. Use the :file:`doc/requirements.txt` file to install all dependencies via ``pip3``. The file will recursively install the mandatory dependencies too. -.. code-block:: shell +.. tab-set:: + + .. tab-item:: Linux/MacOS + :sync: Linux - pip3 install -U -r doc/requirements.txt + .. code-block:: bash + + pip install -U -r doc/requirements.txt + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + pip3 install -U -r doc\requirements.txt .. rubric:: Dependency List @@ -105,17 +151,24 @@ the mandatory dependencies too. +=================================================================================================+==============+==========================================================================================================+======================================================================================================================================================+ | `pyTooling `__ | ≥6.5 | `Apache License, 2.0 `__ | *None* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `Sphinx `__ | ≥7.4 | `BSD 3-Clause `__ | *Not yet evaluated.* | +| `Sphinx `__ | ≥7.4.0 | `BSD 3-Clause `__ | *Not yet evaluated.* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `sphinxcontrib-mermaid `__ | ≥0.9.2 | `BSD `__ | *Not yet evaluated.* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `autoapi `__ | ≥2.0.1 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `sphinx_btd_theme `__ | ≥0.5.2 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| !! `sphinx_fontawesome `__ | ≥0.0.6 | `GPL 2.0 `__ | *Not yet evaluated.* | +| `sphinx_design `__ | ≥0.5.0 | `MIT `__ | *Not yet evaluated.* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `sphinx-copybutton `__ | ≥0.5.2 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `sphinx_autodoc_typehints `__ | ≥2.2 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `ruamel.yaml `__ | ≥0.18 | `MIT `__ | *Not yet evaluated.* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ - -.. _dependency-packaging: +.. _DEP/packaging: Packaging (Optional) ******************** @@ -129,9 +182,21 @@ on a CI server, thus sub-dependencies are not evaluated further. Use the :file:`build/requirements.txt` file to install all dependencies via ``pip3``. The file will recursively install the mandatory dependencies too. -.. code-block:: shell +.. tab-set:: + + .. tab-item:: Linux/MacOS + :sync: Linux - pip3 install -U -r build/requirements.txt + .. code-block:: bash + + pip install -U -r build/requirements.txt + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + pip3 install -U -r build\requirements.txt .. rubric:: Dependency List @@ -145,7 +210,7 @@ install the mandatory dependencies too. +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -.. _dependency-publishing: +.. _DEP/publishing: Publishing (CI-Server only) *************************** @@ -160,9 +225,21 @@ further. Use the :file:`dist/requirements.txt` file to install all dependencies via ``pip3``. The file will recursively install the mandatory dependencies too. -.. code-block:: shell +.. tab-set:: + + .. tab-item:: Linux/MacOS + :sync: Linux + + .. code-block:: bash + + pip install -U -r dist/requirements.txt + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell - pip3 install -U -r dist/requirements.txt + pip3 install -U -r dist\requirements.txt .. rubric:: Dependency List @@ -172,5 +249,5 @@ install the mandatory dependencies too. +==========================================================+==============+===========================================================================================+======================+ | `wheel `__ | ≥0.43 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ -| `Twine `__ | ≥5.0 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +| `Twine `__ | ≥5.1 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ diff --git a/doc/Doc-License.rst b/doc/Doc-License.rst index 5267d5d4..1258fbc2 100644 --- a/doc/Doc-License.rst +++ b/doc/Doc-License.rst @@ -17,7 +17,7 @@ licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. -.. rubric:: Using Creative Commons Public Licenses +.. topic:: Using Creative Commons Public Licenses Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of diff --git a/doc/DocCoverage.rst b/doc/DocCoverage.rst new file mode 100644 index 00000000..c1e75266 --- /dev/null +++ b/doc/DocCoverage.rst @@ -0,0 +1,7 @@ +Documentation Coverage +###################### + +Documentation coverage generated by `docstr-coverage `__. + +.. report:doc-coverage:: + :packageid: src diff --git a/doc/Glossary.rst b/doc/Glossary.rst new file mode 100644 index 00000000..15d2801e --- /dev/null +++ b/doc/Glossary.rst @@ -0,0 +1,7 @@ +Glossary +######## + +.. glossary:: + + CLI + Command line interface diff --git a/doc/Installation.rst b/doc/Installation.rst index 9d172858..b7269db2 100644 --- a/doc/Installation.rst +++ b/doc/Installation.rst @@ -1,56 +1,486 @@ -.. _installation: +.. _INSTALL: + +.. |PackageName| replace:: pyEDAA.CLITool Installation/Updates #################### +See the following instructions on how to install or update the package from common sources like PyPI. Developers can +also install the packages with development dependencies. In case of local development, see the additional sections on +how to run unit tests, type checks or how to build the documentation to create all the build artifacts. + +See the list of :ref:`necessary dependencies `. + + +.. _INSTALL/pip: + +Using PIP to Install from PyPI +****************************** + +The following instruction are using PIP (Package Installer for Python) as a package manager and PyPI (Python Package +Index) as a source of Python packages. + +PIP might download further packages as listed in :ref:`package dependencies `. + + +.. _INSTALL/pip/install: + +Installing a Wheel Package from PyPI using PIP +============================================== + +Developers can install the |PackageName| package itself or the package with further dependencies for documentation +generation (``doc``), running unit tests (``test``) or just all (``all``) dependencies. + +See :ref:`DEP` for more details. + +.. tab-set:: + + .. tab-item:: Linux/MacOS + :sync: Linux + + .. tab-set:: + + .. tab-item:: Minimal installation + :sync: Minimal + + .. code-block:: bash + + # Basic pyEDAA.CLITool package + pip3 install pyEDAA.CLITool + + # Alternatively + python3 -m pip install pyEDAA.CLITool + + .. tab-item:: With Documentation Dependencies + :sync: Doc + + .. code-block:: bash + + # Install with dependencies to generate documentation + pip3 install pyEDAA.CLITool[doc] + + # Alternatively + python3 -m pip install pyEDAA.CLITool[doc] + + .. tab-item:: With Unit Testing Dependencies + :sync: Unit + + .. code-block:: bash + + # Install with dependencies to run unit tests + pip3 install pyEDAA.CLITool[test] + + # Alternatively + python3 -m pip install pyEDAA.CLITool[test] + + .. tab-item:: All Developer Dependencies + :sync: All + + .. code-block:: bash + + # Install with all developer dependencies + pip3 install pyEDAA.CLITool[all] + + # Alternatively + python3 -m pip install pyEDAA.CLITool[all] + + .. tab-item:: Windows + :sync: Windows + + .. tab-set:: + + .. tab-item:: Minimal installation + :sync: Minimal + + .. code-block:: powershell + + # Basic pyEDAA.CLITool package + pip install pyEDAA.CLITool + + # Alternatively + py -m pip install pyEDAA.CLITool + + .. tab-item:: With Documentation Dependencies + :sync: Doc + + .. code-block:: powershell + + # Install with dependencies to generate documentation + pip install pyEDAA.CLITool[doc] + + # Alternatively + py -m pip install pyEDAA.CLITool[doc] -.. _installation-pip: + .. tab-item:: With Unit Testing Dependencies + :sync: Unit -Using PIP -********* + .. code-block:: powershell -Installation from PyPI using PIP -================================ + # Install with dependencies to run unit tests + pip install pyEDAA.CLITool[test] -.. code-block:: bash + # Alternatively + py -m pip install pyEDAA.CLITool[test] - pip3 install pyEDAA.CLITool + .. tab-item:: All Developer Dependencies + :sync: All + .. code-block:: powershell + + # Install with all developer dependencies + pip install pyEDAA.CLITool[all] + + # Alternatively + py -m pip install pyEDAA.CLITool[all] + + +.. _INSTALL/pip/requirements: + +Referencing the package in ``requirements.txt`` +=============================================== + +When |PackageName| is used by another Python package, it's recommended to list the dependency to the |PackageName| +package in a ``requirements.txt`` file. + +.. admonition:: ``requirements.txt`` + + .. code-block:: text + + pyEDAA.CLITool ~= 0.3 + + +.. _INSTALL/pip/update: Updating from PyPI using PIP ============================ -.. code-block:: bash +.. tab-set:: - pip3 install -U pyEDAA.CLITool + .. tab-item:: Linux/MacOS + :sync: Linux + .. code-block:: bash + + # Update pyEDAA.CLITool + pip3 install -U pyEDAA.CLITool + + # Alternatively + python3 -m pip install -U pyEDAA.CLITool + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + # Update pyEDAA.CLITool + pip install -U pyEDAA.CLITool + + # Alternatively + py -m pip install -U pyEDAA.CLITool + + +.. _INSTALL/pip/uninstall: Uninstallation using PIP ======================== -.. code-block:: bash +.. tab-set:: + + .. tab-item:: Linux/MacOS + :sync: Linux + + .. code-block:: bash + + # Uninstall pyEDAA.CLITool + pip3 uninstall pyEDAA.CLITool + + # Alternatively + python3 -m pip uninstall pyEDAA.CLITool + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + # Uninstall pyEDAA.CLITool + pip uninstall pyEDAA.CLITool + + # Alternatively + py -m pip uninstall pyEDAA.CLITool + + +.. _INSTALL/testing: + +Running unit tests +****************** + +This package is provided with unit tests for `pytest `__. The provided testcases can be +executed locally for testing or development purposes. In addition, code coverage including branch coverage can be +collected using `Coverage.py `__. All steps provide appropriate artifacts as XML or +HTML reports. The artifact output directories are specified in ``pyproject.toml``. + +Ensure :ref:`unit testing requirements ` are installed. + +.. tab-set:: + + .. tab-item:: Linux/MacOS + :sync: Linux + + .. tab-set:: + + .. tab-item:: Unit Testing + :sync: UnitTesting + + .. code-block:: bash + + cd + + # Running unit tests using pytest + pytest -raP --color=yes tests/unit + + .. tab-item:: Unit Testing with Ant/JUnit XML Reports + :sync: UnitTestingXML + + .. code-block:: bash + + cd + + # Running unit tests using pytest + pytest -raP --color=yes --junitxml=report/unit/unittest.xml --template=html1/index.html --report=report/unit/html/index.html --split-report tests/unit + + .. tab-item:: Unit Testing with Code Coverage + :sync: Coverage + + .. code-block:: bash + + cd + + # Running unit tests with code coverage using Coverage.py + coverage run --data-file=.coverage --rcfile=pyproject.toml -m pytest -ra --tb=line --color=yes tests/unit + + # Write coverage report to console" + coverage report + + # Convert coverage report to HTML + coverage html + + # Convert coverage report to XML (Cobertura) + coverage xml + + .. tab-item:: Windows + :sync: Windows + + .. tab-set:: + + .. tab-item:: Unit Testing + :sync: UnitTesting + + .. code-block:: powershell + + cd + + # Running unit tests using pytest + pytest -raP --color=yes tests\unit + + .. tab-item:: Unit Testing with Ant/JUnit XML Reports + :sync: UnitTestingXML + + .. code-block:: powershell + + cd + + # Running unit tests using pytest + pytest -raP --color=yes --junitxml=report\unit\unittest.xml --template=html1\index.html --report=report\unit\html\index.html --split-report tests\unit + + .. tab-item:: Unit Testing with Code Coverage + :sync: Coverage + + .. code-block:: powershell + + cd + + # Running unit tests with code coverage using Coverage.py + coverage run --data-file=.coverage --rcfile=pyproject.toml -m pytest -ra --tb=line --color=yes tests\unit + + # Write coverage report to console" + coverage report + + # Convert coverage report to HTML + coverage html + + # Convert coverage report to XML (Cobertura) + coverage xml + + +.. _INSTALL/typechecking: + +Running type checks +******************* + +This package is provided with type checks. These can be executed locally for testing or development purposes using +`mypy `__. The artifact output directory is specified in ``pyproject.toml``. + +Ensure :ref:`unit testing requirements ` are installed. + +.. tab-set:: + + .. tab-item:: Linux/MacOS + :sync: Linux + + .. code-block:: bash + + cd + + # Running type checking using mypy + export MYPY_FORCE_COLOR=1 + mypy -p pyEDAA.CLITool + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + cd + + # Running type checking using mypy + $env:MYPY_FORCE_COLOR = 1 + mypy -p pyEDAA.CLITool + + +.. _INSTALL/documentation: + +Building documentation +********************** + +The documentation can be build locally using `Sphinx `__. It can generate HTML and LaTeX +outputs. In an additional step, the LaTeX output can be translated to a PDF file using a LaTeX environment like +`MiKTeX `__. + +Ensure :ref:`documentation requirements ` are installed. + +.. tab-set:: + + .. tab-item:: Linux/MacOS + :sync: Linux + + .. tab-set:: + + .. tab-item:: Generating HTML + :sync: HTML + + .. code-block:: bash + + cd + + # Adding package root to PYTHONPATH + export PYTHONPATH=$(pwd) + cd doc + + # Building documentation using Sphinx + sphinx-build -v -n -b html -d _build/doctrees -j $(nproc) -w _build/html.log . _build/html + + .. tab-item:: Generating LaTeX + :sync: LaTeX + + .. code-block:: bash + + cd + + # Adding package root to PYTHONPATH + export PYTHONPATH=$(pwd) + cd doc + + # Building documentation using Sphinx + sphinx-build -v -n -b latex -d _build/doctrees -j $(nproc) -w _build/latex.log . _build/latex + + .. tab-item:: Generating PDF (from LaTeX) + :sync: PDF + + .. todo:: Describe LaTeX to PDF conversion on Linux using Miktex. + + .. hint:: A `Miktex installation `__ is required. + + .. tab-item:: Windows + :sync: Windows + + .. tab-set:: + + .. tab-item:: Generating HTML + :sync: HTML + + .. code-block:: powershell + + cd + + # Building documentation using Sphinx + .\doc\make.bat html --verbose + + .. tab-item:: Generating LaTeX + :sync: LaTeX + + .. code-block:: powershell + + cd + + # Building documentation using Sphinx + .\doc\make.bat latex --verbose + + .. tab-item:: Generating PDF (from LaTeX) + :sync: PDF + + .. todo:: Describe LaTeX to PDF conversion on Windows using Miktex. + + .. hint:: A `Miktex installation `__ is required. + + +.. _INSTALL/building: + +Local Packaging and Installation via PIP +**************************************** + +For development and bug fixing it might be handy to create a local wheel package and also install it locally on the +development machine. The following instructions will create a local wheel package (``*.whl``) and then use PIP to +install it. As a user might have a |PackageName| installation from PyPI, it's recommended to uninstall any previous +|PackageName| packages. (This step is also needed if installing an updated local wheel file with same version number. +PIP will not detect a new version and thus not overwrite/reinstall the updated package contents.) + +Ensure :ref:`packaging requirements ` are installed. + +.. tab-set:: + + .. tab-item:: Linux/MacOS + :sync: Linux + + .. code-block:: bash - pip3 uninstall pyEDAA.CLITool + cd + # Package the code in a wheel (*.whl) + python3 -m build --wheel -Installation from local directory using PIP -=========================================== + # Uninstall the old package + python3 -m pip uninstall -y pyEDAA.CLITool -.. code-block:: bash + # Install from wheel + python3 -m pip install ./dist/pyEDAA.CLITool-0.3.0-py3-none-any.whl - pip3 install . + .. tab-item:: Windows + :sync: Windows + .. code-block:: powershell -.. _installation-setup: + cd -Using ``setup.py`` (legacy) -*************************** + # Package the code in a wheel (*.whl) + py -m build --wheel -See sections above on how to use PIP. + # Uninstall the old package + py -m pip uninstall -y pyEDAA.CLITool -Installation using ``setup.py`` -=============================== + # Install from wheel + py -m pip install .\dist\pyEDAA.CLITool-0.3.0-py3-none-any.whl -.. code-block:: bash +.. note:: - setup.py install + The legacy ways of building a package using ``setup.py bdist_wheel`` and installation using ``setup.py install`` is + not recommended anymore. diff --git a/doc/Makefile b/doc/Makefile index 4dc7e78d..d4bb2cbb 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,11 +1,20 @@ -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . BUILDDIR = _build -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees -T -D language=en $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile -%: - $(SPHINXBUILD) -b $@ $(ALLSPHINXOPTS) $(BUILDDIR)/$@ +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/_static/css/override.css b/doc/_static/css/override.css new file mode 100644 index 00000000..7e82b57a --- /dev/null +++ b/doc/_static/css/override.css @@ -0,0 +1,112 @@ +/* theme overrides */ +.rst-content h1, +.rst-content h2 { + margin-top: 24px; + margin-bottom: 6px; + text-decoration: underline; +} + +.rst-content h3, +.rst-content h4, +.rst-content h5, +.rst-content h6 { + margin-top: 12px; + margin-bottom: 6px; +} + +.rst-content p { + margin-bottom: 6px +} + +/* general overrides */ +html { + font-size: 15px; +} + +footer { + font-size: 95%; + text-align: center +} + +footer p { + margin-bottom: 0px /* 12px */; + font-size: 95% +} + +section > p, +.section p, +.simple li { + text-align: justify +} + +.rst-content .topic-title { + font-size: larger; + font-weight: 700; + margin-top: 18px; + margin-bottom: 6px; +} + +p.rubric { + text-decoration: underline +} + +/* wyrm overrides */ +.wy-menu-vertical header, +.wy-menu-vertical p.caption { + color: #9b9b9b /* #55a5d9 */; + padding: 0 0.809em /* 0 1.618em */; + margin: 6px 0 0 0 /* 12px 0 0 */; + border-top: 1px solid #9b9b9b; +} + +.wy-side-nav-search { + margin-bottom: 0 /* .809em */; + background-color: #333333 /* #2980b9 */; + /* BTD: */ + /*color: #fcfcfc*/ +} + +.wy-side-nav-search input[type=text] { + border-radius: 0px /* 50px */; +} + +.wy-side-nav-search .wy-dropdown > a, .wy-side-nav-search > a { + /* BTD: */ + /*color: #fcfcfc;*/ + margin-bottom: 0.404em /* .809em */; +} + +.wy-side-nav-search > div.version { + margin: 0 0 6px 0; + /* BTD: */ + /*margin-top: -.4045em;*/ +} + +.wy-nav .wy-menu-vertical a:hover { + background-color: #333333 /* #2980b9 */; +} + +.wy-nav-content { + max-width: 1600px /* 800px */ ; +} + +.wy-nav-top { + background: #333333 /* #2980b9 */; +} + +/* Sphinx Design */ +.sd-tab-set { + margin: 0 +} + +.sd-tab-set > label { + padding-top: .5em; + padding-right: 1em; + padding-bottom: .5em; + padding-left: 1em +} + +.sd-container-fluid { + padding-left: 0; + padding-right: 0; +} diff --git a/doc/_templates/autoapi/module.rst b/doc/_templates/autoapi/module.rst index 655beff4..4dded81f 100644 --- a/doc/_templates/autoapi/module.rst +++ b/doc/_templates/autoapi/module.rst @@ -1,12 +1,12 @@ -.. # Template modified by Patrick Lehmann +.. # Template modified by Patrick Lehmann * removed automodule on top, because private members are activated for autodoc (no doubled documentation). * Made sections like 'submodules' bold text, but no headlines to reduce number of ToC levels. -=={{ '=' * node.name|length }}== -``{{ node.name }}`` -=={{ '=' * node.name|length }}== +{{ '=' * node.name|length }} +{{ node.name }} +{{ '=' * node.name|length }} -.. py:module:: {{ node.name }} +.. automodule:: {{ node.name }} {##} {%- block modules -%} @@ -14,8 +14,8 @@ **Submodules** - .. toctree:: + :maxdepth: 1 {% for item in subnodes %} {{ item.name }} {%- endfor %} @@ -25,7 +25,17 @@ {##} .. currentmodule:: {{ node.name }} {##} -{%- block functions -%} + +{%- if node.variables %} + +**Variables** + +{% for item, obj in node.variables.items() -%} +- :py:data:`{{ item }}` + {#{ obj|summary }#} +{% endfor -%} +{%- endif -%} + {%- if node.functions %} **Functions** @@ -35,15 +45,19 @@ {{ obj|summary }} {% endfor -%} +{%- endif -%} -{% for item in node.functions %} -.. autofunction:: {{ item }} -{##} -{%- endfor -%} +{%- if node.exceptions %} + +**Exceptions** + +{% for item, obj in node.exceptions.items() -%} +- :py:exc:`{{ item }}`: + {{ obj|summary }} + +{% endfor -%} {%- endif -%} -{%- endblock -%} -{%- block classes -%} {%- if node.classes %} **Classes** @@ -53,14 +67,40 @@ {{ obj|summary }} {% endfor -%} +{%- endif -%} -{% for item in node.classes %} -.. autoclass:: {{ item }} - :members: +{%- block variables -%} +{%- if node.variables %} - .. rubric:: Inheritance - .. inheritance-diagram:: {{ item }} - :parts: 1 +--------------------- + +**Variables** + +{#% for item, obj in node.variables.items() -%} +- :py:data:`{{ item }}` +{% endfor -%#} + +{% for item, obj in node.variables.items() %} +.. autodata:: {{ item }} + :annotation: + + .. code-block:: text + + {{ obj|pprint|indent(6) }} +{##} +{%- endfor -%} +{%- endif -%} +{%- endblock -%} + +{%- block functions -%} +{%- if node.functions %} + +--------------------- + +**Functions** + +{% for item in node.functions %} +.. autofunction:: {{ item }} {##} {%- endfor -%} {%- endif -%} @@ -69,13 +109,15 @@ {%- block exceptions -%} {%- if node.exceptions %} +--------------------- + **Exceptions** -{% for item, obj in node.exceptions.items() -%} +{#% for item, obj in node.exceptions.items() -%} - :py:exc:`{{ item }}`: {{ obj|summary }} -{% endfor -%} +{% endfor -%#} {% for item in node.exceptions %} .. autoexception:: {{ item }} @@ -88,22 +130,30 @@ {%- endif -%} {%- endblock -%} -{%- block variables -%} -{%- if node.variables %} +{%- block classes -%} +{%- if node.classes %} -**Variables** +--------------------- -{% for item, obj in node.variables.items() -%} -- :py:data:`{{ item }}` -{% endfor -%} +**Classes** -{% for item, obj in node.variables.items() %} -.. autodata:: {{ item }} - :annotation: +{#% for item, obj in node.classes.items() -%} +- :py:class:`{{ item }}`: + {{ obj|summary }} - .. code-block:: text +{% endfor -%#} - {{ obj|pprint|indent(6) }} +{% for item in node.classes %} +.. autoclass:: {{ item }} + :members: + :private-members: + :special-members: + :inherited-members: + :exclude-members: __weakref__ + + .. rubric:: Inheritance + .. inheritance-diagram:: {{ item }} + :parts: 1 {##} {%- endfor -%} {%- endif -%} diff --git a/doc/_templates/autoapi/package.rst b/doc/_templates/autoapi/package.rst new file mode 100644 index 00000000..9cc9fbdc --- /dev/null +++ b/doc/_templates/autoapi/package.rst @@ -0,0 +1,14 @@ +.. # Template created by Patrick Lehmann + +Python Class Reference +###################### + +Reference of all packages and modules: + +.. automodule:: {{ node.name }} + +.. toctree:: + :maxdepth: 1 +{% for item in subnodes %} + {{ item.name }} +{%- endfor %} diff --git a/doc/conf.py b/doc/conf.py index afa11812..16050f4e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -1,20 +1,18 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. - from sys import path as sys_path from os.path import abspath from pathlib import Path -from json import loads from pyTooling.Packaging import extractVersionInformation ROOT = Path(__file__).resolve().parent -sys_path.insert(0, abspath('.')) -sys_path.insert(0, abspath('..')) -sys_path.insert(0, abspath('../pyEDAA/CLITool')) -#sys_path.insert(0, abspath('_extensions')) +sys_path.insert(0, abspath(".")) +sys_path.insert(0, abspath("..")) +sys_path.insert(0, abspath("../pyEDAA/CLITool")) +# sys_path.insert(0, abspath("_extensions")) # ============================================================================== @@ -23,7 +21,8 @@ # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. -project = "pyEDAA.CLITool" +githubNamespace = "EDAA-org" +project = "pyEDAA.CLITool" packageInformationFile = Path(f"../{project.replace('.', '/')}/__init__.py") versionInformation = extractVersionInformation(packageInformationFile) @@ -38,23 +37,23 @@ # Miscellaneous settings # ============================================================================== # The master toctree document. -master_doc = 'index' +master_doc = "index" # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = [ "_build", - "_themes", + "_theme", "Thumbs.db", ".DS_Store" ] # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'stata-dark' +pygments_style = "manni" # ============================================================================== @@ -73,39 +72,38 @@ # ============================================================================== # Options for HTML output # ============================================================================== - -html_context = {} -ctx = ROOT / 'context.json' -if ctx.is_file(): - html_context.update(loads(ctx.open('r').read())) - -if (ROOT / "_theme").is_dir(): - html_theme_path = ["."] - html_theme = "_theme" - html_theme_options = { - 'logo_only': True, - 'home_breadcrumbs': False, - 'vcs_pageview_mode': 'blob', - } -else: - html_theme = "alabaster" +html_theme = "sphinx_rtd_theme" +html_theme_options = { + "logo_only": True, + "vcs_pageview_mode": 'blob', + "navigation_depth": 5, +} +html_css_files = [ + 'css/override.css', +] # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] html_logo = str(Path(html_static_path[0]) / "logo.svg") html_favicon = str(Path(html_static_path[0]) / "favicon.svg") # Output file base name for HTML help builder. -htmlhelp_basename = 'pyEDAACLIToolDoc' +htmlhelp_basename = f"{project.replace('.', '')}Doc" # If not None, a 'Last updated on:' timestamp is inserted at every page # bottom, using the given strftime format. # The empty string is equivalent to '%b %d, %Y'. html_last_updated_fmt = "%d.%m.%Y" +# ============================================================================== +# Python settings +# ============================================================================== +modindex_common_prefix = [ + f"{project}." +] # ============================================================================== # Options for LaTeX / PDF output @@ -114,13 +112,13 @@ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). - 'papersize': 'a4paper', + "papersize": "a4paper", # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. - 'preamble': dedent(r""" + "preamble": dedent(r""" % ================================================================================ % User defined additional preamble code % ================================================================================ @@ -146,10 +144,10 @@ # author, documentclass [howto, manual, or own class]). latex_documents = [ ( master_doc, - 'pyEDAA.CLITool.tex', - 'The pyEDAA.CLITool Documentation', - 'Patrick Lehmann', - 'manual' + f"{project}.tex", + f"The {project} Documentation", + f"Patrick Lehmann", + f"manual" ), ] @@ -160,20 +158,23 @@ extensions = [ # Standard Sphinx extensions "sphinx.ext.autodoc", - 'sphinx.ext.extlinks', - 'sphinx.ext.intersphinx', - 'sphinx.ext.inheritance_diagram', - 'sphinx.ext.todo', - 'sphinx.ext.graphviz', - 'sphinx.ext.mathjax', - 'sphinx.ext.ifconfig', - 'sphinx.ext.viewcode', + "sphinx.ext.extlinks", + "sphinx.ext.intersphinx", + "sphinx.ext.inheritance_diagram", + "sphinx.ext.todo", + "sphinx.ext.graphviz", + "sphinx.ext.mathjax", + "sphinx.ext.ifconfig", + "sphinx.ext.viewcode", # SphinxContrib extensions - 'sphinxcontrib.mermaid', + "sphinxcontrib.mermaid", # Other extensions - 'sphinx_fontawesome', - 'sphinx_autodoc_typehints', - 'autoapi.sphinx', + "sphinx_design", + "sphinx_copybutton", + "sphinx_autodoc_typehints", + "autoapi.sphinx", + "sphinx_reports", +# User defined extensions ] @@ -181,7 +182,8 @@ # Sphinx.Ext.InterSphinx # ============================================================================== intersphinx_mapping = { - 'python': ('https://docs.python.org/3', None), + "python": ("https://docs.python.org/3", None), + "pyTool": ("https://pyTooling.github.io/pyTooling/", None), } @@ -189,12 +191,12 @@ # Sphinx.Ext.AutoDoc # ============================================================================== # see: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#configuration -autodoc_default_options = { - "private-members": True, - "special-members": True, - "inherited-members": True, - "exclude-members": "__weakref__" -} +#autodoc_default_options = { +# "private-members": True, +# "special-members": True, +# "inherited-members": True, +# "exclude-members": "__weakref__" +#} #autodoc_class_signature = "separated" autodoc_member_order = "bysource" # alphabetical, groupwise, bysource autodoc_typehints = "both" @@ -205,9 +207,11 @@ # Sphinx.Ext.ExtLinks # ============================================================================== extlinks = { - "ghissue": ("https://GitHub.com/edaa-org/pyEDAA.CLITool/issues/%s", "issue #%s"), - "ghpull": ("https://GitHub.com/edaa-org/pyEDAA.CLITool/pull/%s", "pull request #%s"), - "ghsrc": ("https://GitHub.com/edaa-org/pyEDAA.CLITool/blob/main/%s", None), + "gh": (f"https://GitHub.com/%s", "gh:%s"), + "ghissue": (f"https://GitHub.com/{githubNamespace}/{project}/issues/%s", "issue #%s"), + "ghpull": (f"https://GitHub.com/{githubNamespace}/{project}/pull/%s", "pull request #%s"), + "ghsrc": (f"https://GitHub.com/{githubNamespace}/{project}/blob/main/%s", None), + "wiki": (f"https://en.wikipedia.org/wiki/%s", None), } @@ -217,6 +221,26 @@ graphviz_output_format = "svg" +# ============================================================================== +# SphinxContrib.Mermaid +# ============================================================================== +mermaid_params = [ + '--backgroundColor', 'transparent', +] +mermaid_verbose = True + + +# ============================================================================== +# Sphinx.Ext.Inheritance_Diagram +# ============================================================================== +inheritance_node_attrs = { +# "shape": "ellipse", +# "fontsize": 14, +# "height": 0.75, + "color": "dodgerblue1", + "style": "filled" +} + # ============================================================================== # Sphinx.Ext.ToDo @@ -226,6 +250,47 @@ todo_link_only = True +# ============================================================================== +# sphinx-reports +# ============================================================================== +_coverageLevels = { + 30: {"class": "report-cov-below30", "desc": "almost undocumented"}, + 50: {"class": "report-cov-below50", "desc": "poorly documented"}, + 80: {"class": "report-cov-below80", "desc": "roughly documented"}, + 90: {"class": "report-cov-below90", "desc": "well documented"}, + 100: {"class": "report-cov-below100", "desc": "excellent documented"}, + "error": {"class": "report-cov-error", "desc": "internal error"}, +} + +report_unittest_testsuites = { + "src": { + "name": f"{project}", + "xml_report": "../report/unit/TestReportSummary.xml", + } +} +report_codecov_packages = { + "src": { + "name": f"{project}", + "json_report": "../report/coverage/coverage.json", + "fail_below": 80, + "levels": _coverageLevels + } +} +report_doccov_packages = { + "src": { + "name": f"{project}", + "directory": f"../{project}", + "fail_below": 80, + "levels": _coverageLevels + } +} + + +# ============================================================================== +# Sphinx_Design +# ============================================================================== +sd_fontawesome_latex = True + # ============================================================================== # AutoAPI.Sphinx diff --git a/doc/coverage/index.rst b/doc/coverage/index.rst index 80bbad2e..bad51b90 100644 --- a/doc/coverage/index.rst +++ b/doc/coverage/index.rst @@ -1,4 +1,7 @@ -Coverage Report -############### +Code Coverage Report +#################### -*Placeholder for the Coverage report generated with* ``pytest`` *and* ``coverage``. +Code coverage report generated with `pytest `__ and `Coverage.py `__. + +.. report:code-coverage:: + :packageid: src diff --git a/doc/index.rst b/doc/index.rst index 71bc6dcc..c95ce889 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -36,16 +36,16 @@ The pyEDAA.CLITool Documentation Unified interfaces to execute EDA tools via CLI from Python, agnostic to any specific configuration format/object. -.. _goals: +.. _GOALS: Main Goals ********** -* Provide a pythonic solution to construct command line calls for EDA tools based on `pyTooling.CLIAbstraction `__ +* Provide a pythonic solution to construct command line calls for EDA tools based on `pyTooling.CLIAbstraction `__ * Launch CLI tools and connect to STDIN, STDOUT, STDERR for realtime output post-processing. -.. _features: +.. _FEATURES: Features ******** @@ -56,6 +56,9 @@ Features * Generate CLI options in correct order. * Generate correctly escaped CLI options. + +.. _CONSUMERS: + Consumers ********* @@ -66,7 +69,7 @@ This layer is used by: * 🚧 `Open Source Verification Bundle (OSVB) `__ -.. _news: +.. _NEWS: News **** @@ -109,7 +112,7 @@ News * The EDA tool abstraction has been extracted from `pyIPCMI `__. -.. _contributors: +.. _CONTRIBUTORS: Contributors ************ @@ -119,7 +122,7 @@ Contributors * `and more... `__ -.. _license: +.. _LICENSE: License ******* @@ -159,16 +162,22 @@ License Tutorial Tools/index - .. raw:: latex - \part{References} + \part{References and Reports} .. toctree:: - :caption: References + :caption: References and Reports :hidden: - pyEDAA.CLITool/index + pyEDAA.CLITool/pyEDAA.CLITool + unittests/index + coverage/index + Doc. Coverage Report + Static Type Check Report ➚ + +.. Coverage Report ➚ + Static Type Check Report ➚ .. raw:: latex @@ -178,10 +187,9 @@ License :caption: Appendix :hidden: - Coverage Report ➚ - Static Type Check Report ➚ License Doc-License Glossary genindex - py-modindex + Python Module Index + TODO diff --git a/doc/make.bat b/doc/make.bat new file mode 100644 index 00000000..53ac3a7c --- /dev/null +++ b/doc/make.bat @@ -0,0 +1,36 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=py -3.12 -m sphinx.cmd.build +) +set SOURCEDIR=. +set BUILDDIR=_build +set SPHINXOPTS=-v + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/doc/py-modindex.rst b/doc/py-modindex.rst deleted file mode 100644 index 23167be6..00000000 --- a/doc/py-modindex.rst +++ /dev/null @@ -1,4 +0,0 @@ -.. This file is a placeholder and will be replaced - -Module Index -############ diff --git a/doc/pyEDAA.CLITool/index.rst b/doc/pyEDAA.CLITool/index.rst deleted file mode 100644 index 56a72c4d..00000000 --- a/doc/pyEDAA.CLITool/index.rst +++ /dev/null @@ -1,8 +0,0 @@ -Python Class Reference -###################### - -Reference of all packages and modules: - -.. toctree:: - - pyEDAA.CLITool diff --git a/doc/requirements.txt b/doc/requirements.txt index 2bd764fb..138f68b8 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,13 +1,18 @@ -r ../requirements.txt -pyTooling ~=6.5 +pyTooling ~= 6.5 # Enforce latest version on ReadTheDocs sphinx ~= 7.4 docutils ~= 0.20 +# ReadTheDocs Theme +sphinx_rtd_theme ~= 2.0.0 + # Sphinx Extenstions -sphinxcontrib-mermaid>=0.7.1 -autoapi>=2.0.1 -sphinx_fontawesome>=0.0.6 +sphinxcontrib-mermaid >= 0.9.2 +autoapi >= 2.0.1 +sphinx_design >= 0.5.0 +sphinx-copybutton >= 0.5.2 sphinx_autodoc_typehints ~= 2.2 +sphinx_reports ~= 0.6 diff --git a/pyEDAA/CLITool/__init__.py b/pyEDAA/CLITool/__init__.py index c5df7798..f6dc2236 100644 --- a/pyEDAA/CLITool/__init__.py +++ b/pyEDAA/CLITool/__init__.py @@ -40,8 +40,9 @@ from pathlib import Path from typing import Any, Optional as Nullable -from pyTooling.Decorators import export -from pyTooling.Exceptions import ExceptionBase +from pyTooling.Decorators import export +from pyTooling.Exceptions import ExceptionBase +from pyTooling.MetaClasses import ExtendedType @export @@ -49,7 +50,7 @@ class CLIToolException(ExceptionBase): pass -class ToolMixIn: +class ToolMixIn(metaclass=ExtendedType, mixin=True): _platform: str _dryrun: bool _binaryDirectoryPath: Path diff --git a/pyproject.toml b/pyproject.toml index 1632a0ff..5c8d0754 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "setuptools ~= 70.3", + "setuptools ~= 71.1", "wheel ~= 0.43", "pyTooling ~= 6.5" ] @@ -34,7 +34,7 @@ junit_logging = "all" [tool.interrogate] color = true verbose = 1 # possible values: 0 (minimal output), 1 (-v), 2 (-vv) -fail-under = 80 +fail-under = 59 exclude = [ "build", "dist", diff --git a/requirements.txt b/requirements.txt index 34f42498..580ccc73 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -pyTooling ~=6.5 +pyTooling ~= 6.5 pyVHDLModel ~= 0.28.0 py-flags ~= 1.1 diff --git a/run.ps1 b/run.ps1 new file mode 100644 index 00000000..40b4a498 --- /dev/null +++ b/run.ps1 @@ -0,0 +1,317 @@ +[CmdletBinding()] +Param( + # Clean up all files and directories + [switch]$clean, + + # Commands + [switch]$all, + [switch]$copyall, + + [switch]$doc, + [switch]$livedoc, + [switch]$doccov, + + [switch]$unit, + [switch]$liveunit, + [switch]$copyunit, + + [switch]$cov, + [switch]$livecov, + [switch]$copycov, + + [switch]$type, + [switch]$livetype, + [switch]$copytype, + + [switch]$nooutput, + + [switch]$build, + [switch]$install, + + # Display this help" + [switch]$help +) + +$PackageName = "pyEDAA.CLITool" +$PackageVersion = "0.3.0" + +# set default values +$EnableDebug = [bool]$PSCmdlet.MyInvocation.BoundParameters["Debug"] +$EnableVerbose = [bool]$PSCmdlet.MyInvocation.BoundParameters["Verbose"] -or $EnableDebug + +# Display help if no command was selected +$help = $help -or ( -not( + $all -or $copyall -or + $clean -or + $doc -or $livedoc -or $doccov -or + $unit -or $liveunit -or $copyunit -or + $cov -or $livecov -or $copycov -or + $type -or $livetype -or $copytype -or + $build -or $install + ) +) + +Write-Host "================================================================================" -ForegroundColor Magenta +Write-Host "$PackageName Documentation Compilation and Assembly Tool" -ForegroundColor Magenta +Write-Host "================================================================================" -ForegroundColor Magenta + +if ($help) +{ Get-Help $MYINVOCATION.MyCommand.Path -Detailed + exit 0 +} + +if ($all) +{ $doc = $true + $unit = $true +# $copyunit = $true + $cov = $true +# $copycov = $true + $type = $true + $copytype = $true +} +if ($copyall) +{# $copyunit = $true +# $copycov = $true + $copytype = $true +} + +if ($clean) +{ Write-Host -ForegroundColor DarkYellow "[live][DOC] Cleaning documentation directories ..." + rm -Force .\doc\$PackageName\* + .\doc\make.bat clean + Write-Host -ForegroundColor DarkYellow "[live][BUILD] Cleaning build directories ..." + rm -Force .\build\bdist.win-amd64 + rm -Force .\build\lib +} + +if ($build) +{ Write-Host -ForegroundColor Yellow "[live][BUILD] Cleaning build directories ..." + rm -Force .\build\bdist.win-amd64 + rm -Force .\build\lib + Write-Host -ForegroundColor Yellow "[live][BUILD] Building $PackageName package as wheel ..." + py -3.12 -m build --wheel + + Write-Host -ForegroundColor Yellow "[live][BUILD] Building wheel finished" +} +if ($install) +{ if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) + { Write-Host -ForegroundColor Yellow "[live][INSTALL] Installing $PackageName with administrator rights ..." + $proc = Start-Process pwsh.exe "-NoProfile -ExecutionPolicy Bypass -WorkingDirectory `"$PSScriptRoot`" -File `"$PSCommandPath`" `"-install`"" -Verb RunAs -Wait + +# Write-Host -ForegroundColor Yellow "[live][INSTALL] Wait on administrator console ..." +# Wait-Process -Id $proc.Id + } + else + { Write-Host -ForegroundColor Cyan "[ADMIN][UNINSTALL] Uninstalling $PackageName ..." + py -3.12 -m pip uninstall -y $PackageName + Write-Host -ForegroundColor Cyan "[ADMIN][INSTALL] Installing $PackageName from wheel ..." + py -3.12 -m pip install .\dist\$PackageName-$PackageVersion-py3-none-any.whl + + Write-Host -ForegroundColor Cyan "[ADMIN][INSTALL] Closing window in 5 seconds ..." + Start-Sleep -Seconds 5 + } +} + +$jobs = @() + +if ($livedoc) +{ Write-Host -ForegroundColor DarkYellow "[live][DOC] Building documentation using Sphinx ..." + + .\doc\make.bat html --verbose + + Write-Host -ForegroundColor DarkYellow "[live][DOC] Documentation finished" +} +elseif ($doc) +{ Write-Host -ForegroundColor DarkYellow "[Job1][DOC] Building documentation using Sphinx ..." + Write-Host -ForegroundColor DarkGreen "[SCRIPT] Starting Documentation job ..." + + # Compile documentation + $compileDocFunc = { + .\doc\make.bat html --verbose + } + $docJob = Start-Job -Name "Documentation" -ScriptBlock $compileDocFunc +# $jobs += $docJob +} + + +if ($doccov) +{ + .\doc\make.bat coverage +} + +if ($liveunit) +{ Write-Host -ForegroundColor DarkYellow "[live][UNIT] Running Unit Tests using pytest ..." + + $env:ENVIRONMENT_NAME = "Windows (x86-64)" + pytest -raP --color=yes --junitxml=report/unit/unittest.xml --template=html1/index.html --report=report/unit/html/index.html --split-report tests/unit + + if ($copyunit) + { cp -Recurse -Force .\report\unit\html\* .\doc\_build\html\unittests + Write-Host -ForegroundColor DarkBlue "[live][UNIT] Copyed unit testing report to 'unittests' directory in HTML directory" + } + + Write-Host -ForegroundColor DarkYellow "[live][UNIT] Unit Tests finished" +} +elseif ($unit) +{ Write-Host -ForegroundColor DarkYellow "[Job2][UNIT] Running Unit Tests using pytest ..." + Write-Host -ForegroundColor DarkGreen "[SCRIPT] Starting UnitTests jobs ..." + + # Run unit tests + $runUnitFunc = { + $env:ENVIRONMENT_NAME = "Windows (x86-64)" + pytest -raP --color=yes --junitxml=report/unit/unittest.xml --template=html1/index.html --report=report/unit/html/index.html --split-report tests/unit + } + $unitJob = Start-Job -Name "UnitTests" -ScriptBlock $runUnitFunc + $jobs += $unitJob +} + +if ($livecov) +{ Write-Host -ForegroundColor DarkMagenta "[live][COV] Running Unit Tests with coverage ..." + + $env:ENVIRONMENT_NAME = "Windows (x86-64)" + coverage run --data-file=.coverage --rcfile=pyproject.toml -m pytest -ra --tb=line --color=yes tests/unit + + Write-Host -ForegroundColor DarkMagenta "[live][COV] Convert coverage report to HTML ..." + coverage html + + Write-Host -ForegroundColor DarkMagenta "[live][COV] Convert coverage report to XML (Cobertura) ..." + coverage xml + + Write-Host -ForegroundColor DarkMagenta "[live][COV] Convert coverage report to JSON ..." + coverage json + + Write-Host -ForegroundColor DarkMagenta "[live][COV] Write coverage report to console ..." + coverage report + + if ($copycov) + { cp -Recurse -Force .\report\coverage\html\* .\doc\_build\html\coverage + Write-Host -ForegroundColor DarkMagenta "[live][COV] Copyed code coverage report to 'coverage' directory in HTML directory" + } + + Write-Host -ForegroundColor DarkMagenta "[live][COV] Coverage finished" +} +elseif ($cov) +{ Write-Host -ForegroundColor DarkMagenta "[live][COV] Running Unit Tests with coverage ..." + Write-Host -ForegroundColor DarkMagenta "[SCRIPT] Starting Coverage jobs ..." + + # Collect coverage + $collectCovFunc = { + $env:ENVIRONMENT_NAME = "Windows (x86-64)" + coverage run --data-file=.coverage --rcfile=pyproject.toml -m pytest -ra --tb=line --color=yes tests/unit + + Write-Host -ForegroundColor DarkMagenta "[Job3][COV] Convert coverage report to HTML ..." + coverage html + + Write-Host -ForegroundColor DarkMagenta "[Job3][COV] Convert coverage report to XML (Cobertura) ..." + coverage xml + + Write-Host -ForegroundColor DarkMagenta "[Job3][COV] Convert coverage report to JSON ..." + coverage json + } + $covJob = Start-Job -Name "Coverage" -ScriptBlock $collectCovFunc + $jobs += $covJob +} + +if ($livetype) +{ Write-Host -ForegroundColor DarkCyan "[live][TYPE] Running static type analysis using mypy ..." + + $env:MYPY_FORCE_COLOR = 1 + mypy.exe -p $PackageName + + if ($copytype) + { cp -Recurse -Force .\report\typing\* .\doc\_build\html\typing + Write-Host -ForegroundColor DarkCyan "[live][TYPE] Copyed typing report to 'typing' directory in HTML directory." + } + + Write-Host -ForegroundColor DarkCyan "[live][TYPE] Static type analysis finished" +} +elseif ($type) +{ Write-Host -ForegroundColor DarkCyan "[live][TYPE] Running static type analysis using mypy ..." + Write-Host -ForegroundColor DarkCyan "[SCRIPT] Starting Typing jobs ..." + + # Analyze types + $analyzeTypesFunc = { + $env:MYPY_FORCE_COLOR = 1 + mypy.exe -p $PackageName + } + $typeJob = Start-Job -Name "Typing" -ScriptBlock $analyzeTypesFunc + $jobs += $typeJob +} + + +if ($doc) +{ Write-Host -ForegroundColor DarkGreen "[SCRIPT] Waiting on Documentation job ..." + Wait-Job -Job $docJob + Write-Host -ForegroundColor DarkYellow "[Job1][DOC] Documentation finished" +} +if ($jobs.Count -ne 0) +{ + Write-Host -ForegroundColor DarkGreen ( "[SCRIPT] Waiting on {0} jobs ({1}) ..." -f $jobs.Count, (($jobs | %{ $_.Name }) -join ", ")) + Wait-Job -Job $jobs +} + + +if (-not $liveunit -and $copyunit) +{ +# if ($unit) +# { Wait-Job -Job $unitJob +# Write-Host -ForegroundColor DarkBlue "[Job2][UNIT] Unit tests finished" +# } + cp -Recurse -Force .\report\unit\html\* .\doc\_build\html\unittests + Write-Host -ForegroundColor DarkBlue "[post][UNIT] Copyed unit testing report to 'unittests' directory in HTML directory" +} +if (-not ($livecov -or $cov) -and $copycov) +{ +# if ($cov) +# { Wait-Job -Job $unitJob +# Write-Host -ForegroundColor DarkMagenta "[Job3][UNIT] Coverage collection finished" +# } + cp -Recurse -Force .\report\coverage\html\* .\doc\_build\html\coverage + Write-Host -ForegroundColor DarkMagenta "[post][COV] Copyed code coverage report to 'coverage' directory in HTML directory" +} +if (-not $livetype -and $copytype) +{ +# if ($type) +# { Wait-Job -Job $typeJob +# Write-Host -ForegroundColor DarkCyan "[Job4][UNIT] Static type analysis finished" +# } + cp -Recurse -Force .\report\typing\* .\doc\_build\html\typing + Write-Host -ForegroundColor DarkCyan "[post][TYPE] Copyed typing report to 'typing' directory in HTML directory." +} + + +if ($type) +{ Write-Host -ForegroundColor DarkCyan "================================================================================" + if (-not $nooutput) + { Receive-Job -Job $typeJob + } + Remove-Job -Job $typeJob +} +if ($doc) +{ Write-Host -ForegroundColor DarkYellow "================================================================================" + if (-not $nooutput) + { Receive-Job -Job $docJob + } + Remove-Job -Job $docJob +} +if ($unit) +{ Write-Host -ForegroundColor DarkBlue "================================================================================" + if (-not $nooutput) + { Receive-Job -Job $unitJob + } + Remove-Job -Job $unitJob +} +if ($cov) +{ Write-Host -ForegroundColor DarkMagenta "================================================================================" + if (-not $nooutput) + { Receive-Job -Job $covJob + } + Remove-Job -Job $covJob + + if ($copycov) + { cp -Recurse -Force .\report\coverage\html\* .\doc\_build\html\coverage + Write-Host -ForegroundColor DarkMagenta "[post][COV] Copyed code coverage report to 'coverage' directory in HTML directory" + } +} +Write-Host -ForegroundColor DarkGreen "================================================================================" +Write-Host -ForegroundColor DarkGreen "[SCRIPT] Finished" diff --git a/setup.py b/setup.py index e52d55d7..88792c64 100644 --- a/setup.py +++ b/setup.py @@ -31,6 +31,7 @@ # """Package installer for 'An abstraction layer of EDA CLI tools'.""" from pathlib import Path +from setuptools import setup from pyTooling.Packaging import DescribePythonPackageHostedOnGitHub, DEFAULT_CLASSIFIERS gitHubNamespace = "edaa-org" @@ -38,13 +39,14 @@ packageDirectory = packageName.replace(".", "/") packageInformationFile = Path(f"{packageDirectory}/__init__.py") -DescribePythonPackageHostedOnGitHub( - packageName=packageName, - description="An abstraction layer of EDA CLI tools.", - gitHubNamespace=gitHubNamespace, - sourceFileWithVersion=packageInformationFile, - developmentStatus="beta", - classifiers=list(DEFAULT_CLASSIFIERS) + [ - "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)" - ] +setup(**DescribePythonPackageHostedOnGitHub( + packageName=packageName, + description="An abstraction layer of EDA CLI tools.", + gitHubNamespace=gitHubNamespace, + sourceFileWithVersion=packageInformationFile, + developmentStatus="beta", + classifiers=list(DEFAULT_CLASSIFIERS) + [ + "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)" + ] + ) ) diff --git a/tests/requirements.txt b/tests/requirements.txt index 352c0971..09ed3295 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -4,7 +4,7 @@ Coverage ~= 7.6 # Test Runner -pytest ~= 8.2 +pytest ~= 8.3 pytest-cov ~= 5.0 # Static Type Checking From 6a9c36660dc8b83d4865afcd1bbd302d81c50515 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 21 Jul 2024 22:13:23 +0200 Subject: [PATCH 22/48] Updated pipeline. --- .btd.yml | 8 -------- .github/workflows/Pipeline.yml | 11 ++++------- doc/conf.py | 2 +- tests/unit/requirements.txt | 1 + 4 files changed, 6 insertions(+), 16 deletions(-) delete mode 100644 .btd.yml create mode 100644 tests/unit/requirements.txt diff --git a/.btd.yml b/.btd.yml deleted file mode 100644 index e3509f78..00000000 --- a/.btd.yml +++ /dev/null @@ -1,8 +0,0 @@ -input: doc -output: _build -requirements: requirements.txt -target: gh-pages -formats: [ html ] -images: - base: btdi/sphinx:pytooling -theme: https://codeload.GitHub.com/buildthedocs/sphinx.theme/tar.gz/v1 diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 6a6906e9..8620439b 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -12,7 +12,6 @@ jobs: uses: pyTooling/Actions/.github/workflows/Parameters.yml@r1 with: name: pyEDAA.CLITool - python_version_list: "3.9 3.10 3.11 3.12 pypy-3.9 pypy-3.10" UnitTesting: uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@dev @@ -20,6 +19,7 @@ jobs: - UnitTestingParams with: jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }} + requirements: "-r tests/unit/requirements.txt" unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} coverage_sqlite_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }} @@ -59,8 +59,6 @@ jobs: - UnitTestingParams - UnitTesting with: -# coverage_sqlite_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }} -# coverage_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_xml }} coverage_json_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_json }} coverage_html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_html }} secrets: @@ -72,6 +70,7 @@ jobs: - UnitTestingParams - UnitTesting with: + additional_merge_args: '"--pytest=rewrite-dunder-init;reduce-depth:pytest.tests.unit" --render=tree' merged_junit_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} IntermediateCleanUp: @@ -101,7 +100,7 @@ jobs: # - VerifyDocs with: python_version: ${{ needs.UnitTestingParams.outputs.python_version }} - unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}-ubuntu-native-3.12 + unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} coverage_json_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_json }} html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_html }} latex_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_latex }} @@ -133,7 +132,6 @@ jobs: uses: pyTooling/Actions/.github/workflows/Release.yml@r1 if: startsWith(github.ref, 'refs/tags') needs: - - Package - PublishToGitHubPages PublishOnPyPI: @@ -156,11 +154,10 @@ jobs: - UnitTesting - StaticTypeCheck - HTMLDocumentation - - PDFDocumentation +# - PDFDocumentation - PublishTestResults - PublishCoverageResults - PublishToGitHubPages -# - PublishOnPyPI with: package: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }} remaining: | diff --git a/doc/conf.py b/doc/conf.py index 16050f4e..4a84a25c 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -279,7 +279,7 @@ report_doccov_packages = { "src": { "name": f"{project}", - "directory": f"../{project}", + "directory": f"../{project.replace('.', '/')}", "fail_below": 80, "levels": _coverageLevels } diff --git a/tests/unit/requirements.txt b/tests/unit/requirements.txt new file mode 100644 index 00000000..3c8d7e78 --- /dev/null +++ b/tests/unit/requirements.txt @@ -0,0 +1 @@ +-r ../requirements.txt From 3960c6297c053d94699446b300651099a6a09382 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 21 Jul 2024 22:24:14 +0200 Subject: [PATCH 23/48] Added news paragraph for 2024. --- dist/requirements.txt | 2 +- doc/index.rst | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dist/requirements.txt b/dist/requirements.txt index 5be2dd07..71950fcd 100644 --- a/dist/requirements.txt +++ b/dist/requirements.txt @@ -1,2 +1,2 @@ wheel ~= 0.43 -twine ~= 5.0 +twine ~= 5.1 diff --git a/doc/index.rst b/doc/index.rst index c95ce889..9ce46707 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -74,6 +74,18 @@ This layer is used by: News **** +.. only:: html + + July 2024 - General Updates + =========================== + +.. only:: latex + + .. rubric:: General Updates + +* Updated to support pyTooling v6.5. +* Replaced Sphinx theme with ReadTheDocs theme. + .. only:: html Feb. 2022 - Supporting more Tools From 96d950eb8b77e6735b2e8175cc829716ab2be180 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 21 Jul 2024 22:27:01 +0200 Subject: [PATCH 24/48] Bumped dependencies. --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 09ed3295..ea876b3c 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -9,5 +9,5 @@ pytest-cov ~= 5.0 # Static Type Checking mypy ~= 1.10 -typing_extensions ~= 4.11 +typing_extensions ~= 4.12 lxml ~= 5.2 From 648e9c6ef0a1ecbb7ff54d79a73c4e19ae95da0b Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Mon, 29 Jul 2024 23:21:57 +0200 Subject: [PATCH 25/48] Added missing documentation pages. --- doc/TODO.rst | 4 ++++ doc/_static/css/override.css | 25 ++++++++++++++----------- doc/unittests/index.rst | 7 +++++++ 3 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 doc/TODO.rst create mode 100644 doc/unittests/index.rst diff --git a/doc/TODO.rst b/doc/TODO.rst new file mode 100644 index 00000000..3144da04 --- /dev/null +++ b/doc/TODO.rst @@ -0,0 +1,4 @@ +TODOs +##### + +.. todolist:: diff --git a/doc/_static/css/override.css b/doc/_static/css/override.css index 7e82b57a..4dd6beb5 100644 --- a/doc/_static/css/override.css +++ b/doc/_static/css/override.css @@ -18,6 +18,20 @@ margin-bottom: 6px } +.rst-content .topic-title { + font-size: larger; + font-weight: 700; + margin-top: 18px; + margin-bottom: 6px; +} + +.rst-content p.rubric { + text-decoration: underline; + font-weight: 700; + margin-top: 18px; + margin-bottom: 16px; +} + /* general overrides */ html { font-size: 15px; @@ -39,17 +53,6 @@ section > p, text-align: justify } -.rst-content .topic-title { - font-size: larger; - font-weight: 700; - margin-top: 18px; - margin-bottom: 6px; -} - -p.rubric { - text-decoration: underline -} - /* wyrm overrides */ .wy-menu-vertical header, .wy-menu-vertical p.caption { diff --git a/doc/unittests/index.rst b/doc/unittests/index.rst new file mode 100644 index 00000000..8b840ee6 --- /dev/null +++ b/doc/unittests/index.rst @@ -0,0 +1,7 @@ +Unittest Summary Report +####################### + +Unittest report generated with `pytest `__. + +.. report:unittest-summary:: + :reportid: src From 9ac6addf19e3152c37db553dc7f125c713bf578c Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 30 Jul 2024 00:30:32 +0200 Subject: [PATCH 26/48] Install ghdl mock --- .github/workflows/Pipeline.yml | 2 + tests/mock/ghdl | 204 +++++++++++++++++++++++++++++++++ tests/unit/GHDL.py | 36 +++--- 3 files changed, 224 insertions(+), 18 deletions(-) create mode 100644 tests/mock/ghdl diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 8620439b..22fb2f18 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -19,6 +19,8 @@ jobs: - UnitTestingParams with: jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }} + ubuntu_before_script: | + sudo install -m 755 tests/mock/ghdl /usr/local/bin requirements: "-r tests/unit/requirements.txt" unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} coverage_sqlite_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }} diff --git a/tests/mock/ghdl b/tests/mock/ghdl new file mode 100644 index 00000000..466491ab --- /dev/null +++ b/tests/mock/ghdl @@ -0,0 +1,204 @@ +#! /bin/bash + +ANSI_BLACK="\e[30m" +ANSI_RED="\e[31m" +ANSI_GREEN="\e[32m" +ANSI_YELLOW="\e[33m" +ANSI_BLUE="\e[34m" +ANSI_MAGENTA="\e[35m" +ANSI_CYAN="\e[36m" +ANSI_DARK_GRAY="\e[90m" +ANSI_LIGHT_GRAY="\e[37m" +ANSI_LIGHT_RED="\e[91m" +ANSI_LIGHT_GREEN="\e[92m" +ANSI_LIGHT_YELLOW="\e[93m" +ANSI_LIGHT_BLUE="\e[94m" +ANSI_LIGHT_MAGENTA="\e[95m" +ANSI_LIGHT_CYAN="\e[96m" +ANSI_WHITE="\e[97m" +ANSI_NOCOLOR="\e[0m" + +# red texts +COLORED_ERROR="${ANSI_RED}[ERROR]" +COLORED_FAILED="${ANSI_RED}[FAILED]${ANSI_NOCOLOR}" + +# yellow texts +COLORED_WARNING="${ANSI_YELLOW}[WARNING]" + +# green texts +COLORED_PASSED="${ANSI_GREEN}[PASSED]${ANSI_NOCOLOR}" +COLORED_DONE="${ANSI_GREEN}[DONE]${ANSI_NOCOLOR}" +COLORED_SUCCESSFUL="${ANSI_GREEN}[SUCCESSFUL]${ANSI_NOCOLOR}" + +case "$(uname -s)" in + Linux*) + MACHINE=Linux + GHDL_PATH="/usr/bin/ghdl" + ;; + Darwin*) + MACHINE=Mac + ;; + MINGW*) + MACHINE=MinGw + if [[ "$MSYSTEM" == "MINGW64" ]]; then + MSYS_GHDL_PATH="/mingw64/bin/ghdl" + GHDL_PATH="C:\msys64\mingw64\bin\ghdl.exe" + elif [[ "$MSYSTEM" == "UCRT64" ]]; then + MSYS_GHDL_PATH="/ucrt64/bin/ghdl" + GHDL_PATH="C:\msys64\ucrt64\bin\ghdl.exe" + fi + ;; + CYGWIN*) + MACHINE=Cygwin + ;; + *) + MACHINE="UNKNOWN:$(uname -s)" +esac + + +if [[ "$#" -eq 0 ]]; then + echo "${GHDL_PATH}:error: missing command, try ${GHDL_PATH} 'help'" + exit 1 +fi + +while [[ "$#" -gt 0 ]]; do + case "$1" in + -h|--help|help) + echo "usage: ${GHDL_PATH} COMMAND [OPTIONS] ..." + echo "COMMAND is one of:" + echo "analyze [OPTS] FILEs" + echo " Analyze one or multiple VHDL files" + echo " aliases: -a, analyse" + echo "elaborate [OPTS] UNIT [ARCH]" + echo " Elaborate design UNIT" + echo " alias: -e" + echo "run UNIT [ARCH] [RUNOPTS]" + echo " Run design UNIT" + echo " alias: -r" + echo "elab-run [OPTS] UNIT [ARCH] [RUNOPTS]" + echo " Elaborate and run design UNIT" + echo " alias: --elab-run" + echo "help [CMD]" + echo " Display this help or [help on CMD]" + echo " aliases: -h, --help" + echo "version" + echo " Display ghdl version" + echo " aliases: -v, --version" + echo "help-options" + echo " Display help for analyzer options" + echo " alias: --help-options, opts-help, --options-help" + echo "help-warnings" + echo " Display help about all the warnings" + echo " alias: --help-warnings" + echo "" + echo "To display the options of a GHDL program," + echo " run your program with the 'help' option." + echo "Also see 'opts-help' for analyzer options." + echo "" + echo "Please, refer to the GHDL manual for more information." + echo "Report issues on https://github.com/ghdl/ghdl" + exit 0 + ;; + -v|--version|version) + echo "GHDL 4.1.0 (tarball) [Dunoon edition]" + echo " Compiled with GNAT Version: 14.1.0" + echo " llvm 18.1.4 code generator" + echo "Written by Tristan Gingold." + echo "" + echo "Copyright (C) 2003 - 2024 Tristan Gingold." + echo "GHDL is free software, covered by the GNU General Public License. There is NO" + echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit 0 + ;; + -a|analyze|analyse) + while [[ "$#" -gt 0 ]]; do + case "$1" in + --std=*) + ;; + --work=*) + ;; + -P*) + ;; + -fsynopsys) + ;; + -frelaxed|-frelaxed-rules) + ;; + -fexplicit) + ;; + -v) + ;; + -C|--mb-comments) + ;; + *) + ;; + esac + shift # parsed argument or value + done + + exit 0 + ;; + -e|elaborate) + while [[ "$#" -gt 0 ]]; do + case "$1" in + --std=*) + ;; + --work=*) + ;; + -P*) + ;; + -fsynopsys) + ;; + -frelaxed|-frelaxed-rules) + ;; + -fexplicit) + ;; + --syn-binding) + ;; + -v) + ;; + *) + ;; + esac + shift # parsed argument or value + done + + exit 0 + ;; + -r|run) + while [[ "$#" -gt 0 ]]; do + case "$1" in + --std=*) + ;; + --work=*) + ;; + -P*) + ;; + -fsynopsys) + ;; + -frelaxed|-frelaxed-rules) + ;; + -fexplicit) + ;; + -v) + ;; + *) + ;; + esac + shift # parsed argument or value + done + + exit 0 + ;; + --elab-run|elab-run) + ;; +# --ghdl) +# GHDL="$2" # overwrite a potentially existing GHDL environment variable +# shift # skip argument +# ;; + *) # unknown option + echo 1>&2 -e "\n${COLORED_ERROR} Unknown command line option '$1'.${ANSI_NOCOLOR}" + exit 127 + ;; + esac + shift # parsed argument or value +done diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index d434c17b..7c48e1b6 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -42,24 +42,24 @@ class GHDLTestcases(TestCase, Helper): _libraryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")).resolve() _binaryDirectoryPath = (Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")) / "../../bin").resolve() - @classmethod - def setUpClass(cls) -> None: - # print(f"\nPlatform: {sys_platform}") - if sys_platform in ("linux", "darwin"): - # if not cls._libraryDirectoryPath.exists(): - # print(f"Creating lib/ghdl directory '{cls._libraryDirectoryPath}': ", end="") - # cls._libraryDirectoryPath.mkdir(parents=True) - # print(f"DONE" if cls._libraryDirectoryPath.exists() and cls._libraryDirectoryPath.is_dir() else f"FAILED") - # - # if not cls._binaryDirectoryPath.exists(): - # print(f"Creating bin directory '{cls._binaryDirectoryPath}': ", end="") - # cls._binaryDirectoryPath.mkdir(parents=True) - # print(f"DONE" if cls._binaryDirectoryPath.exists() and cls._binaryDirectoryPath.is_dir() else f"FAILED") - - ghdlBinaryPath: Path = cls._binaryDirectoryPath / "ghdl" - print(f"Creating dummy file '{ghdlBinaryPath}': ", end="") - ghdlBinaryPath.touch() - print(f"DONE" if ghdlBinaryPath.exists() and ghdlBinaryPath.is_file() else f"FAILED") + # @classmethod + # def setUpClass(cls) -> None: + # # print(f"\nPlatform: {sys_platform}") + # if sys_platform in ("linux", "darwin"): + # # if not cls._libraryDirectoryPath.exists(): + # # print(f"Creating lib/ghdl directory '{cls._libraryDirectoryPath}': ", end="") + # # cls._libraryDirectoryPath.mkdir(parents=True) + # # print(f"DONE" if cls._libraryDirectoryPath.exists() and cls._libraryDirectoryPath.is_dir() else f"FAILED") + # # + # # if not cls._binaryDirectoryPath.exists(): + # # print(f"Creating bin directory '{cls._binaryDirectoryPath}': ", end="") + # # cls._binaryDirectoryPath.mkdir(parents=True) + # # print(f"DONE" if cls._binaryDirectoryPath.exists() and cls._binaryDirectoryPath.is_dir() else f"FAILED") + # + # ghdlBinaryPath: Path = cls._binaryDirectoryPath / "ghdl" + # print(f"Creating dummy file '{ghdlBinaryPath}': ", end="") + # ghdlBinaryPath.touch() + # print(f"DONE" if ghdlBinaryPath.exists() and ghdlBinaryPath.is_file() else f"FAILED") class CommonOptions(GHDLTestcases): From 0e7b52a78f5a3bc351e65e6201045ad624357d2e Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 30 Jul 2024 01:17:12 +0200 Subject: [PATCH 27/48] Improved GHDL regexp. --- pyEDAA/CLITool/GHDL.py | 33 ++++++++++++++++++--------------- tests/unit/GHDL.py | 20 -------------------- 2 files changed, 18 insertions(+), 35 deletions(-) diff --git a/pyEDAA/CLITool/GHDL.py b/pyEDAA/CLITool/GHDL.py index 92522be6..7963efd5 100644 --- a/pyEDAA/CLITool/GHDL.py +++ b/pyEDAA/CLITool/GHDL.py @@ -64,19 +64,16 @@ class GHDLVersion(metaclass=ExtendedType, slots=True): def __init__(self, versionLine: str, gnatLine: str, backendLine: str): match = re_search( r"GHDL" - r"\s(?P\d+)" - r"\.(?P\d+)" - r"\.(?P\d+)" - r"(?:-(?Pdev))?" - r"\s\(" - r"(?P\d+)" - r"\.(?P\d+)" - r"\.(?P\d+)" - r"\.(?:r(?P\d+))" - r"\.(?:g(?P[0-9a-f]+))" - r"(?:\.(?Pdirty))?" - r"\)\s" - r"\[(?P[\w\s]+)\]", + r"\s(?P\d+)\.(?P\d+)\.(?P\d+)" + r"(?:" + r"(?:" + r"\s\((?Ptarball)\)" + r")|(?:" + r"(?:-(?Pdev|rc\d+))?" + r"\s\((?P\d+)\.(?P\d+)\.(?P\d+)\.(?:r(?P\d+))\.(?:g(?P[0-9a-f]+))(?:\.(?Pdirty))?\)" + r")" + r")" + r"\s\[(?P[\w\s]+)\]", versionLine) if match is None: @@ -85,8 +82,14 @@ def __init__(self, versionLine: str, gnatLine: str, backendLine: str): self._major = int(match["major"]) self._minor = int(match["minor"]) self._micro = int(match["micro"]) - self._dev = "dev" in match.groups() - self._commitsSinceLastTag = int(match["cslt"]) + if (suffix := match["suffix"]) is not None: + self._dev = suffix == "dev" + else: + self._dev = False + if (cslt := match["cslt"]) is not None: + self._commitsSinceLastTag = int(cslt) + else: + self._commitsSinceLastTag = 0 self._gitHash = match["hash"] self._dirty = "dirty" in match.groups() self._edition = match["edition"] diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index 7c48e1b6..5c78a1c0 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -29,7 +29,6 @@ # ==================================================================================================================== # # """Unit tests for executable ``ghdl``.""" -from sys import platform as sys_platform from os import getenv as os_getenv from pathlib import Path from unittest import TestCase @@ -42,25 +41,6 @@ class GHDLTestcases(TestCase, Helper): _libraryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")).resolve() _binaryDirectoryPath = (Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")) / "../../bin").resolve() - # @classmethod - # def setUpClass(cls) -> None: - # # print(f"\nPlatform: {sys_platform}") - # if sys_platform in ("linux", "darwin"): - # # if not cls._libraryDirectoryPath.exists(): - # # print(f"Creating lib/ghdl directory '{cls._libraryDirectoryPath}': ", end="") - # # cls._libraryDirectoryPath.mkdir(parents=True) - # # print(f"DONE" if cls._libraryDirectoryPath.exists() and cls._libraryDirectoryPath.is_dir() else f"FAILED") - # # - # # if not cls._binaryDirectoryPath.exists(): - # # print(f"Creating bin directory '{cls._binaryDirectoryPath}': ", end="") - # # cls._binaryDirectoryPath.mkdir(parents=True) - # # print(f"DONE" if cls._binaryDirectoryPath.exists() and cls._binaryDirectoryPath.is_dir() else f"FAILED") - # - # ghdlBinaryPath: Path = cls._binaryDirectoryPath / "ghdl" - # print(f"Creating dummy file '{ghdlBinaryPath}': ", end="") - # ghdlBinaryPath.touch() - # print(f"DONE" if ghdlBinaryPath.exists() and ghdlBinaryPath.is_file() else f"FAILED") - class CommonOptions(GHDLTestcases): def test_Help(self) -> None: From b8f0b30324d29d8b83cb2c140ff41a414f903ace Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 30 Jul 2024 01:29:32 +0200 Subject: [PATCH 28/48] Workaround \ vs. / problem. --- tests/unit/GHDL.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index 5c78a1c0..d57d8a6a 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -110,7 +110,7 @@ def test_AnalyzeFaultyFile(self) -> None: tool[tool.OptionPaths] = (Path("project/designB/file_B1.vhdl"), ) executable = self.getExecutablePath("ghdl", self._binaryDirectoryPath) - self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\", \"project\\designB\\file_B1.vhdl\"]", repr(tool)) + self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\", \"project/designB/file_B1.vhdl\"]", repr(tool)) tool.StartProcess() for line in tool.GetLineReader(): From 0b4e05e79ad68e50fb1a74170fa860006c5de87b Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 30 Jul 2024 01:37:08 +0200 Subject: [PATCH 29/48] Trying GHDL-mcode on Ubuntu. --- .github/workflows/Pipeline.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 22fb2f18..c61d4ae0 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -19,8 +19,9 @@ jobs: - UnitTestingParams with: jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }} - ubuntu_before_script: | - sudo install -m 755 tests/mock/ghdl /usr/local/bin + apt: ghdl-mcode + ubuntu_before_script: which ghdl +# ubuntu_before_script: sudo install -m 755 tests/mock/ghdl /usr/local/bin requirements: "-r tests/unit/requirements.txt" unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} coverage_sqlite_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }} From 793111fe7540f17fec8f2f7e5c959c3c495c3410 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 30 Jul 2024 01:52:32 +0200 Subject: [PATCH 30/48] Trying GHDL-mcode on macOS. --- .github/workflows/Pipeline.yml | 2 ++ tests/unit/GHDL.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index c61d4ae0..8beefbae 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -20,7 +20,9 @@ jobs: with: jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }} apt: ghdl-mcode + brew: ghdl ubuntu_before_script: which ghdl + macos_before_script: which ghdl # ubuntu_before_script: sudo install -m 755 tests/mock/ghdl /usr/local/bin requirements: "-r tests/unit/requirements.txt" unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index d57d8a6a..ea2a19df 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -38,8 +38,8 @@ class GHDLTestcases(TestCase, Helper): - _libraryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")).resolve() - _binaryDirectoryPath = (Path(os_getenv("GHDL_PREFIX", default="/usr/local/lib/ghdl")) / "../../bin").resolve() + _libraryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/lib/ghdl")).resolve() + _binaryDirectoryPath = (Path(os_getenv("GHDL_PREFIX", default="/usr/lib/ghdl")) / "../../bin").resolve() class CommonOptions(GHDLTestcases): From eb9751081be2d4d8785ddf3aa8ebc4d255d8ce4f Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 30 Jul 2024 02:11:03 +0200 Subject: [PATCH 31/48] Adjusted binary paths for macOS. --- .github/workflows/Pipeline.yml | 8 ++++++-- tests/unit/GHDL.py | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 8beefbae..6722cb40 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -21,8 +21,12 @@ jobs: jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }} apt: ghdl-mcode brew: ghdl - ubuntu_before_script: which ghdl - macos_before_script: which ghdl + ubuntu_before_script: | + which ghdl + ghdl version + macos_before_script: | + which ghdl + ghdl version # ubuntu_before_script: sudo install -m 755 tests/mock/ghdl /usr/local/bin requirements: "-r tests/unit/requirements.txt" unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index ea2a19df..5251845b 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -33,13 +33,15 @@ from pathlib import Path from unittest import TestCase +from pyTooling.Platform import CurrentPlatform + from pyEDAA.CLITool.GHDL import GHDL from . import Helper class GHDLTestcases(TestCase, Helper): - _libraryDirectoryPath = Path(os_getenv("GHDL_PREFIX", default="/usr/lib/ghdl")).resolve() - _binaryDirectoryPath = (Path(os_getenv("GHDL_PREFIX", default="/usr/lib/ghdl")) / "../../bin").resolve() + _libraryDirectoryPath = (Path(os_getenv("GHDL_PREFIX", default="/usr/lib/ghdl" if not CurrentPlatform.IsNativeMacOS else "/opt/homebrew/lib/ghdl")) / "../").resolve() + _binaryDirectoryPath = (Path(os_getenv("GHDL_PREFIX", default="/usr/lib/ghdl" if not CurrentPlatform.IsNativeMacOS else "/opt/homebrew/lib/ghdl")) / "../../bin").resolve() class CommonOptions(GHDLTestcases): From 6f2792c00c960d788627a24adec41bc3189762f4 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 30 Jul 2024 02:18:58 +0200 Subject: [PATCH 32/48] Upgrade to Ubuntu 2024.04. --- .github/workflows/Pipeline.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 6722cb40..8ecb7284 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -9,7 +9,7 @@ on: jobs: UnitTestingParams: - uses: pyTooling/Actions/.github/workflows/Parameters.yml@r1 + uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev with: name: pyEDAA.CLITool @@ -33,7 +33,7 @@ jobs: coverage_sqlite_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }} StaticTypeCheck: - uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r1 + uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@dev needs: - UnitTestingParams with: @@ -54,7 +54,7 @@ jobs: fail_under: 75 Package: - uses: pyTooling/Actions/.github/workflows/Package.yml@r1 + uses: pyTooling/Actions/.github/workflows/Package.yml@dev needs: - UnitTestingParams - UnitTesting @@ -63,7 +63,7 @@ jobs: artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).package_all }} PublishCoverageResults: - uses: pyTooling/Actions/.github/workflows/PublishCoverageResults.yml@r1 + uses: pyTooling/Actions/.github/workflows/PublishCoverageResults.yml@dev needs: - UnitTestingParams - UnitTesting @@ -83,7 +83,7 @@ jobs: merged_junit_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} IntermediateCleanUp: - uses: pyTooling/Actions/.github/workflows/IntermediateCleanUp.yml@r1 + uses: pyTooling/Actions/.github/workflows/IntermediateCleanUp.yml@dev needs: - UnitTestingParams - PublishCoverageResults @@ -94,14 +94,14 @@ jobs: xml_unittest_artifacts_prefix: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}- # VerifyDocs: -# uses: pyTooling/Actions/.github/workflows/VerifyDocs.yml@r1 +# uses: pyTooling/Actions/.github/workflows/VerifyDocs.yml@dev # needs: # - UnitTestingParams # with: # python_version: ${{ needs.UnitTestingParams.outputs.python_version }} HTMLDocumentation: - uses: pyTooling/Actions/.github/workflows/SphinxDocumentation.yml@r1 + uses: pyTooling/Actions/.github/workflows/SphinxDocumentation.yml@dev needs: - UnitTestingParams - PublishTestResults @@ -115,7 +115,7 @@ jobs: latex_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_latex }} PDFDocumentation: - uses: pyTooling/Actions/.github/workflows/LaTeXDocumentation.yml@r1 + uses: pyTooling/Actions/.github/workflows/LaTeXDocumentation.yml@dev needs: - UnitTestingParams - HTMLDocumentation @@ -125,7 +125,7 @@ jobs: pdf_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_pdf }} PublishToGitHubPages: - uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@r1 + uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@dev needs: - UnitTestingParams - HTMLDocumentation @@ -138,13 +138,13 @@ jobs: typing: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }} ReleasePage: - uses: pyTooling/Actions/.github/workflows/Release.yml@r1 + uses: pyTooling/Actions/.github/workflows/Release.yml@dev if: startsWith(github.ref, 'refs/tags') needs: - PublishToGitHubPages PublishOnPyPI: - uses: pyTooling/Actions/.github/workflows/PublishOnPyPI.yml@r1 + uses: pyTooling/Actions/.github/workflows/PublishOnPyPI.yml@dev if: startsWith(github.ref, 'refs/tags') needs: - UnitTestingParams @@ -157,7 +157,7 @@ jobs: PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} ArtifactCleanUp: - uses: pyTooling/Actions/.github/workflows/ArtifactCleanUp.yml@r1 + uses: pyTooling/Actions/.github/workflows/ArtifactCleanUp.yml@dev needs: - UnitTestingParams - UnitTesting From 10593ec620144edbf9e17dbe2977db3c7b283f34 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 30 Jul 2024 08:26:23 +0200 Subject: [PATCH 33/48] Handle GHDL version from Ubuntu. --- pyEDAA/CLITool/GHDL.py | 64 ++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/pyEDAA/CLITool/GHDL.py b/pyEDAA/CLITool/GHDL.py index 7963efd5..a6751efe 100644 --- a/pyEDAA/CLITool/GHDL.py +++ b/pyEDAA/CLITool/GHDL.py @@ -61,28 +61,39 @@ class GHDLVersion(metaclass=ExtendedType, slots=True): _gnatCompiler: Tuple[int, int, int] _backend: str - def __init__(self, versionLine: str, gnatLine: str, backendLine: str): - match = re_search( - r"GHDL" - r"\s(?P\d+)\.(?P\d+)\.(?P\d+)" + VERSION_LINE_PATTERN = ( + r"GHDL" + r"\s(?P\d+)\.(?P\d+)\.(?P\d+)(?:-(?Pdev|rc\d+))?" + r"\s\((?:" r"(?:" - r"(?:" - r"\s\((?Ptarball)\)" - r")|(?:" - r"(?:-(?Pdev|rc\d+))?" - r"\s\((?P\d+)\.(?P\d+)\.(?P\d+)\.(?:r(?P\d+))\.(?:g(?P[0-9a-f]+))(?:\.(?Pdirty))?\)" - r")" + r"(?Ptarball)" + r")|(?:" + r"(?P\d+)\.(?P\d+)\.(?P\d+)\.(?:r(?P\d+))\.(?:g(?P[0-9a-f]+))(?:\.(?Pdirty))?" + r")|(?:" + r"Ubuntu\s(?P\d+)\.(?P\d+)\.(?P\d+)\+dfsg-(?P\d+)ubuntu(?P\d+)" r")" - r"\s\[(?P[\w\s]+)\]", - versionLine) + r")\)" + r"\s\[(?P[\w\s]+)\]" + ) + GNAT_LINE_PATTERN = ( + r"\s*[\w\s]+:\s" + r"(?:" + r"(?:(?P\d+)\.(?P\d+)\.(?P\d+))" + r"|" + r"(?:Community\s(?P\d{4})\s\((?P\d{8}-\d{2})\))" + r")" + ) + BACKEND_LINE_PATTERN = r"\s*(?P\w+)\scode\sgenerator" + def __init__(self, versionLine: str, gnatLine: str, backendLine: str): + match = re_search("^" + self.VERSION_LINE_PATTERN + "$", versionLine) if match is None: raise CLIToolException(f"Unknown first GHDL version string '{versionLine}'.") - self._major = int(match["major"]) - self._minor = int(match["minor"]) - self._micro = int(match["micro"]) - if (suffix := match["suffix"]) is not None: + self._major = int(match["Major"]) + self._minor = int(match["Minor"]) + self._micro = int(match["Micro"]) + if (suffix := match["Suffix"]) is not None: self._dev = suffix == "dev" else: self._dev = False @@ -90,25 +101,24 @@ def __init__(self, versionLine: str, gnatLine: str, backendLine: str): self._commitsSinceLastTag = int(cslt) else: self._commitsSinceLastTag = 0 - self._gitHash = match["hash"] - self._dirty = "dirty" in match.groups() - self._edition = match["edition"] - - match = re_search( - r"\s*[\w\s]+:\s(?P\d+)\.(?P\d+)\.(?P\d+)", gnatLine) + self._gitHash = match["Hash"] + self._dirty = "Dirty" in match.groups() + self._edition = match["Edition"] + match = re_search("^" + self.GNAT_LINE_PATTERN + "$", versionLine) if match is None: raise CLIToolException(f"Unknown second GHDL version string '{gnatLine}'.") - self._gnatCompiler = (int(match["major"]), int(match["minor"]), int(match["micro"])) - - match = re_search( - r"\s*(?P\w+)\scode\sgenerator", backendLine) + if match["Year"] is None: + self._gnatCompiler = (int(match["Major"]), int(match["Minor"]), int(match["Micro"])) + else: + self._gnatCompiler = (int(match["Year"]), 0, 0) + match = re_search("^" + self.BACKEND_LINE_PATTERN + "$", versionLine) if match is None: raise CLIToolException(f"Unknown third GHDL version string '{backendLine}'.") - self._backend = match["backend"] + self._backend = match["Backend"] @property def Major(self) -> int: From ae54242a7edbda20c95286c6194ee02a59694a7f Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 30 Jul 2024 10:18:15 +0200 Subject: [PATCH 34/48] Fixed paths. --- tests/unit/GHDL.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index 5251845b..be85a1f4 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -109,10 +109,10 @@ def test_AnalyzeFaultyFile(self) -> None: tool = self._GetAnalyzer() tool[tool.CommandAnalyze] = True tool[tool.FlagLibrary] = "lib_Test" - tool[tool.OptionPaths] = (Path("project/designB/file_B1.vhdl"), ) + tool[tool.OptionPaths] = (Path("tests/project/designB/file_B1.vhdl"), ) executable = self.getExecutablePath("ghdl", self._binaryDirectoryPath) - self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\", \"project/designB/file_B1.vhdl\"]", repr(tool)) + self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\", \"tests/project/designB/file_B1.vhdl\"]", repr(tool)) tool.StartProcess() for line in tool.GetLineReader(): @@ -125,12 +125,12 @@ def test_AnalyzeSingleFiles(self) -> None: print() libraryFiles = ( - Path("project/lib/file_P1.vhdl"), - Path("project/lib/file_P2.vhdl"), + Path("tests/project/lib/file_P1.vhdl"), + Path("tests/project/lib/file_P2.vhdl"), ) designFiles = ( - Path("project/designA/file_A1.vhdl"), - Path("project/designA/file_A2.vhdl"), + Path("tests/project/designA/file_A1.vhdl"), + Path("tests/project/designA/file_A2.vhdl"), ) analyzer = self._GetAnalyzer() @@ -160,12 +160,12 @@ def test_AnalyzeMultipleFiles(self) -> None: print() libraryFiles = ( - Path("project/lib/file_P1.vhdl"), - Path("project/lib/file_P2.vhdl"), + Path("tests/project/lib/file_P1.vhdl"), + Path("tests/project/lib/file_P2.vhdl"), ) designFiles = ( - Path("project/designA/file_A1.vhdl"), - Path("project/designA/file_A2.vhdl"), + Path("tests/project/designA/file_A1.vhdl"), + Path("tests/project/designA/file_A2.vhdl"), ) analyzer = self._GetAnalyzer() From b02444843f74a512b02ff26fb0cabf0889fae37e Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 30 Jul 2024 10:47:10 +0200 Subject: [PATCH 35/48] Install GHDL in MinGW64 and UCRT64. --- .github/workflows/Pipeline.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 8ecb7284..379c6c9e 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -21,12 +21,19 @@ jobs: jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }} apt: ghdl-mcode brew: ghdl + pacboy: ghdl ubuntu_before_script: | which ghdl ghdl version macos_before_script: | which ghdl ghdl version + mingw64_before_script: | + which ghdl + ghdl version + ucrt64_before_script: | + which ghdl + ghdl version # ubuntu_before_script: sudo install -m 755 tests/mock/ghdl /usr/local/bin requirements: "-r tests/unit/requirements.txt" unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} From a8493e1e7c70508fecb3d69160876ca5b113feb2 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 30 Jul 2024 19:20:40 +0200 Subject: [PATCH 36/48] Improved regexp for GHDL version, backend, etc.. --- pyEDAA/CLITool/GHDL.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pyEDAA/CLITool/GHDL.py b/pyEDAA/CLITool/GHDL.py index a6751efe..e22ea768 100644 --- a/pyEDAA/CLITool/GHDL.py +++ b/pyEDAA/CLITool/GHDL.py @@ -83,7 +83,14 @@ class GHDLVersion(metaclass=ExtendedType, slots=True): r"(?:Community\s(?P\d{4})\s\((?P\d{8}-\d{2})\))" r")" ) - BACKEND_LINE_PATTERN = r"\s*(?P\w+)\scode\sgenerator" + BACKEND_LINE_PATTERN = ( + r"\s*" + r"(?:static elaboration, )?" + r"(?Pllvm|mcode|gcc)" + r"(?: (?P\d+)\.(?P\d+)\.(?P\d+))?" + r"(?: JIT)?" + r" code generator" + ) def __init__(self, versionLine: str, gnatLine: str, backendLine: str): match = re_search("^" + self.VERSION_LINE_PATTERN + "$", versionLine) @@ -105,7 +112,7 @@ def __init__(self, versionLine: str, gnatLine: str, backendLine: str): self._dirty = "Dirty" in match.groups() self._edition = match["Edition"] - match = re_search("^" + self.GNAT_LINE_PATTERN + "$", versionLine) + match = re_search("^" + self.GNAT_LINE_PATTERN + "$", gnatLine) if match is None: raise CLIToolException(f"Unknown second GHDL version string '{gnatLine}'.") @@ -114,7 +121,7 @@ def __init__(self, versionLine: str, gnatLine: str, backendLine: str): else: self._gnatCompiler = (int(match["Year"]), 0, 0) - match = re_search("^" + self.BACKEND_LINE_PATTERN + "$", versionLine) + match = re_search("^" + self.BACKEND_LINE_PATTERN + "$", backendLine) if match is None: raise CLIToolException(f"Unknown third GHDL version string '{backendLine}'.") From 10af22f7267b6f20b36c526bb020c3417c797569 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 30 Jul 2024 19:26:05 +0200 Subject: [PATCH 37/48] Add missing llvm on macOS. --- .github/workflows/Pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 379c6c9e..b624237f 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -20,7 +20,7 @@ jobs: with: jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }} apt: ghdl-mcode - brew: ghdl + brew: ghdl llvm pacboy: ghdl ubuntu_before_script: | which ghdl From 6cb6521bf08245c08a5d09608fc1c03e45c76ce4 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 30 Jul 2024 20:15:30 +0200 Subject: [PATCH 38/48] Debug LLVM@15. --- .github/workflows/Pipeline.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index b624237f..89306312 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -20,7 +20,7 @@ jobs: with: jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }} apt: ghdl-mcode - brew: ghdl llvm + brew: --cask ghdl pacboy: ghdl ubuntu_before_script: | which ghdl @@ -28,6 +28,12 @@ jobs: macos_before_script: | which ghdl ghdl version + echo $(brew --prefix llvm@15) + export DYLD_LIBRARY_PATH=$(brew --prefix llvm@15)/lib + echo -$DYLD_LIBRARY_PATH- + echo "----" + ls $(brew --prefix llvm@15)/lib +# ls /usr/local/opt/llvm@15/lib || true mingw64_before_script: | which ghdl ghdl version From 29d8735dbb18122d6364d835b4909ac4140da989 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Thu, 1 Aug 2024 11:20:54 +0200 Subject: [PATCH 39/48] Fixed reference in documentation. --- doc/Installation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/Installation.rst b/doc/Installation.rst index b7269db2..6754e22b 100644 --- a/doc/Installation.rst +++ b/doc/Installation.rst @@ -1,7 +1,7 @@ -.. _INSTALL: - .. |PackageName| replace:: pyEDAA.CLITool +.. _INSTALL: + Installation/Updates #################### From dde522c64911126d809f87eee31aae8009fa1a62 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Fri, 2 Aug 2024 07:42:30 +0200 Subject: [PATCH 40/48] Enhanced PR template. --- .github/pull_request_template.md | 18 ++++++++++++++++-- .github/workflows/Pipeline.yml | 1 - doc/Dependency.rst | 4 ++-- pyproject.toml | 2 +- tests/requirements.txt | 2 +- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ac698f89..4ed2d900 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,16 +1,30 @@ # New Features - + +* tbd * tbd # Changes +* tbd * tbd # Bug Fixes +* tbd +* tbd + +# Documentation + +* tbd +* tbd + +# Unit Tests + +* tbd * tbd ---------- -# Related PRs: +# Related Issues and Pull-Requests * tbd +* tbd diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 89306312..3026ea5b 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -33,7 +33,6 @@ jobs: echo -$DYLD_LIBRARY_PATH- echo "----" ls $(brew --prefix llvm@15)/lib -# ls /usr/local/opt/llvm@15/lib || true mingw64_before_script: | which ghdl ghdl version diff --git a/doc/Dependency.rst b/doc/Dependency.rst index 863242f0..f002729f 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -104,7 +104,7 @@ the mandatory dependencies too. +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `Coverage `__ | ≥7.6 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `mypy `__ | ≥1.10 | `MIT `__ | *Not yet evaluated.* | +| `mypy `__ | ≥1.11 | `MIT `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `typing-extensions `__ | ≥4.12 | `PSF-2.0 `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ @@ -151,7 +151,7 @@ the mandatory dependencies too. +=================================================================================================+==============+==========================================================================================================+======================================================================================================================================================+ | `pyTooling `__ | ≥6.5 | `Apache License, 2.0 `__ | *None* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `Sphinx `__ | ≥7.4.0 | `BSD 3-Clause `__ | *Not yet evaluated.* | +| `Sphinx `__ | ≥8.0 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `sphinxcontrib-mermaid `__ | ≥0.9.2 | `BSD `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/pyproject.toml b/pyproject.toml index 5c8d0754..9c233e91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "setuptools ~= 71.1", + "setuptools ~= 72.1", "wheel ~= 0.43", "pyTooling ~= 6.5" ] diff --git a/tests/requirements.txt b/tests/requirements.txt index ea876b3c..b7fdbd9a 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -8,6 +8,6 @@ pytest ~= 8.3 pytest-cov ~= 5.0 # Static Type Checking -mypy ~= 1.10 +mypy ~= 1.11 typing_extensions ~= 4.12 lxml ~= 5.2 From 10ca572c1eb2ca599d17c2bf5a650b3a8d440722 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Fri, 2 Aug 2024 20:56:08 +0200 Subject: [PATCH 41/48] Set DYLD_LIBRARY_PATH environment variable via $GITHUB_ENV, so it's exported to other steps. --- .github/workflows/Pipeline.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 3026ea5b..b28a0f96 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -31,6 +31,7 @@ jobs: echo $(brew --prefix llvm@15) export DYLD_LIBRARY_PATH=$(brew --prefix llvm@15)/lib echo -$DYLD_LIBRARY_PATH- + echo "DYLD_LIBRARY_PATH=$(brew --prefix llvm@15)/lib" >> $GITHUB_ENV echo "----" ls $(brew --prefix llvm@15)/lib mingw64_before_script: | From e8d05444d9b7802175f086c9a524d40be71ea493 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 3 Aug 2024 07:01:08 +0200 Subject: [PATCH 42/48] Using GHDL_PREFIX. --- .github/workflows/Pipeline.yml | 13 ++++++++++++- tests/unit/GHDL.py | 5 +---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index b28a0f96..02b55d95 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -25,21 +25,32 @@ jobs: ubuntu_before_script: | which ghdl ghdl version - macos_before_script: | + echo "GHDL_PREFIX=/usr/lib/x86_64-linux-gnu/ >> $GITHUB_ENV" + echo "GHDL_PREFIX=/usr/lib/x86_64-linux-gnu/" >> $GITHUB_ENV + macos_arm_before_script: | which ghdl ghdl version echo $(brew --prefix llvm@15) export DYLD_LIBRARY_PATH=$(brew --prefix llvm@15)/lib echo -$DYLD_LIBRARY_PATH- echo "DYLD_LIBRARY_PATH=$(brew --prefix llvm@15)/lib" >> $GITHUB_ENV + echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl) >> $GITHUB_ENV" + echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl)" >> $GITHUB_ENV + ls -lAh "$(realpath $(dirname $(which ghdl))/../lib)" echo "----" ls $(brew --prefix llvm@15)/lib mingw64_before_script: | which ghdl ghdl version + echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl) >> $GITHUB_ENV" + echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl)" >> $GITHUB_ENV +# ls -lAh "$(realpath $(dirname $(which ghdl))/../lib)" ucrt64_before_script: | which ghdl ghdl version + echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl) >> $GITHUB_ENV" + echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl)" >> $GITHUB_ENV +# ls -lAh "$(realpath $(dirname $(which ghdl))/../lib)" # ubuntu_before_script: sudo install -m 755 tests/mock/ghdl /usr/local/bin requirements: "-r tests/unit/requirements.txt" unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index be85a1f4..ad95dd99 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -33,15 +33,12 @@ from pathlib import Path from unittest import TestCase -from pyTooling.Platform import CurrentPlatform - from pyEDAA.CLITool.GHDL import GHDL from . import Helper class GHDLTestcases(TestCase, Helper): - _libraryDirectoryPath = (Path(os_getenv("GHDL_PREFIX", default="/usr/lib/ghdl" if not CurrentPlatform.IsNativeMacOS else "/opt/homebrew/lib/ghdl")) / "../").resolve() - _binaryDirectoryPath = (Path(os_getenv("GHDL_PREFIX", default="/usr/lib/ghdl" if not CurrentPlatform.IsNativeMacOS else "/opt/homebrew/lib/ghdl")) / "../../bin").resolve() + _binaryDirectoryPath = (Path(os_getenv("GHDL_PREFIX", default="/usr/lib/ghdl")) / "../../bin").resolve() class CommonOptions(GHDLTestcases): From 6023ef6772b951637b6ed5001b1dfee91b33226f Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Mon, 11 Nov 2024 07:40:40 +0100 Subject: [PATCH 43/48] General updates. --- .gitignore | 22 ++++++++++---------- .idea/pyEDAA.CLITool.iml | 2 +- dist/requirements.txt | 2 +- doc/Dependency.rst | 42 +++++++++++++++++++-------------------- doc/Installation.rst | 14 ++++++------- doc/conf.py | 43 ++++++++++++++++++++-------------------- doc/requirements.txt | 17 ++++++++-------- pyproject.toml | 9 +++++---- requirements.txt | 4 ++-- tests/requirements.txt | 6 +++--- 10 files changed, 82 insertions(+), 79 deletions(-) diff --git a/.gitignore b/.gitignore index a2ec455e..3ca7614f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,9 +6,13 @@ __pycache__/ .coverage .cov coverage.xml +/report/coverage -# Generated reports -report/ +# mypy +/report/typing + +# pytest +/report/unit # setuptools /build/**/*.* @@ -18,15 +22,13 @@ report/ # Dependencies !requirements.txt -# Sphinx -doc/_build/ -doc/pyEDAA.CLITool/**/*.* -!doc/pyEDAA.CLITool/index.rst - -# BuildTheDocs -doc/_theme/**/*.* +# Sphinx documentation +/doc/_build/ +/doc/_theme/ +/doc/pyEDAA.CLITool/**/*.* +!/doc/pyEDAA.CLITool/index.rst -# IntelliJ project files +# PyCharm project files /.idea/workspace.xml # Git files diff --git a/.idea/pyEDAA.CLITool.iml b/.idea/pyEDAA.CLITool.iml index 09489b93..b1593819 100644 --- a/.idea/pyEDAA.CLITool.iml +++ b/.idea/pyEDAA.CLITool.iml @@ -10,7 +10,7 @@ - + \ No newline at end of file diff --git a/dist/requirements.txt b/dist/requirements.txt index 71950fcd..918a0be9 100644 --- a/dist/requirements.txt +++ b/dist/requirements.txt @@ -1,2 +1,2 @@ -wheel ~= 0.43 +wheel ~= 0.45 twine ~= 5.1 diff --git a/doc/Dependency.rst b/doc/Dependency.rst index f002729f..14ae5c6e 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -6,11 +6,11 @@ Dependencies .. |img-CLITool-lib-status| image:: https://img.shields.io/librariesio/release/pypi/pyEDAA.CLITool :alt: Libraries.io status for latest release :height: 22 - :target: https://libraries.io/github/pyEDAA-org/pyEDAA.CLITool -.. |img-CLITool-vul-status| image:: https://img.shields.io/snyk/vulnerabilities/github/pyEDAA-org/pyEDAA.CLITool + :target: https://libraries.io/github/edaa-org/pyEDAA.CLITool +.. |img-CLITool-vul-status| image:: https://img.shields.io/snyk/vulnerabilities/github/edaa-org/pyEDAA.CLITool :alt: Snyk Vulnerabilities for GitHub Repo :height: 22 - :target: https://img.shields.io/snyk/vulnerabilities/github/pyEDAA-org/pyEDAA.CLITool + :target: https://img.shields.io/snyk/vulnerabilities/github/edaa-org/pyEDAA.CLITool +------------------------------------------+------------------------------------------+ | `Libraries.io `_ | Vulnerabilities Summary | @@ -30,7 +30,7 @@ PyPI (see :ref:`INSTALL`). .. tab-set:: - .. tab-item:: Linux/MacOS + .. tab-item:: Linux/macOS :sync: Linux .. code-block:: bash @@ -50,9 +50,9 @@ PyPI (see :ref:`INSTALL`). +---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=======================================================================================+=============+==========================================================================================================+=============================================================================================================================================================+ -| `pyTooling `__ | ≥6.5 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥8.0 | `Apache License, 2.0 `__ | *None* | +---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `pyVHDLModel `__ | ≥0.28 | `Apache License, 2.0 `__ | * `pyTooling `__ (`Apache License, 2.0 `__) | +| `pyVHDLModel `__ | ≥0.29 | `Apache License, 2.0 `__ | * `pyTooling `__ (`Apache License, 2.0 `__) | +---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. todo:: investigate dependencies and licenses of pyTooling with CLIAbstraction and pyAttributes/argcomplete. @@ -79,7 +79,7 @@ the mandatory dependencies too. .. tab-set:: - .. tab-item:: Linux/MacOS + .. tab-item:: Linux/macOS :sync: Linux .. code-block:: bash @@ -100,15 +100,15 @@ the mandatory dependencies too. +=====================================================================+=============+========================================================================================+======================+ | `pytest `__ | ≥8.3 | `MIT `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `pytest-cov `__ | ≥5.0.0 | `MIT `__ | *Not yet evaluated.* | +| `pytest-cov `__ | ≥6.0 | `MIT `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `Coverage `__ | ≥7.6 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `mypy `__ | ≥1.11 | `MIT `__ | *Not yet evaluated.* | +| `mypy `__ | ≥1.13 | `MIT `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `typing-extensions `__ | ≥4.12 | `PSF-2.0 `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `lxml `__ | ≥5.2 | `BSD 3-Clause `__ | *Not yet evaluated.* | +| `lxml `__ | ≥5.3 | `BSD 3-Clause `__ | *Not yet evaluated.* | +---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ @@ -129,7 +129,7 @@ the mandatory dependencies too. .. tab-set:: - .. tab-item:: Linux/MacOS + .. tab-item:: Linux/macOS :sync: Linux .. code-block:: bash @@ -149,21 +149,21 @@ the mandatory dependencies too. +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=================================================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥6.5 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥8.0 | `Apache License, 2.0 `__ | *None* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `Sphinx `__ | ≥8.0 | `BSD 3-Clause `__ | *Not yet evaluated.* | +| `Sphinx `__ | ≥8.1 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `sphinxcontrib-mermaid `__ | ≥0.9.2 | `BSD `__ | *Not yet evaluated.* | +| `sphinxcontrib-mermaid `__ | ≥1.0 | `BSD `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `autoapi `__ | ≥2.0.1 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `sphinx_btd_theme `__ | ≥0.5.2 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `sphinx_design `__ | ≥0.5.0 | `MIT `__ | *Not yet evaluated.* | +| `sphinx_design `__ | ≥0.6 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `sphinx-copybutton `__ | ≥0.5.2 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `sphinx_autodoc_typehints `__ | ≥2.2 | `MIT `__ | *Not yet evaluated.* | +| `sphinx_autodoc_typehints `__ | ≥2.5 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `ruamel.yaml `__ | ≥0.18 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -184,7 +184,7 @@ install the mandatory dependencies too. .. tab-set:: - .. tab-item:: Linux/MacOS + .. tab-item:: Linux/macOS :sync: Linux .. code-block:: bash @@ -204,9 +204,9 @@ install the mandatory dependencies too. +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +============================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥6.5 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥8.0 | `Apache License, 2.0 `__ | *None* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `wheel `__ | ≥0.43 | `MIT `__ | *Not yet evaluated.* | +| `wheel `__ | ≥0.45 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -227,7 +227,7 @@ install the mandatory dependencies too. .. tab-set:: - .. tab-item:: Linux/MacOS + .. tab-item:: Linux/macOS :sync: Linux .. code-block:: bash @@ -247,7 +247,7 @@ install the mandatory dependencies too. +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ | **Package** | **Version** | **License** | **Dependencies** | +==========================================================+==============+===========================================================================================+======================+ -| `wheel `__ | ≥0.43 | `MIT `__ | *Not yet evaluated.* | +| `wheel `__ | ≥0.45 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ | `Twine `__ | ≥5.1 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ diff --git a/doc/Installation.rst b/doc/Installation.rst index 6754e22b..7cb4eb37 100644 --- a/doc/Installation.rst +++ b/doc/Installation.rst @@ -35,7 +35,7 @@ See :ref:`DEP` for more details. .. tab-set:: - .. tab-item:: Linux/MacOS + .. tab-item:: Linux/macOS :sync: Linux .. tab-set:: @@ -156,7 +156,7 @@ Updating from PyPI using PIP .. tab-set:: - .. tab-item:: Linux/MacOS + .. tab-item:: Linux/macOS :sync: Linux .. code-block:: bash @@ -186,7 +186,7 @@ Uninstallation using PIP .. tab-set:: - .. tab-item:: Linux/MacOS + .. tab-item:: Linux/macOS :sync: Linux .. code-block:: bash @@ -223,7 +223,7 @@ Ensure :ref:`unit testing requirements ` are installed. .. tab-set:: - .. tab-item:: Linux/MacOS + .. tab-item:: Linux/macOS :sync: Linux .. tab-set:: @@ -324,7 +324,7 @@ Ensure :ref:`unit testing requirements ` are installed. .. tab-set:: - .. tab-item:: Linux/MacOS + .. tab-item:: Linux/macOS :sync: Linux .. code-block:: bash @@ -360,7 +360,7 @@ Ensure :ref:`documentation requirements ` are installed. .. tab-set:: - .. tab-item:: Linux/MacOS + .. tab-item:: Linux/macOS :sync: Linux .. tab-set:: @@ -448,7 +448,7 @@ Ensure :ref:`packaging requirements ` are installed. .. tab-set:: - .. tab-item:: Linux/MacOS + .. tab-item:: Linux/macOS :sync: Linux .. code-block:: bash diff --git a/doc/conf.py b/doc/conf.py index 4a84a25c..5379120f 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -7,12 +7,21 @@ from pyTooling.Packaging import extractVersionInformation +# ============================================================================== +# Project configuration +# ============================================================================== +githubNamespace = "edaa-org" +project = "pyEDAA.CLITool" +directoryName = project.replace('.', '/') + +# ============================================================================== +# Project paths +# ============================================================================== ROOT = Path(__file__).resolve().parent sys_path.insert(0, abspath(".")) sys_path.insert(0, abspath("..")) -sys_path.insert(0, abspath("../pyEDAA/CLITool")) -# sys_path.insert(0, abspath("_extensions")) +sys_path.insert(0, abspath(f"../{directoryName}")) # ============================================================================== @@ -21,10 +30,7 @@ # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. -githubNamespace = "EDAA-org" -project = "pyEDAA.CLITool" - -packageInformationFile = Path(f"../{project.replace('.', '/')}/__init__.py") +packageInformationFile = Path(f"../{directoryName}/__init__.py") versionInformation = extractVersionInformation(packageInformationFile) author = versionInformation.Author @@ -91,7 +97,7 @@ html_favicon = str(Path(html_static_path[0]) / "favicon.svg") # Output file base name for HTML help builder. -htmlhelp_basename = f"{project.replace('.', '')}Doc" +htmlhelp_basename = f"{project}Doc" # If not None, a 'Last updated on:' timestamp is inserted at every page # bottom, using the given strftime format. @@ -253,15 +259,6 @@ # ============================================================================== # sphinx-reports # ============================================================================== -_coverageLevels = { - 30: {"class": "report-cov-below30", "desc": "almost undocumented"}, - 50: {"class": "report-cov-below50", "desc": "poorly documented"}, - 80: {"class": "report-cov-below80", "desc": "roughly documented"}, - 90: {"class": "report-cov-below90", "desc": "well documented"}, - 100: {"class": "report-cov-below100", "desc": "excellent documented"}, - "error": {"class": "report-cov-error", "desc": "internal error"}, -} - report_unittest_testsuites = { "src": { "name": f"{project}", @@ -273,15 +270,15 @@ "name": f"{project}", "json_report": "../report/coverage/coverage.json", "fail_below": 80, - "levels": _coverageLevels + "levels": "default" } } report_doccov_packages = { "src": { "name": f"{project}", - "directory": f"../{project.replace('.', '/')}", + "directory": f"../{directoryName}", "fail_below": 80, - "levels": _coverageLevels + "levels": "default" } } @@ -289,12 +286,16 @@ # ============================================================================== # Sphinx_Design # ============================================================================== -sd_fontawesome_latex = True +# sd_fontawesome_latex = True # ============================================================================== # AutoAPI.Sphinx # ============================================================================== autoapi_modules = { - 'pyEDAA.CLITool': {'output': "pyEDAA.CLITool", "override": True} + f"{project}": { + "template": "module", + "output": project, + "override": True + } } diff --git a/doc/requirements.txt b/doc/requirements.txt index 138f68b8..bfb8bf1d 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,18 +1,17 @@ -r ../requirements.txt -pyTooling ~= 6.5 - # Enforce latest version on ReadTheDocs -sphinx ~= 7.4 -docutils ~= 0.20 +sphinx ~= 8.1 +docutils ~= 0.21 +docutils_stubs ~= 0.0.22 # ReadTheDocs Theme -sphinx_rtd_theme ~= 2.0.0 +sphinx_rtd_theme ~= 3.0.0 # Sphinx Extenstions -sphinxcontrib-mermaid >= 0.9.2 +sphinxcontrib-mermaid ~= 1.0 autoapi >= 2.0.1 -sphinx_design >= 0.5.0 +sphinx_design ~= 0.6.1 sphinx-copybutton >= 0.5.2 -sphinx_autodoc_typehints ~= 2.2 -sphinx_reports ~= 0.6 +sphinx_autodoc_typehints ~= 2.5 +sphinx_reports ~= 0.7 diff --git a/pyproject.toml b/pyproject.toml index 9c233e91..73407d8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [build-system] requires = [ - "setuptools ~= 72.1", - "wheel ~= 0.43", - "pyTooling ~= 6.5" + "setuptools ~= 75.5", + "wheel ~= 0.45", + "pyTooling ~= 8.0" ] build-backend = "setuptools.build_meta" @@ -11,7 +11,7 @@ line-length = 120 [tool.mypy] files = ["pyEDAA.CLITool"] -python_version = "3.12" +python_version = "3.13" #ignore_missing_imports = true strict = true pretty = true @@ -21,6 +21,7 @@ namespace_packages = true html_report = "report/typing" [tool.pytest.ini_options] +addopts = "--tb=native" # Don't set 'python_classes = *' otherwise, pytest doesn't search for classes # derived from unittest.Testcase python_files = "*" diff --git a/requirements.txt b/requirements.txt index 580ccc73..c29fb28f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -pyTooling ~= 6.5 -pyVHDLModel ~= 0.28.0 +pyTooling ~= 8.0 +pyVHDLModel ~= 0.29.1 py-flags ~= 1.1 diff --git a/tests/requirements.txt b/tests/requirements.txt index b7fdbd9a..2ad659b6 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -5,9 +5,9 @@ Coverage ~= 7.6 # Test Runner pytest ~= 8.3 -pytest-cov ~= 5.0 +pytest-cov ~= 6.0 # Static Type Checking -mypy ~= 1.11 +mypy ~= 1.13 typing_extensions ~= 4.12 -lxml ~= 5.2 +lxml ~= 5.3 From be80c18803c0c9ec35bce231b96a4adcfaaaf761 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Wed, 13 Nov 2024 22:09:21 +0100 Subject: [PATCH 44/48] Fixed pipeline. --- .github/workflows/Pipeline.yml | 46 +++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 02b55d95..61fb93cf 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -8,6 +8,11 @@ on: - cron: '0 22 * * 5' jobs: + ConfigParams: + uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@dev + with: + package_name: pyEDAA.CLITool + UnitTestingParams: uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev with: @@ -59,22 +64,24 @@ jobs: StaticTypeCheck: uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@dev needs: + - ConfigParams - UnitTestingParams with: python_version: ${{ needs.UnitTestingParams.outputs.python_version }} commands: | - touch pyEDAA/__init__.py - mypy --html-report htmlmypy -p pyEDAA.CLITool + ${{ needs.ConfigParams.outputs.mypy_prepare_command }} + mypy --html-report htmlmypy -p ${{ needs.ConfigParams.outputs.package_fullname }} html_report: 'htmlmypy' html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).statictyping_html }} DocCoverage: uses: pyTooling/Actions/.github/workflows/CheckDocumentation.yml@dev needs: + - ConfigParams - UnitTestingParams with: python_version: ${{ needs.UnitTestingParams.outputs.python_version }} - directory: pyEDAA/CLITool + directory: ${{ needs.ConfigParams.outputs.package_directors }} fail_under: 75 Package: @@ -106,17 +113,6 @@ jobs: additional_merge_args: '"--pytest=rewrite-dunder-init;reduce-depth:pytest.tests.unit" --render=tree' merged_junit_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} - IntermediateCleanUp: - uses: pyTooling/Actions/.github/workflows/IntermediateCleanUp.yml@dev - needs: - - UnitTestingParams - - PublishCoverageResults - - PublishTestResults - - HTMLDocumentation - with: - sqlite_coverage_artifacts_prefix: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }}- - xml_unittest_artifacts_prefix: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}- - # VerifyDocs: # uses: pyTooling/Actions/.github/workflows/VerifyDocs.yml@dev # needs: @@ -124,25 +120,39 @@ jobs: # with: # python_version: ${{ needs.UnitTestingParams.outputs.python_version }} - HTMLDocumentation: + Documentation: uses: pyTooling/Actions/.github/workflows/SphinxDocumentation.yml@dev needs: + - ConfigParams - UnitTestingParams - PublishTestResults - PublishCoverageResults # - VerifyDocs with: python_version: ${{ needs.UnitTestingParams.outputs.python_version }} + coverage_report_json_directory: ${{ needs.ConfigParams.outputs.coverage_report_json_directory }} unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} coverage_json_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_json }} html_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_html }} latex_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_latex }} + IntermediateCleanUp: + uses: pyTooling/Actions/.github/workflows/IntermediateCleanUp.yml@dev + needs: + - UnitTestingParams + - PublishCoverageResults + - PublishTestResults + - Documentation + with: + sqlite_coverage_artifacts_prefix: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }}- + xml_unittest_artifacts_prefix: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}- + + PDFDocumentation: uses: pyTooling/Actions/.github/workflows/LaTeXDocumentation.yml@dev needs: - UnitTestingParams - - HTMLDocumentation + - Documentation with: document: pyEDAA.CLITool latex_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).documentation_latex }} @@ -152,7 +162,7 @@ jobs: uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@dev needs: - UnitTestingParams - - HTMLDocumentation + - Documentation # - PDFDocumentation - PublishCoverageResults - StaticTypeCheck @@ -186,7 +196,7 @@ jobs: - UnitTestingParams - UnitTesting - StaticTypeCheck - - HTMLDocumentation + - Documentation # - PDFDocumentation - PublishTestResults - PublishCoverageResults From 885edce6e21afe8dafd59ecbf523dcc02c6a15ef Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 17 Dec 2024 00:23:40 +0100 Subject: [PATCH 45/48] Improvements. --- doc/conf.py | 11 ++++++----- doc/genindex.rst | 4 ---- doc/index.rst | 7 +++---- setup.py | 8 +++++--- tests/unit/GHDL.py | 2 +- 5 files changed, 15 insertions(+), 17 deletions(-) delete mode 100644 doc/genindex.rst diff --git a/doc/conf.py b/doc/conf.py index 5379120f..ad0b4ee0 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -213,11 +213,12 @@ # Sphinx.Ext.ExtLinks # ============================================================================== extlinks = { - "gh": (f"https://GitHub.com/%s", "gh:%s"), - "ghissue": (f"https://GitHub.com/{githubNamespace}/{project}/issues/%s", "issue #%s"), - "ghpull": (f"https://GitHub.com/{githubNamespace}/{project}/pull/%s", "pull request #%s"), - "ghsrc": (f"https://GitHub.com/{githubNamespace}/{project}/blob/main/%s", None), - "wiki": (f"https://en.wikipedia.org/wiki/%s", None), + "gh": (f"https://GitHub.com/%s", "%s"), + "ghissue": (f"https://GitHub.com/{githubNamespace}/{project}/issues/%s", "issue #%s"), + "ghpull": (f"https://GitHub.com/{githubNamespace}/{project}/pull/%s", "pull request #%s"), + "ghsrc": (f"https://GitHub.com/{githubNamespace}/{project}/blob/main/%s", None), + "pypi": ( "https://PyPI.org/project/%s", "%s"), + "wiki": (f"https://en.wikipedia.org/wiki/%s", None), } diff --git a/doc/genindex.rst b/doc/genindex.rst deleted file mode 100644 index c07da40d..00000000 --- a/doc/genindex.rst +++ /dev/null @@ -1,4 +0,0 @@ -.. This file is a placeholder and will be replaced - -Index -##### diff --git a/doc/index.rst b/doc/index.rst index 9ce46707..21c4879e 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -129,8 +129,8 @@ News Contributors ************ -* `Patrick Lehmann `__ (Maintainer) -* `Unai Martinez-Corral `__ +* :gh:`Patrick Lehmann ` (Maintainer) +* :gh:`Unai Martinez-Corral ` * `and more... `__ @@ -182,14 +182,13 @@ License :caption: References and Reports :hidden: - pyEDAA.CLITool/pyEDAA.CLITool + Python Class Reference unittests/index coverage/index Doc. Coverage Report Static Type Check Report ➚ .. Coverage Report ➚ - Static Type Check Report ➚ .. raw:: latex diff --git a/setup.py b/setup.py index 88792c64..61a3634a 100644 --- a/setup.py +++ b/setup.py @@ -47,6 +47,8 @@ developmentStatus="beta", classifiers=list(DEFAULT_CLASSIFIERS) + [ "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)" - ] - ) -) + ], + dataFiles={ + packageName: ["py.typed"] + } +)) diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index ad95dd99..a00764b6 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -109,7 +109,7 @@ def test_AnalyzeFaultyFile(self) -> None: tool[tool.OptionPaths] = (Path("tests/project/designB/file_B1.vhdl"), ) executable = self.getExecutablePath("ghdl", self._binaryDirectoryPath) - self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\", \"tests/project/designB/file_B1.vhdl\"]", repr(tool)) + self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\", \"tests\\project\\designB\\file_B1.vhdl\"]", repr(tool)) tool.StartProcess() for line in tool.GetLineReader(): From 09ccdb14f1a873358528987efbbaa8e3a4bf11d2 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 17 Dec 2024 00:24:12 +0100 Subject: [PATCH 46/48] Install GHDL from nightly release. --- .github/workflows/Pipeline.yml | 93 ++++++++++++++++++++++++++-------- tests/unit/GHDL.py | 8 ++- 2 files changed, 78 insertions(+), 23 deletions(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 61fb93cf..c98743ad 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -17,6 +17,7 @@ jobs: uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev with: name: pyEDAA.CLITool + disable_list: windows:* UnitTesting: uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@dev @@ -24,39 +25,89 @@ jobs: - UnitTestingParams with: jobs: ${{ needs.UnitTestingParams.outputs.python_jobs }} - apt: ghdl-mcode - brew: --cask ghdl - pacboy: ghdl ubuntu_before_script: | - which ghdl - ghdl version - echo "GHDL_PREFIX=/usr/lib/x86_64-linux-gnu/ >> $GITHUB_ENV" - echo "GHDL_PREFIX=/usr/lib/x86_64-linux-gnu/" >> $GITHUB_ENV + export GH_TOKEN=${{ github.token }} + # gh release download "testing" --repo "Paebbels/ghdl" --pattern "ghdl-mcode-*-ubuntu*-x86_64.tar.gz" --output "ghdl-mcode.tar.gz" + + ( + mkdir -p install + cd install + curl -L "https://github.com/Paebbels/ghdl/releases/download/testing/ghdl-mcode-5.0.0-dev-ubuntu24.04-x86_64.tar.gz" | tar -xz --strip-components 1 + ( + cd bin + pwd + ls -lAh . + ) + # tree . + sudo xargs --no-run-if-empty -a ./ubuntu.requirements -- apt-get install -y --no-install-recommends + ) + + echo "GHDL_PREFIX=$(pwd)/install/lib/ghdl >> $GITHUB_ENV" + echo "GHDL_PREFIX=$(pwd)/install/lib/ghdl" >> $GITHUB_ENV + macos_before_script: | + export GH_TOKEN=${{ github.token }} + # gh release download "testing" --repo "Paebbels/ghdl" --pattern "ghdl-mcode-*-ubuntu*-x86_64.tar.gz" --output "ghdl-mcode.tar.gz" + + ( + mkdir -p install + cd install + curl -L "https://github.com/Paebbels/ghdl/releases/download/testing/ghdl-mcode-5.0.0-dev-macos13-x86_64.tar.gz" | tar -xz --strip-components 1 + ( + cd bin + pwd + ls -lAh . + ) + ) + + echo "GHDL_PREFIX=$(pwd)/install/lib/ghdl >> $GITHUB_ENV" + echo "GHDL_PREFIX=$(pwd)/install/lib/ghdl" >> $GITHUB_ENV macos_arm_before_script: | - which ghdl - ghdl version - echo $(brew --prefix llvm@15) - export DYLD_LIBRARY_PATH=$(brew --prefix llvm@15)/lib - echo -$DYLD_LIBRARY_PATH- - echo "DYLD_LIBRARY_PATH=$(brew --prefix llvm@15)/lib" >> $GITHUB_ENV - echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl) >> $GITHUB_ENV" - echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl)" >> $GITHUB_ENV - ls -lAh "$(realpath $(dirname $(which ghdl))/../lib)" - echo "----" - ls $(brew --prefix llvm@15)/lib + export GH_TOKEN=${{ github.token }} + # gh release download "testing" --repo "Paebbels/ghdl" --pattern "ghdl-mcode-*-ubuntu*-x86_64.tar.gz" --output "ghdl-mcode.tar.gz" + + ( + mkdir -p install + cd install + curl -L "https://github.com/Paebbels/ghdl/releases/download/testing/ghdl-llvm-5.0.0-dev-macos14-aarch64.tar.gz" | tar -xz --strip-components 1 + ( + cd bin + pwd + ls -lAh . + ) + ) + + echo "GHDL_PREFIX=$(pwd)/install/lib/ghdl >> $GITHUB_ENV" + echo "GHDL_PREFIX=$(pwd)/install/lib/ghdl" >> $GITHUB_ENV +# windows_before_script: | +# curl -L "https://github.com/Paebbels/ghdl/releases/download/testing/ghdl-mcode-5.0.0-dev-ucrt64.zip" -o ghdl.zip +# dir +# mkdir install +# cd install +# unzip ../ghdl.zip +# dir + mingw64_before_script: | + export GH_TOKEN=${{ github.token }} + # gh release download "testing" --repo "Paebbels/ghdl" --pattern "ghdl-mcode-*-ubuntu*-x86_64.tar.gz" --output "ghdl-mcode.tar.gz" + + curl -L "https://github.com/Paebbels/ghdl/releases/download/testing/mingw-w64-x86_64-ghdl-mcode-5.0.0.dev-1-any.pkg.tar.zst" -o ghdl.pkg.tar.zst + pacman -U --noconfirm ghdl.pkg.tar.zst + which ghdl ghdl version echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl) >> $GITHUB_ENV" echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl)" >> $GITHUB_ENV -# ls -lAh "$(realpath $(dirname $(which ghdl))/../lib)" ucrt64_before_script: | + export GH_TOKEN=${{ github.token }} + # gh release download "testing" --repo "Paebbels/ghdl" --pattern "ghdl-mcode-*-ubuntu*-x86_64.tar.gz" --output "ghdl-mcode.tar.gz" + + curl -L "https://github.com/Paebbels/ghdl/releases/download/testing/mingw-w64-ucrt-x86_64-ghdl-mcode-5.0.0.dev-1-any.pkg.tar.zst" -o ghdl.pkg.tar.zst + pacman -U --noconfirm ghdl.pkg.tar.zst + which ghdl ghdl version echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl) >> $GITHUB_ENV" echo "GHDL_PREFIX=$(realpath $(dirname $(which ghdl))/../lib/ghdl)" >> $GITHUB_ENV -# ls -lAh "$(realpath $(dirname $(which ghdl))/../lib)" -# ubuntu_before_script: sudo install -m 755 tests/mock/ghdl /usr/local/bin requirements: "-r tests/unit/requirements.txt" unittest_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }} coverage_sqlite_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }} diff --git a/tests/unit/GHDL.py b/tests/unit/GHDL.py index a00764b6..9906b3ef 100644 --- a/tests/unit/GHDL.py +++ b/tests/unit/GHDL.py @@ -103,13 +103,17 @@ def _GetAnalyzer(self) -> GHDL: def test_AnalyzeFaultyFile(self) -> None: print() + self.maxDiff = None + + path = Path("tests/project/designB/file_B1.vhdl") + tool = self._GetAnalyzer() tool[tool.CommandAnalyze] = True tool[tool.FlagLibrary] = "lib_Test" - tool[tool.OptionPaths] = (Path("tests/project/designB/file_B1.vhdl"), ) + tool[tool.OptionPaths] = (path, ) executable = self.getExecutablePath("ghdl", self._binaryDirectoryPath) - self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\", \"tests\\project\\designB\\file_B1.vhdl\"]", repr(tool)) + self.assertEqual(f"[\"{executable}\", \"analyze\", \"--std=08\", \"-fsynopsys\", \"-frelaxed\", \"-fexplicit\", \"--work=lib_Test\", \"--mb-comments\", \"{path!s}\"]", repr(tool)) tool.StartProcess() for line in tool.GetLineReader(): From aac0798c261e125030c27babc18bbe22357c3207 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 17 Dec 2024 22:28:16 +0100 Subject: [PATCH 47/48] Bumped dependencies. --- dist/requirements.txt | 2 +- doc/Dependency.rst | 2 +- doc/requirements.txt | 2 +- requirements.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/requirements.txt b/dist/requirements.txt index 918a0be9..8586c51f 100644 --- a/dist/requirements.txt +++ b/dist/requirements.txt @@ -1,2 +1,2 @@ wheel ~= 0.45 -twine ~= 5.1 +twine ~= 6.0 diff --git a/doc/Dependency.rst b/doc/Dependency.rst index 14ae5c6e..8631566f 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -249,5 +249,5 @@ install the mandatory dependencies too. +==========================================================+==============+===========================================================================================+======================+ | `wheel `__ | ≥0.45 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ -| `Twine `__ | ≥5.1 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +| `Twine `__ | ≥6.0 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ diff --git a/doc/requirements.txt b/doc/requirements.txt index bfb8bf1d..160df03b 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -6,7 +6,7 @@ docutils ~= 0.21 docutils_stubs ~= 0.0.22 # ReadTheDocs Theme -sphinx_rtd_theme ~= 3.0.0 +sphinx_rtd_theme ~= 3.0 # Sphinx Extenstions sphinxcontrib-mermaid ~= 1.0 diff --git a/requirements.txt b/requirements.txt index c29fb28f..a0dcd6fb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ pyTooling ~= 8.0 -pyVHDLModel ~= 0.29.1 +pyVHDLModel ~= 0.29.2 py-flags ~= 1.1 From 3df26ee147fea9536635ecedc68574a95c18471d Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 17 Dec 2024 22:42:27 +0100 Subject: [PATCH 48/48] Updated news. --- doc/index.rst | 8 +- tests/mock/ghdl | 204 ------------------------------------------------ 2 files changed, 5 insertions(+), 207 deletions(-) delete mode 100644 tests/mock/ghdl diff --git a/doc/index.rst b/doc/index.rst index 21c4879e..0151137c 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -76,15 +76,17 @@ News .. only:: html - July 2024 - General Updates - =========================== + July/Dez 2024 - General Updates + =============================== .. only:: latex .. rubric:: General Updates -* Updated to support pyTooling v6.5. +* Updated to support pyTooling v8.0. * Replaced Sphinx theme with ReadTheDocs theme. +* FreeBSD support for GHDL, GTKWave and Docker. +* Reworked documentation. .. only:: html diff --git a/tests/mock/ghdl b/tests/mock/ghdl deleted file mode 100644 index 466491ab..00000000 --- a/tests/mock/ghdl +++ /dev/null @@ -1,204 +0,0 @@ -#! /bin/bash - -ANSI_BLACK="\e[30m" -ANSI_RED="\e[31m" -ANSI_GREEN="\e[32m" -ANSI_YELLOW="\e[33m" -ANSI_BLUE="\e[34m" -ANSI_MAGENTA="\e[35m" -ANSI_CYAN="\e[36m" -ANSI_DARK_GRAY="\e[90m" -ANSI_LIGHT_GRAY="\e[37m" -ANSI_LIGHT_RED="\e[91m" -ANSI_LIGHT_GREEN="\e[92m" -ANSI_LIGHT_YELLOW="\e[93m" -ANSI_LIGHT_BLUE="\e[94m" -ANSI_LIGHT_MAGENTA="\e[95m" -ANSI_LIGHT_CYAN="\e[96m" -ANSI_WHITE="\e[97m" -ANSI_NOCOLOR="\e[0m" - -# red texts -COLORED_ERROR="${ANSI_RED}[ERROR]" -COLORED_FAILED="${ANSI_RED}[FAILED]${ANSI_NOCOLOR}" - -# yellow texts -COLORED_WARNING="${ANSI_YELLOW}[WARNING]" - -# green texts -COLORED_PASSED="${ANSI_GREEN}[PASSED]${ANSI_NOCOLOR}" -COLORED_DONE="${ANSI_GREEN}[DONE]${ANSI_NOCOLOR}" -COLORED_SUCCESSFUL="${ANSI_GREEN}[SUCCESSFUL]${ANSI_NOCOLOR}" - -case "$(uname -s)" in - Linux*) - MACHINE=Linux - GHDL_PATH="/usr/bin/ghdl" - ;; - Darwin*) - MACHINE=Mac - ;; - MINGW*) - MACHINE=MinGw - if [[ "$MSYSTEM" == "MINGW64" ]]; then - MSYS_GHDL_PATH="/mingw64/bin/ghdl" - GHDL_PATH="C:\msys64\mingw64\bin\ghdl.exe" - elif [[ "$MSYSTEM" == "UCRT64" ]]; then - MSYS_GHDL_PATH="/ucrt64/bin/ghdl" - GHDL_PATH="C:\msys64\ucrt64\bin\ghdl.exe" - fi - ;; - CYGWIN*) - MACHINE=Cygwin - ;; - *) - MACHINE="UNKNOWN:$(uname -s)" -esac - - -if [[ "$#" -eq 0 ]]; then - echo "${GHDL_PATH}:error: missing command, try ${GHDL_PATH} 'help'" - exit 1 -fi - -while [[ "$#" -gt 0 ]]; do - case "$1" in - -h|--help|help) - echo "usage: ${GHDL_PATH} COMMAND [OPTIONS] ..." - echo "COMMAND is one of:" - echo "analyze [OPTS] FILEs" - echo " Analyze one or multiple VHDL files" - echo " aliases: -a, analyse" - echo "elaborate [OPTS] UNIT [ARCH]" - echo " Elaborate design UNIT" - echo " alias: -e" - echo "run UNIT [ARCH] [RUNOPTS]" - echo " Run design UNIT" - echo " alias: -r" - echo "elab-run [OPTS] UNIT [ARCH] [RUNOPTS]" - echo " Elaborate and run design UNIT" - echo " alias: --elab-run" - echo "help [CMD]" - echo " Display this help or [help on CMD]" - echo " aliases: -h, --help" - echo "version" - echo " Display ghdl version" - echo " aliases: -v, --version" - echo "help-options" - echo " Display help for analyzer options" - echo " alias: --help-options, opts-help, --options-help" - echo "help-warnings" - echo " Display help about all the warnings" - echo " alias: --help-warnings" - echo "" - echo "To display the options of a GHDL program," - echo " run your program with the 'help' option." - echo "Also see 'opts-help' for analyzer options." - echo "" - echo "Please, refer to the GHDL manual for more information." - echo "Report issues on https://github.com/ghdl/ghdl" - exit 0 - ;; - -v|--version|version) - echo "GHDL 4.1.0 (tarball) [Dunoon edition]" - echo " Compiled with GNAT Version: 14.1.0" - echo " llvm 18.1.4 code generator" - echo "Written by Tristan Gingold." - echo "" - echo "Copyright (C) 2003 - 2024 Tristan Gingold." - echo "GHDL is free software, covered by the GNU General Public License. There is NO" - echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit 0 - ;; - -a|analyze|analyse) - while [[ "$#" -gt 0 ]]; do - case "$1" in - --std=*) - ;; - --work=*) - ;; - -P*) - ;; - -fsynopsys) - ;; - -frelaxed|-frelaxed-rules) - ;; - -fexplicit) - ;; - -v) - ;; - -C|--mb-comments) - ;; - *) - ;; - esac - shift # parsed argument or value - done - - exit 0 - ;; - -e|elaborate) - while [[ "$#" -gt 0 ]]; do - case "$1" in - --std=*) - ;; - --work=*) - ;; - -P*) - ;; - -fsynopsys) - ;; - -frelaxed|-frelaxed-rules) - ;; - -fexplicit) - ;; - --syn-binding) - ;; - -v) - ;; - *) - ;; - esac - shift # parsed argument or value - done - - exit 0 - ;; - -r|run) - while [[ "$#" -gt 0 ]]; do - case "$1" in - --std=*) - ;; - --work=*) - ;; - -P*) - ;; - -fsynopsys) - ;; - -frelaxed|-frelaxed-rules) - ;; - -fexplicit) - ;; - -v) - ;; - *) - ;; - esac - shift # parsed argument or value - done - - exit 0 - ;; - --elab-run|elab-run) - ;; -# --ghdl) -# GHDL="$2" # overwrite a potentially existing GHDL environment variable -# shift # skip argument -# ;; - *) # unknown option - echo 1>&2 -e "\n${COLORED_ERROR} Unknown command line option '$1'.${ANSI_NOCOLOR}" - exit 127 - ;; - esac - shift # parsed argument or value -done