Skip to content

Commit

Permalink
scons: apio upload: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Mar 8, 2024
1 parent 5d8073e commit 89cdb52
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions apio/managers/scons.py
Original file line number Diff line number Diff line change
Expand Up @@ -1004,10 +1004,24 @@ def _on_stderr(line: str):
if not line:
return

# -- TODO: document it!!
if "%|" in line and "100%|" not in line:
# ------- tinyprog output processing BEGIN
# -- Check if the line correspond to an output of
# -- the tinyprog programmer (TinyFPGA board)
# -- Match outputs like these " 97%|█████████▋| "
# -- Regular expression remainder:
# -- \s --> Match one blank space
# -- \d{2} one or two decimal digits
pattern_tinyprog = r"\s\d{2}%|█*\s+|\s"

# -- Calculate if there is a match
match_tinyprog = re.search(pattern_tinyprog, line)

# -- Math all the progress bar lines except the
# -- initial one (when it is 0%)
if match_tinyprog and " 0%|" not in line:
# -- Delete the previous line
print(CURSOR_UP + ERASE_LINE + "*", end="")
print(CURSOR_UP + ERASE_LINE, end="")
# ------- tinyprog output processing END

# ------- iceprog output processing BEGIN
# -- Match outputs like these "addr 0x001400 3%"
Expand Down

0 comments on commit 89cdb52

Please sign in to comment.