forked from VUnit/vunit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
import logging | ||
import subprocess | ||
import shlex | ||
import re | ||
from json import dump | ||
from sys import stdout # To avoid output catched in non-verbose mode | ||
from warnings import warn | ||
|
@@ -115,6 +116,15 @@ def has_valid_exit_code(self): | |
""" | ||
return self._vhdl_standard >= VHDL.STD_2008 | ||
|
||
@classmethod | ||
def _get_version_output(cls, prefix): | ||
""" | ||
Get the output of 'ghdl --version' | ||
""" | ||
return subprocess.check_output( | ||
[join(prefix, cls.executable), "--version"] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
eine
Author
Owner
|
||
).decode() | ||
|
||
@classmethod | ||
def determine_backend(cls, prefix): | ||
""" | ||
|
@@ -125,9 +135,7 @@ def determine_backend(cls, prefix): | |
"llvm code generator": "llvm", | ||
"GCC back-end code generator": "gcc", | ||
} | ||
output = subprocess.check_output( | ||
[join(prefix, cls.executable), "--version"] | ||
).decode() | ||
output = cls._get_version_output(prefix) | ||
for name, backend in mapping.items(): | ||
if name in output: | ||
LOGGER.debug("Detected GHDL %s", name) | ||
|
@@ -142,12 +150,26 @@ def determine_backend(cls, prefix): | |
"No known GHDL back-end could be detected from running 'ghdl --version'" | ||
) | ||
|
||
@classmethod | ||
def determine_version(cls, prefix): | ||
""" | ||
Determine the GHDL version | ||
""" | ||
return float( | ||
re.match( | ||
r"GHDL ([0-9]*\.[0-9]*).*\(.*\) \[Dunoon edition\]", | ||
cls._get_version_output(prefix), | ||
).group(1) | ||
) | ||
|
||
@classmethod | ||
def supports_vhpi(cls): | ||
""" | ||
Return if the simulator supports VHPI | ||
""" | ||
return cls.determine_backend(cls.find_prefix_from_path()) != "mcode" | ||
return (cls.determine_backend(cls.find_prefix_from_path()) != "mcode") or ( | ||
cls.determine_version(cls.find_prefix_from_path()) > 0.36 | ||
) | ||
|
||
def _has_output_flag(self): | ||
""" | ||
|
Remove use of join?