diff options
Diffstat (limited to 'tools/progress_dashboard.py')
| -rw-r--r-- | tools/progress_dashboard.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/progress_dashboard.py b/tools/progress_dashboard.py index bbb338853..882cdfdd3 100644 --- a/tools/progress_dashboard.py +++ b/tools/progress_dashboard.py | |||
| @@ -100,14 +100,25 @@ HOME = os.path.expanduser("~") | |||
| 100 | 100 | ||
| 101 | 101 | ||
| 102 | def scrub(text, limit=240): | 102 | def scrub(text, limit=240): |
| 103 | """One line of tool output, with the user's home folder and drive paths reduced to their last component.""" | 103 | """One line of tool output with every absolute path replaced: a path inside the repository becomes its relative |
| 104 | path, any other path (the work folder, the home folder, a temp folder) becomes <path>, file name included, since | ||
| 105 | a file name outside the repository can be a carved shader's name.""" | ||
| 104 | if not text: | 106 | if not text: |
| 105 | return "" | 107 | return "" |
| 106 | line = text.strip().splitlines()[-1] if text.strip() else "" | 108 | line = text.strip().splitlines()[-1] if text.strip() else "" |
| 109 | |||
| 110 | def shown(m): | ||
| 111 | path = m.group(0) | ||
| 112 | if inside(path, ROOT): | ||
| 113 | rel = os.path.relpath(os.path.realpath(path), os.path.realpath(ROOT)).replace(os.sep, "/") | ||
| 114 | return "." if rel == "." else rel | ||
| 115 | return "<path>" | ||
| 116 | |||
| 117 | line = re.sub(r"(?i)\b[a-z]:[\\/][^\s'\"]*", shown, line) | ||
| 118 | line = re.sub(r"(?<![\w.:/~])/[^\s/'\"][^\s'\"]*", shown, line) | ||
| 107 | if HOME and len(HOME) > 3: | 119 | if HOME and len(HOME) > 3: |
| 108 | line = line.replace(HOME, "~") | 120 | line = line.replace(HOME, "~") |
| 109 | line = re.sub(r"(?i)\b[a-z]:[\\/](?:[^\s\\/:'\"]+[\\/])+([^\s\\/'\"]+)", r"<path>/\1", line) | 121 | line = re.sub(r"~[\\/][^\s'\"]*", "<path>", line) |
| 110 | line = re.sub(r"(?<![\w.])/(?:[^\s/'\"]+/)+([^\s/'\"]+)", r"<path>/\1", line) | ||
| 111 | return line[:limit] | 122 | return line[:limit] |
| 112 | 123 | ||
| 113 | 124 | ||