Commit 24d07ff0 authored by Vincent A's avatar Vincent A

tools/stable_backport: force manual backports to be reimported

parent 30685e73
......@@ -147,6 +147,11 @@ class ImportErrorError(Error):
class ManualBackport(Error):
def fixup(self):
def replace_all(expr, dest):
system(r"""for file in $(git ls-files modules | grep '\.py$');
......@@ -195,6 +200,21 @@ class StableBackport(object):
dirnames[path.dirname(filename)].append(self.errors[error](filename, linenum, msg))
with log('Searching manual backports'):
for manual in MANUAL_PORTS:
r = check_output("grep -nEr '^from %s import ' modules" % manual, shell=True).strip().decode('utf-8')
for line in r.split('\n'):
m = re.match(r'([\w\./]+):(\d+):.*', line)
filename =
linenum =
target = dirnames[path.dirname(filename)]
for err in target:
if err.filename == filename and err.linenum == linenum:
# an error was already spot on this line
target.append(ManualBackport(filename, linenum, manual))
for dirname, errors in sorted(dirnames.items()):
with log('Fixing up %s errors in %s' % (colored(str(len(errors)), 'magenta'),
colored(dirname, 'yellow'))):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment