Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Quartus version detection for optional patches #375

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions edalize/quartus.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,28 @@ def __init__(self, edam=None, work_root=None, eda_api=None, verbose=False):
"edition": "Standard",
}
try:
qsh_text = subprocess.Popen(
["quartus_sh", "--version"], stdout=subprocess.PIPE, env=os.environ
).communicate()[0]
qsh_text = subprocess.run(
["quartus_sh", "--version"],
stdout=subprocess.PIPE,
universal_newlines=True,
).stdout

# Attempt to pattern match the output. Examples include
# Version 16.1.2 Build 203 01/18/2017 SJ Standard Edition
# Version 17.1.2 Build 304 01/31/2018 SJ Pro Edition
version_exp = (
r"Version (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+) "
+ r"Build (?P<build>\d+) (?P<date>\d{2}/\d{2}/\d{4}) (?:\w+) "
+ r"Build (?P<build>\d+) (?P<date>\d{2}/\d{2}/\d{4}) "
+ r"(?:Patches \d+\.\d+\w* )?(?:\w+) "
+ r"(?P<edition>(Lite|Standard|Pro)) Edition"
)

match = re.search(version_exp, str(qsh_text))
match = re.search(version_exp, qsh_text)
if match != None:
version = match.groupdict()
except:
else:
logger.warning("Unable to recognise Quartus version via quartus_sh")
except FileNotFoundError:
# It is possible for this to have been run on a box without
# Quartus being installed. Allow these errors to be ignored
logger.warning("Unable to recognise Quartus version via quartus_sh")
Expand Down