David Blume's GitList
Repositories
testcode.git
Code
Commits
Branches
Tags
Search
Tree:
6c9321d
Branches
Tags
c++11
main
start
testcode.git
make_path_helper
first commit
David Blume
commited
6c9321d
at 2015-11-07 22:13:58
make_path_helper
Blame
History
Raw
#!/usr/bin/env python # See http://www.sublimetext.com/forum/viewtopic.php?f=3&t=12028 import sys import os.path import re cdir = "" enter_re = re.compile(r"make\[[0-9]+\]: Entering directory\s+'(.*)'") err_re = re.compile(r"(..[^:\n]*):([0-9]+:?[0-9]+?:? .*)$") for line in iter(sys.stdin.readline, b''): err = re.match(err_re, line) if err: sys.stdout.write("{0}/{1}:{2}\n".format(cdir, err.group(1), err.group(2))) continue enter = re.match(enter_re, line) if enter: cdir = os.path.relpath(enter.group(1)) continue sys.stdout.write(line)