Skip to content

Commit

Permalink
run_ivl.py: Properly escape . in regex
Browse files Browse the repository at this point in the history
To escape the `.` in the regex it needs to be prefixed with a `\`. But
since the `\` is a escape character in python strings it needs to be
escaped as well.

Without this some versions of python print the following warning:

      run_ivl.py:36: SyntaxWarning: invalid escape sequence '\.'
        match= re.search(b'Icarus Verilog version ([0-9]+)\.([0-9]+)', text)

Signed-off-by: Lars-Peter Clausen <[email protected]>
  • Loading branch information
larsclausen committed Jan 15, 2024
1 parent b1e602d commit c93e833
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ivtest/run_ivl.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_ivl_version () -> list:

# Get the output from the "iverilog -V" command for the version string.
text = subprocess.check_output(["iverilog", "-V"])
match = re.search(b'Icarus Verilog version ([0-9]+)\.([0-9]+)', text)
match = re.search(b'Icarus Verilog version ([0-9]+)\\.([0-9]+)', text)
if not match:
return None

Expand Down

0 comments on commit c93e833

Please sign in to comment.