diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-12-18 00:06:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-18 00:06:42 +0100 |
commit | 45559a72376b558d4ffd61fbfbcf47ea75a9f41a (patch) | |
tree | c53b4ebc9d5dc410f38660faabd12fb64fb1dbe2 | |
parent | f32d77707a2639fed94978965b3a9690c2bf7904 (diff) | |
parent | 4c700e385b9773a46c85386d23038b1d47afd4e7 (diff) | |
download | ghdl-45559a72376b558d4ffd61fbfbcf47ea75a9f41a.tar.gz ghdl-45559a72376b558d4ffd61fbfbcf47ea75a9f41a.tar.bz2 ghdl-45559a72376b558d4ffd61fbfbcf47ea75a9f41a.zip |
Updates for pyGHDL
61 files changed, 120 insertions, 197 deletions
diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 8931a8f29..1c737a57c 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -85,7 +85,7 @@ jobs: sudo apt update -qq sudo apt install -y gnat python -m pip install --upgrade pip - python -m pip install black wheel + python -m pip install black wheel pyTooling - name: '🚧 Update Python bindings' run: ./scripts/update_py_bindings.sh @@ -480,8 +480,7 @@ jobs: architecture: ${{ matrix.pyarch }} - name: '🐍 Install Python dependencies' - run: | - pip3 install -r testsuite/requirements.txt + run: pip3 install -r testsuite/requirements.txt - name: '🚦 Test installation of pyGHDL through pip' run: pip install ("git+https://github.com/ghdl/ghdl.git@" + $env:GHDL_HASH) @@ -190,9 +190,9 @@ fi # Check the version of libghdl is correct. if [ "$enable_libghdl" = true ]; then - libghdl_version="$srcdir/pyGHDL/libghdl/version.py" - # Extract content between single quotes in version.py, to avoid false positives due to LF/CRLF mismatch. - if [ "$ghdl_version" != "`sed 's/.*"\(.*\)".*/\1/g' $libghdl_version`" ]; then + libghdl_version="$srcdir/pyGHDL/__init__.py" + # Extract content between double quotes in __init__.py, to avoid false positives due to LF/CRLF mismatch. + if [ "$ghdl_version" != "`sed -n 's/^__version__.*"\(.*\)".*/\1/gp' $libghdl_version`" ]; then echo "Sorry, the version of $libghdl_version is not correct" echo "update the version to: $ghdl_version" echo "or use --disable-libghdl" diff --git a/doc/conf.py b/doc/conf.py index 20b75ff6e..4071310a5 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- -import sys, re +import sys from os.path import abspath from pathlib import Path from json import loads +from pyTooling.Packaging import extractVersionInformation # 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 @@ -14,31 +15,22 @@ sys.path.insert(0, abspath('../pyGHDL')) # ============================================================================== -# Project information -# ============================================================================== -project = u'GHDL' -copyright = u'2002-2021, Tristan Gingold and contributors' -author = u'Tristan Gingold and contributors' - -# ============================================================================== -# Versioning +# Project information and versioning # ============================================================================== # 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. -try: - with open('../configure') as verin: - for line in verin: - line = re.findall(r'ghdl_version=\"([0-9].+)\"', line) - if line: - version = line[0] - break -except Exception as e: - print('cannot extract version: %s' % e) - version = "latest" - pass - -release = version # The full version, including alpha/beta/rc tags. +project = "GHDL" + +# Read __version__ from source file +packageInformationFile = Path(f"../py{project}/__init__.py") +versionInformation = extractVersionInformation(packageInformationFile) + +author = versionInformation.Author +copyright = versionInformation.Copyright +version = ".".join(versionInformation.Version.split(".")[:2]) # e.g. 2.3 The short X.Y version. +release = versionInformation.Version + # ============================================================================== # Miscellaneous settings diff --git a/doc/requirements.txt b/doc/requirements.txt index cb4081ec3..dfd699db9 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,5 +1,7 @@ -r ../pyGHDL/requirements.txt +pyTooling>=1.7.0 + sphinx>=3.4.2 #recommonmark>=0.7.1 python-dateutil>=2.8.1 diff --git a/pyGHDL/__init__.py b/pyGHDL/__init__.py index eb400e0f1..bd5e1b8d7 100644 --- a/pyGHDL/__init__.py +++ b/pyGHDL/__init__.py @@ -47,7 +47,14 @@ this is provided from a ``pyGHDL`` packages with four sub-packages: * ``pyGHDL.lsp`` - A `language server protocol <https://en.wikipedia.org/wiki/Language_Server_Protocol>`__ (LSP) written in Python. The implementation offers an HTTPS service that can be used e.g. by editors and IDEs supporting LSP. """ -from pydecor import export +__author__ = "Tristan Gingold and contributors" +__email__ = "tgingold@free.fr" +__copyright__ = "2002-2021, Tristan Gingold and contributors" +__license__ = "GNU General Public License v2" +__version__ = "2.0.0-dev" +__keywords__ = ["vhdl", "parser", "compiler", "simulator", "ghdl"] + +from pyTooling.Decorators import export @export diff --git a/pyGHDL/cli/dom.py b/pyGHDL/cli/dom.py index 99f59c277..6ba5894fe 100755 --- a/pyGHDL/cli/dom.py +++ b/pyGHDL/cli/dom.py @@ -40,8 +40,9 @@ from textwrap import wrap, dedent from pyGHDL.dom import DOMException from pyGHDL.libghdl import LibGHDLException -from pydecor import export -from pyMetaClasses import Singleton +from pyTooling.Decorators import export +from pyTooling.MetaClasses import Singleton +from pyTooling.TerminalUI import LineTerminal, Severity from pyAttributes import Attribute from pyAttributes.ArgParseAttributes import ( ArgParseMixin, @@ -51,7 +52,6 @@ from pyAttributes.ArgParseAttributes import ( ArgumentAttribute, SwitchArgumentAttribute, ) -from pyTerminalUI import LineTerminal, Severity from pyGHDL import GHDLBaseException from pyGHDL.dom.NonStandard import Design, Document @@ -64,8 +64,6 @@ __email__ = "" __version__ = "0.0.0" __status__ = "Alpha" __license__ = "" -__all__ = [] -__api__ = __all__ class SourceAttribute(Attribute): diff --git a/pyGHDL/cli/lsp.py b/pyGHDL/cli/lsp.py index fd9a8834a..694988153 100644 --- a/pyGHDL/cli/lsp.py +++ b/pyGHDL/cli/lsp.py @@ -48,10 +48,11 @@ from os import environ as os_environ, getcwd as os_getcwd import os from pathlib import Path -from pydecor import export +from pyTooling.Decorators import export +from pyGHDL import __version__ as ghdlVersion import pyGHDL.libghdl as libghdl -from pyGHDL.libghdl import version, errorout_console +from pyGHDL.libghdl import errorout_console from pyGHDL.lsp import LSPConnTrace from pyGHDL.lsp.lsp import LSPConn, LanguageProtocolServer from pyGHDL.lsp.vhdl_ls import VhdlLanguageServer @@ -85,7 +86,7 @@ def _generateCLIParser() -> ArgumentParser: parser = ArgumentParser( description="VHDL Language Protocol Server. Find info about clients in `ghdl/ghdl-language-server <https://github.com/ghdl/ghdl-language-server>`__." ) - parser.add_argument("--version", "-V", action="version", version="%(prog)s " + version.__version__) + parser.add_argument("--version", "-V", action="version", version="%(prog)s " + ghdlVersion) parser.add_argument("--verbose", "-v", action="count", default=0, help="Show debug output") parser.add_argument("--log-file", help="Redirect logs to the given file instead of stderr") parser.add_argument( diff --git a/pyGHDL/cli/requirements.txt b/pyGHDL/cli/requirements.txt index 30f22625c..b9167b8ed 100644 --- a/pyGHDL/cli/requirements.txt +++ b/pyGHDL/cli/requirements.txt @@ -1,5 +1,5 @@ -r ../dom/requirements.txt -pyAttributes==2.2.1 -pyMetaClasses==1.3.1 -pyTerminalUI==1.4.1 +pyTooling>=1.6.0 +pyTooling.TerminalUI>=1.5.3 +pyAttributes>=2.3.2 diff --git a/pyGHDL/dom/Aggregates.py b/pyGHDL/dom/Aggregates.py index dfaee9a2d..02e071cb5 100644 --- a/pyGHDL/dom/Aggregates.py +++ b/pyGHDL/dom/Aggregates.py @@ -39,7 +39,7 @@ This module contains all DOM classes for VHDL's design units (:class:`context <E """ -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.SyntaxModel import ( SimpleAggregateElement as VHDLModel_SimpleAggregateElement, diff --git a/pyGHDL/dom/Attribute.py b/pyGHDL/dom/Attribute.py index 97a01f65a..3b3f3b40e 100644 --- a/pyGHDL/dom/Attribute.py +++ b/pyGHDL/dom/Attribute.py @@ -32,7 +32,7 @@ # ============================================================================ from typing import List -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.SyntaxModel import ( Attribute as VHDLModel_Attribute, diff --git a/pyGHDL/dom/Concurrent.py b/pyGHDL/dom/Concurrent.py index 33973a455..f1f545d53 100644 --- a/pyGHDL/dom/Concurrent.py +++ b/pyGHDL/dom/Concurrent.py @@ -32,7 +32,7 @@ # ============================================================================ from typing import Iterable -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.dom.Range import Range from pyVHDLModel.SyntaxModel import ( diff --git a/pyGHDL/dom/DesignUnit.py b/pyGHDL/dom/DesignUnit.py index ae53a3476..3c0d2ab0c 100644 --- a/pyGHDL/dom/DesignUnit.py +++ b/pyGHDL/dom/DesignUnit.py @@ -41,7 +41,7 @@ This module contains all DOM classes for VHDL's design units (:class:`context <E """ from typing import Iterable -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel import ContextUnion, EntityOrSymbol from pyVHDLModel.SyntaxModel import ( diff --git a/pyGHDL/dom/Expression.py b/pyGHDL/dom/Expression.py index f3c7f56c6..f68ab0d51 100644 --- a/pyGHDL/dom/Expression.py +++ b/pyGHDL/dom/Expression.py @@ -32,7 +32,7 @@ # ============================================================================ from typing import List, Union -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.SyntaxModel import ( UnaryExpression as VHDLModel_UnaryExpression, diff --git a/pyGHDL/dom/InterfaceItem.py b/pyGHDL/dom/InterfaceItem.py index 4bc65cf95..66a8fe37b 100644 --- a/pyGHDL/dom/InterfaceItem.py +++ b/pyGHDL/dom/InterfaceItem.py @@ -32,7 +32,7 @@ # ============================================================================ from typing import List -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.SyntaxModel import ( GenericConstantInterfaceItem as VHDLModel_GenericConstantInterfaceItem, diff --git a/pyGHDL/dom/Literal.py b/pyGHDL/dom/Literal.py index 54bcc2fc2..c054273c4 100644 --- a/pyGHDL/dom/Literal.py +++ b/pyGHDL/dom/Literal.py @@ -30,7 +30,7 @@ # # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.SyntaxModel import ( NullLiteral as VHDLModel_NullLiteral, diff --git a/pyGHDL/dom/Misc.py b/pyGHDL/dom/Misc.py index ddd31040a..d6fc08524 100644 --- a/pyGHDL/dom/Misc.py +++ b/pyGHDL/dom/Misc.py @@ -35,7 +35,7 @@ .. todo:: Add a module documentation. """ -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.SyntaxModel import ( Alias as VHDLModel_Alias, diff --git a/pyGHDL/dom/Names.py b/pyGHDL/dom/Names.py index acb9cd1d6..d601739db 100644 --- a/pyGHDL/dom/Names.py +++ b/pyGHDL/dom/Names.py @@ -32,7 +32,7 @@ # ============================================================================ from typing import List -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.SyntaxModel import ( SimpleName as VHDLModel_SimpleName, diff --git a/pyGHDL/dom/NonStandard.py b/pyGHDL/dom/NonStandard.py index b0242e260..f6f451325 100644 --- a/pyGHDL/dom/NonStandard.py +++ b/pyGHDL/dom/NonStandard.py @@ -40,7 +40,7 @@ import time from pathlib import Path from typing import Any -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.dom.Names import SimpleName from pyVHDLModel.SyntaxModel import ( diff --git a/pyGHDL/dom/Object.py b/pyGHDL/dom/Object.py index 351bcddf0..6d3472a6f 100644 --- a/pyGHDL/dom/Object.py +++ b/pyGHDL/dom/Object.py @@ -32,7 +32,7 @@ # ============================================================================ from typing import Union, List -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.SyntaxModel import ( Constant as VHDLModel_Constant, diff --git a/pyGHDL/dom/PSL.py b/pyGHDL/dom/PSL.py index 95ac72082..0217e0639 100644 --- a/pyGHDL/dom/PSL.py +++ b/pyGHDL/dom/PSL.py @@ -39,7 +39,7 @@ This module contains all DOM classes for VHDL's design units (:class:`context <E """ -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.PSLModel import ( VerificationUnit as VHDLModel_VerificationUnit, diff --git a/pyGHDL/dom/Range.py b/pyGHDL/dom/Range.py index f5153e67d..c6f783139 100644 --- a/pyGHDL/dom/Range.py +++ b/pyGHDL/dom/Range.py @@ -30,7 +30,7 @@ # # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.SyntaxModel import Range as VHDLModel_Range diff --git a/pyGHDL/dom/Sequential.py b/pyGHDL/dom/Sequential.py index 372939b28..35f7b0d4f 100644 --- a/pyGHDL/dom/Sequential.py +++ b/pyGHDL/dom/Sequential.py @@ -32,7 +32,7 @@ # ============================================================================ from typing import Iterable -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.dom.Concurrent import ( WaveformElement, diff --git a/pyGHDL/dom/Subprogram.py b/pyGHDL/dom/Subprogram.py index ac8916792..2e9c0116f 100644 --- a/pyGHDL/dom/Subprogram.py +++ b/pyGHDL/dom/Subprogram.py @@ -32,7 +32,7 @@ # ============================================================================ from typing import List -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.SyntaxModel import ( Function as VHDLModel_Function, diff --git a/pyGHDL/dom/Symbol.py b/pyGHDL/dom/Symbol.py index d290b3d70..c5ed39ba3 100644 --- a/pyGHDL/dom/Symbol.py +++ b/pyGHDL/dom/Symbol.py @@ -32,7 +32,7 @@ # ============================================================================ from typing import List, Iterator -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.SyntaxModel import ( EntitySymbol as VHDLModel_EntitySymbol, diff --git a/pyGHDL/dom/Type.py b/pyGHDL/dom/Type.py index 48cf50418..ba039852c 100644 --- a/pyGHDL/dom/Type.py +++ b/pyGHDL/dom/Type.py @@ -32,7 +32,7 @@ # ============================================================================ from typing import List, Union, Iterator, Tuple -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.SyntaxModel import ( AnonymousType as VHDLModel_AnonymousType, diff --git a/pyGHDL/dom/_Translate.py b/pyGHDL/dom/_Translate.py index fe66f2c98..ee1586e6b 100644 --- a/pyGHDL/dom/_Translate.py +++ b/pyGHDL/dom/_Translate.py @@ -32,7 +32,7 @@ # ============================================================================ from typing import List, Generator, Type -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.dom.Sequential import ( IfStatement, diff --git a/pyGHDL/dom/_Utils.py b/pyGHDL/dom/_Utils.py index c8a7a56ce..76dec9a06 100644 --- a/pyGHDL/dom/_Utils.py +++ b/pyGHDL/dom/_Utils.py @@ -30,7 +30,7 @@ # # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ -from pydecor import export +from pyTooling.Decorators import export from pyVHDLModel.SyntaxModel import Mode diff --git a/pyGHDL/dom/__init__.py b/pyGHDL/dom/__init__.py index dc58c42d0..f5d38fa09 100644 --- a/pyGHDL/dom/__init__.py +++ b/pyGHDL/dom/__init__.py @@ -32,7 +32,7 @@ # ============================================================================ from pathlib import Path -from pydecor import export +from pyTooling.Decorators import export from pyGHDL import GHDLBaseException from pyGHDL.libghdl import files_map, name_table diff --git a/pyGHDL/dom/formatting/prettyprint.py b/pyGHDL/dom/formatting/prettyprint.py index 4a28b9905..a72a32862 100644 --- a/pyGHDL/dom/formatting/prettyprint.py +++ b/pyGHDL/dom/formatting/prettyprint.py @@ -32,7 +32,7 @@ # ============================================================================ from typing import List, Union -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.dom.Concurrent import ( ConcurrentBlockStatement, diff --git a/pyGHDL/dom/requirements.txt b/pyGHDL/dom/requirements.txt index 18340052a..18b3495eb 100644 --- a/pyGHDL/dom/requirements.txt +++ b/pyGHDL/dom/requirements.txt @@ -1,4 +1,4 @@ -r ../libghdl/requirements.txt -pyVHDLModel==0.12.0 +pyVHDLModel==0.14.1 #https://github.com/VHDL/pyVHDLModel/archive/dev.zip#pyVHDLModel diff --git a/pyGHDL/libghdl/__init__.py b/pyGHDL/libghdl/__init__.py index 04cc387d9..372f5968b 100644 --- a/pyGHDL/libghdl/__init__.py +++ b/pyGHDL/libghdl/__init__.py @@ -38,13 +38,13 @@ from pathlib import Path from shutil import which from typing import List, Optional -from pydecor import export +from pyTooling.Decorators import export from pyGHDL import GHDLBaseException from pyGHDL.libghdl._types import Iir # from pyGHDL.libghdl._decorator import BindToLibGHDL -from pyGHDL.libghdl.version import __version__ +from pyGHDL import __version__ as ghdlVersion Nullable = Optional @@ -63,9 +63,9 @@ class LibGHDLException(GHDLBaseException): def _get_libghdl_name() -> Path: """Get the name of the libghdl library (with version and extension).""" - ver = __version__.replace("-", "_").replace(".", "_") + version = ghdlVersion.replace("-", "_").replace(".", "_") ext = {"win32": "dll", "cygwin": "dll", "msys": "dll", "darwin": "dylib"}.get(sys_platform, "so") - return Path("libghdl-{version}.{ext}".format(version=ver, ext=ext)) + return Path(f"libghdl-{version}.{ext}") def _check_libghdl_libdir(libdir: Path, basename: Path) -> Path: @@ -140,7 +140,7 @@ def _get_libghdl_path(): pass # Failed. - raise Exception("Cannot find libghdl {}".format(basename)) + raise Exception(f"Cannot find libghdl {basename}") def _initialize(): diff --git a/pyGHDL/libghdl/_decorator.py b/pyGHDL/libghdl/_decorator.py index 32a02930d..49694e8a3 100644 --- a/pyGHDL/libghdl/_decorator.py +++ b/pyGHDL/libghdl/_decorator.py @@ -46,7 +46,7 @@ from enum import IntEnum from functools import wraps from typing import Callable, List, Dict, Any, TypeVar -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl import libghdl, LibGHDLException diff --git a/pyGHDL/libghdl/_types.py b/pyGHDL/libghdl/_types.py index b3d4c92bb..a7247a0fd 100644 --- a/pyGHDL/libghdl/_types.py +++ b/pyGHDL/libghdl/_types.py @@ -31,7 +31,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ from enum import IntEnum, unique -from pydecor import export +from pyTooling.Decorators import export from ctypes import c_int32, c_uint32, c_int64, c_double, c_bool from typing import TypeVar diff --git a/pyGHDL/libghdl/errorout.py b/pyGHDL/libghdl/errorout.py index 4cdcdee56..5aa8de1c8 100644 --- a/pyGHDL/libghdl/errorout.py +++ b/pyGHDL/libghdl/errorout.py @@ -2,7 +2,7 @@ # Call 'make' in 'src/vhdl' to regenerate: # from enum import IntEnum, unique -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/errorout_console.py b/pyGHDL/libghdl/errorout_console.py index bb24079e1..826458a38 100644 --- a/pyGHDL/libghdl/errorout_console.py +++ b/pyGHDL/libghdl/errorout_console.py @@ -32,7 +32,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/errorout_memory.py b/pyGHDL/libghdl/errorout_memory.py index 3f85a03c9..bf60c53bb 100644 --- a/pyGHDL/libghdl/errorout_memory.py +++ b/pyGHDL/libghdl/errorout_memory.py @@ -34,7 +34,7 @@ from ctypes import c_int8, c_int32, c_char_p, Structure -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._types import ErrorIndex from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/files_map.py b/pyGHDL/libghdl/files_map.py index 277a00706..8f8cdf02c 100644 --- a/pyGHDL/libghdl/files_map.py +++ b/pyGHDL/libghdl/files_map.py @@ -32,7 +32,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._decorator import BindToLibGHDL from pyGHDL.libghdl._types import NameId, SourceFileEntry, LocationType diff --git a/pyGHDL/libghdl/files_map_editor.py b/pyGHDL/libghdl/files_map_editor.py index 9afd46bdc..a67766c44 100644 --- a/pyGHDL/libghdl/files_map_editor.py +++ b/pyGHDL/libghdl/files_map_editor.py @@ -34,7 +34,7 @@ from ctypes import c_int32, c_char_p, c_bool, c_uint32 -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl import libghdl from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/libraries.py b/pyGHDL/libghdl/libraries.py index 06b5f044c..fe09fa920 100644 --- a/pyGHDL/libghdl/libraries.py +++ b/pyGHDL/libghdl/libraries.py @@ -34,7 +34,7 @@ from ctypes import c_int32 -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl import libghdl from pyGHDL.libghdl._types import ( diff --git a/pyGHDL/libghdl/name_table.py b/pyGHDL/libghdl/name_table.py index 8718982af..b29775213 100644 --- a/pyGHDL/libghdl/name_table.py +++ b/pyGHDL/libghdl/name_table.py @@ -34,7 +34,7 @@ # from ctypes import c_char, c_char_p -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._types import NameId from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/requirements.txt b/pyGHDL/libghdl/requirements.txt index b0f362aea..a045a3d24 100644 --- a/pyGHDL/libghdl/requirements.txt +++ b/pyGHDL/libghdl/requirements.txt @@ -1 +1 @@ -pydecor>=2.0.1 +pyTooling>=1.6.0 diff --git a/pyGHDL/libghdl/std_names.py b/pyGHDL/libghdl/std_names.py index 098e2b34e..e6339520f 100644 --- a/pyGHDL/libghdl/std_names.py +++ b/pyGHDL/libghdl/std_names.py @@ -1,7 +1,7 @@ # Auto generated Python source file from Ada sources # Call 'make' in 'src/vhdl' to regenerate: # -from pydecor import export +from pyTooling.Decorators import export @export diff --git a/pyGHDL/libghdl/str_table.py b/pyGHDL/libghdl/str_table.py index f87e9db8b..a91268bb4 100644 --- a/pyGHDL/libghdl/str_table.py +++ b/pyGHDL/libghdl/str_table.py @@ -34,7 +34,7 @@ # from ctypes import c_char_p -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._types import String8Id from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/utils.py b/pyGHDL/libghdl/utils.py index 98e350e03..5fc62af91 100644 --- a/pyGHDL/libghdl/utils.py +++ b/pyGHDL/libghdl/utils.py @@ -34,7 +34,7 @@ from ctypes import byref from typing import List, Any, Generator -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._decorator import EnumLookupTable from pyGHDL.libghdl._types import NameId diff --git a/pyGHDL/libghdl/version.py b/pyGHDL/libghdl/version.py deleted file mode 100644 index eb436f1c7..000000000 --- a/pyGHDL/libghdl/version.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "2.0.0-dev" diff --git a/pyGHDL/libghdl/vhdl/elocations.py b/pyGHDL/libghdl/vhdl/elocations.py index dd3600ecf..e7282adb6 100644 --- a/pyGHDL/libghdl/vhdl/elocations.py +++ b/pyGHDL/libghdl/vhdl/elocations.py @@ -1,7 +1,7 @@ # Auto generated Python source file from Ada sources # Call 'make' in 'src/vhdl' to regenerate: # -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl import libghdl diff --git a/pyGHDL/libghdl/vhdl/flists.py b/pyGHDL/libghdl/vhdl/flists.py index 9d5b7fdb7..c62296307 100644 --- a/pyGHDL/libghdl/vhdl/flists.py +++ b/pyGHDL/libghdl/vhdl/flists.py @@ -33,7 +33,7 @@ # ============================================================================ from ctypes import c_int32 -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/vhdl/formatters.py b/pyGHDL/libghdl/vhdl/formatters.py index 72b72010e..90022320e 100644 --- a/pyGHDL/libghdl/vhdl/formatters.py +++ b/pyGHDL/libghdl/vhdl/formatters.py @@ -34,7 +34,7 @@ from ctypes import c_int32, c_char_p -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl import libghdl from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/vhdl/lists.py b/pyGHDL/libghdl/vhdl/lists.py index 6f8370a09..cc37e2dd8 100644 --- a/pyGHDL/libghdl/vhdl/lists.py +++ b/pyGHDL/libghdl/vhdl/lists.py @@ -34,7 +34,7 @@ from ctypes import c_int32, c_bool, POINTER, Structure -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl import libghdl from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/vhdl/nodes.py b/pyGHDL/libghdl/vhdl/nodes.py index 0ed86c49b..45b6d1ee6 100644 --- a/pyGHDL/libghdl/vhdl/nodes.py +++ b/pyGHDL/libghdl/vhdl/nodes.py @@ -2,7 +2,7 @@ # Call 'make' in 'src/vhdl' to regenerate: # from enum import IntEnum, unique -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/vhdl/nodes_meta.py b/pyGHDL/libghdl/vhdl/nodes_meta.py index 726d885be..4602d0ac2 100644 --- a/pyGHDL/libghdl/vhdl/nodes_meta.py +++ b/pyGHDL/libghdl/vhdl/nodes_meta.py @@ -2,7 +2,7 @@ # Call 'make' in 'src/vhdl' to regenerate: # from enum import IntEnum, unique -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/vhdl/nodes_utils.py b/pyGHDL/libghdl/vhdl/nodes_utils.py index 31d495d85..2871fab62 100644 --- a/pyGHDL/libghdl/vhdl/nodes_utils.py +++ b/pyGHDL/libghdl/vhdl/nodes_utils.py @@ -32,7 +32,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._types import Iir from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/vhdl/parse.py b/pyGHDL/libghdl/vhdl/parse.py index a61cdfef7..7c59d0df7 100644 --- a/pyGHDL/libghdl/vhdl/parse.py +++ b/pyGHDL/libghdl/vhdl/parse.py @@ -34,7 +34,7 @@ from ctypes import c_bool -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl import libghdl from pyGHDL.libghdl._types import Iir diff --git a/pyGHDL/libghdl/vhdl/scanner.py b/pyGHDL/libghdl/vhdl/scanner.py index f9db890a0..da6b63520 100644 --- a/pyGHDL/libghdl/vhdl/scanner.py +++ b/pyGHDL/libghdl/vhdl/scanner.py @@ -34,7 +34,7 @@ from ctypes import c_int, c_bool -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl import libghdl from pyGHDL.libghdl._types import SourceFileEntry, NameId diff --git a/pyGHDL/libghdl/vhdl/sem.py b/pyGHDL/libghdl/vhdl/sem.py index b1a2fee5f..7556d6f53 100644 --- a/pyGHDL/libghdl/vhdl/sem.py +++ b/pyGHDL/libghdl/vhdl/sem.py @@ -32,7 +32,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._types import Iir_Design_Unit from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/vhdl/sem_lib.py b/pyGHDL/libghdl/vhdl/sem_lib.py index 0126c1ef5..41d95e2e5 100644 --- a/pyGHDL/libghdl/vhdl/sem_lib.py +++ b/pyGHDL/libghdl/vhdl/sem_lib.py @@ -32,7 +32,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._types import SourceFileEntry, Iir_Design_File, Iir_Design_Unit from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyGHDL/libghdl/vhdl/tokens.py b/pyGHDL/libghdl/vhdl/tokens.py index 9e347eff8..10c14fc40 100644 --- a/pyGHDL/libghdl/vhdl/tokens.py +++ b/pyGHDL/libghdl/vhdl/tokens.py @@ -2,7 +2,7 @@ # Call 'make' in 'src/vhdl' to regenerate: # from enum import IntEnum, unique -from pydecor import export +from pyTooling.Decorators import export @export diff --git a/pyGHDL/libghdl/vhdl/utils.py b/pyGHDL/libghdl/vhdl/utils.py index c563ec9bd..3a82f45c0 100644 --- a/pyGHDL/libghdl/vhdl/utils.py +++ b/pyGHDL/libghdl/vhdl/utils.py @@ -32,7 +32,7 @@ # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ -from pydecor import export +from pyTooling.Decorators import export from pyGHDL.libghdl._types import Iir, NameId from pyGHDL.libghdl._decorator import BindToLibGHDL diff --git a/pyproject.toml b/pyproject.toml index 55ec8d784..c2ddfb778 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,10 @@ +[build-system] +requires = [ + "pyTooling >= 1.7.0", + "setuptools >= 35.0.2", + "wheel >= 0.29.0" +] +build-backend = "setuptools.build_meta" + [tool.black] line-length = 120 diff --git a/scripts/pnodespy.py b/scripts/pnodespy.py index f1f637ea7..90c827de9 100755 --- a/scripts/pnodespy.py +++ b/scripts/pnodespy.py @@ -35,7 +35,7 @@ def print_file_header(includeIntEnumUnique=True, includeBindToLibGHDL=True): # Auto generated Python source file from Ada sources # Call 'make' in 'src/vhdl' to regenerate: # - """) + "{sysImports}from pydecor import export\n{moduleImports}".format( + """) + "{sysImports}from pyTooling.Decorators import export\n{moduleImports}".format( sysImports = "from enum import IntEnum, unique\n" if includeIntEnumUnique else "", moduleImports = "\nfrom pyGHDL.libghdl._decorator import BindToLibGHDL\n" if includeBindToLibGHDL else "", ) @@ -32,116 +32,29 @@ # # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ - -from pathlib import Path -from re import compile as re_compile -from typing import List - -from setuptools import ( - setup as setuptools_setup, - find_packages as setuptools_find_packages, -) +# +from pathlib import Path +from pyTooling.Licensing import GPL_2_0_or_later +from pyTooling.Packaging import DescribePythonPackageHostedOnGitHub gitHubNamespace = "ghdl" -projectName = "ghdl" -packageName = "pyGHDL" -packagePath = Path(packageName) - -readmeFile = packagePath / "README.md" -requirementsFile = packagePath / "requirements.txt" - - -# Read (local) README for upload to PyPI -def get_description(file: Path) -> str: - with file.open("r") as fh: - description = fh.read() - return description - - -# Read requirements file and add them to package dependency list -def get_requirements(file: Path) -> List[str]: - requirements = [] - with file.open("r") as fh: - for line in fh.read().splitlines(): - if line.startswith("#") or line == "": - continue - elif line.startswith("-r"): - # Remove the first word/argument (-r) - filename = " ".join(line.split(" ")[1:]) - requirements += get_requirements(file.parent / filename) - elif line.startswith("https"): - # Convert 'URL#NAME' to 'NAME @ URL' - splitItems = line.split("#") - requirements.append("{} @ {}".format(splitItems[1], splitItems[0])) - else: - requirements.append(line) - return requirements - - -def get_version(): - # Try from version.py. Reads it to avoid loading the shared library. - pattern = re_compile('^__version__ = "(.*)"\n') - try: - line = open("pyGHDL/libghdl/version.py").read() - match = pattern.match(line) - if match: - return match.group(1) - except Exception: - pass - - raise Exception("Cannot find version") - - -# Derive URLs -sourceCodeURL = "https://github.com/{namespace}/{projectName}".format( - namespace=gitHubNamespace, projectName=projectName -) -documentationURL = ( - "https://{namespace}.github.io/{projectName}/using/py/index.html".format( - namespace=gitHubNamespace, projectName=projectName - ) -) -requirements = list(set(get_requirements(requirementsFile))) - +packageName = "pyGHDL" +packageDirectory = packageName +packageInformationFile = Path(f"{packageDirectory}/__init__.py") +requirementsFile = Path(f"{packageDirectory}/requirements.txt") -# Assemble all package information -setuptools_setup( - name=packageName, - version=get_version(), - author="Tristan Gingold", - author_email="tgingold@free.fr", - license="GPL-2.0-or-later", +DescribePythonPackageHostedOnGitHub( + packageName=packageName, description="Python binding for GHDL and high-level APIs (incl. LSP).", - long_description=get_description(readmeFile), - long_description_content_type="text/markdown", - url=sourceCodeURL, - project_urls={ - "Documentation": documentationURL, - "Source Code": sourceCodeURL, - "Issue Tracker": sourceCodeURL + "/issues", - }, - python_requires=">=3.6", - install_requires=requirements, - packages=setuptools_find_packages(exclude=("tests",)), - entry_points={ - "console_scripts": [ - "ghdl-ls = pyGHDL.cli.lsp:main", - "ghdl-dom = pyGHDL.cli.dom:main", - ] - }, - keywords="Python3 VHDL Parser Compiler Simulator GHDL", + license=GPL_2_0_or_later, + gitHubNamespace=gitHubNamespace, + sourceFileWithVersion=packageInformationFile, + requirementsFile=requirementsFile, + developmentStatus="beta", classifiers=[ - "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows :: Windows 10", "Operating System :: POSIX :: Linux", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Development Status :: 4 - Beta", - # "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)", "Topic :: Software Development :: Code Generators", @@ -149,4 +62,8 @@ setuptools_setup( "Topic :: Software Development :: Testing", "Topic :: Utilities", ], + consoleScripts={ + "ghdl-ls": "pyGHDL.cli.lsp:main", + "ghdl-dom": "pyGHDL.cli.dom:main" + } ) |