aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@plc2.de>2020-12-31 10:12:24 +0100
committertgingold <tgingold@users.noreply.github.com>2020-12-31 10:47:59 +0100
commitb6e0bc6bc04fb4e7d0546f1eaeeb44a9bf1ec43a (patch)
tree20310cf7f8b896eb0d0876c3a69cadda96116f5c
parent3f70363ee3ea05501d5b7ba84070808ac8721847 (diff)
downloadghdl-b6e0bc6bc04fb4e7d0546f1eaeeb44a9bf1ec43a.tar.gz
ghdl-b6e0bc6bc04fb4e7d0546f1eaeeb44a9bf1ec43a.tar.bz2
ghdl-b6e0bc6bc04fb4e7d0546f1eaeeb44a9bf1ec43a.zip
Modified docstrings and other minor changes.
-rw-r--r--pyGHDL/libghdl/__init__.py34
1 files changed, 21 insertions, 13 deletions
diff --git a/pyGHDL/libghdl/__init__.py b/pyGHDL/libghdl/__init__.py
index d59803d68..2b72736dc 100644
--- a/pyGHDL/libghdl/__init__.py
+++ b/pyGHDL/libghdl/__init__.py
@@ -48,7 +48,7 @@ def _get_libghdl_name():
"""Get the name of the libghdl library (with version and extension)"""
ver = __version__.replace("-", "_").replace(".", "_")
ext = {"win32": "dll", "cygwin": "dll", "darwin": "dylib"}.get(sys.platform, "so")
- return "libghdl-" + ver + "." + ext
+ return "libghdl-{version}.{ext}".format(version=ver, ext=ext)
def _check_libghdl_libdir(libdir, basename):
@@ -81,6 +81,7 @@ def _get_libghdl_path():
5. Try when running from the build directory.
"""
basename = _get_libghdl_name()
+
# Try GHDL_PREFIX
r = os.environ.get("GHDL_PREFIX")
if r is not None:
@@ -125,37 +126,44 @@ libghdl.libghdl_init()
# Then 'normal' initialization (set hooks)
libghdl.libghdl__set_hooks_for_analysis()
-# Set the prefix in order to locate the vhdl libraries.
+# Set the prefix in order to locate the VHDL libraries.
libghdl.libghdl__set_exec_prefix(
*_to_char_p(dirname(dirname(_libghdl_path)).encode("utf-8"))
)
-def finalize():
- "Free all the memory, be ready for a new initialization"
+def finalize() -> None:
+ """Free all the memory, be ready for a new initialization."""
libghdl.options__finalize()
-def initialize():
- "Initialize or re-initialize the library"
+def initialize() -> None:
+ """Initialize or re-initialize the shared library."""
libghdl.options__initialize()
-def set_option(opt):
- "Set option OPT. Return true iff the option is known and handled"
+def set_option(opt: bytes) -> bool:
+ """Set option :param:`opt`. Return true, if the option is known and handled."""
return libghdl.libghdl__set_option(*_to_char_p(opt)) == 0
-def analyze_init():
- # Deprecated as it may raise an exception. Use analyze_init_status
+def analyze_init() -> None:
+ """
+ Initialize the analyzer.
+
+ .. deprecated:: 1.0.0
+ Deprecated as it may raise an exception. Use :func:`analyze_init_status`.
+ """
libghdl.libghdl__analyze_init()
-def analyze_init_status():
- # Return 0 in case of success
+def analyze_init_status() -> int:
+ """Initialize the analyzer. Returns 0 in case of success."""
return libghdl.libghdl__analyze_init_status()
-def analyze_file(fname):
+def analyze_file(fname: bytes):
+ """"Analyze a given filename :param:`fname`."""
return libghdl.libghdl__analyze_file(*_to_char_p(fname))
def disp_config():
+ """"Display the configured prefixes for libghdl."""
return libghdl.ghdllocal__disp_config_prefixes()