aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/run_javac.py
diff options
context:
space:
mode:
authorakastornov <akastornov@yandex-team.ru>2022-02-10 16:46:03 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:03 +0300
commit8d3a5ed3a188a34167eaee54f1691ce5c9edf2f3 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /build/scripts/run_javac.py
parent3a2de774d91ca8d7325aaf81c200b1d2047725e6 (diff)
downloadydb-8d3a5ed3a188a34167eaee54f1691ce5c9edf2f3.tar.gz
Restoring authorship annotation for <akastornov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'build/scripts/run_javac.py')
-rw-r--r--build/scripts/run_javac.py142
1 files changed, 71 insertions, 71 deletions
diff --git a/build/scripts/run_javac.py b/build/scripts/run_javac.py
index 2a870af7715..c35546e0fef 100644
--- a/build/scripts/run_javac.py
+++ b/build/scripts/run_javac.py
@@ -1,47 +1,47 @@
-import sys
-import subprocess
-import optparse
-import re
-
-
-def parse_args():
- parser = optparse.OptionParser()
- parser.disable_interspersed_args()
- parser.add_option('--sources-list')
- parser.add_option('--verbose', default=False, action='store_true')
- parser.add_option('--remove-notes', default=False, action='store_true')
+import sys
+import subprocess
+import optparse
+import re
+
+
+def parse_args():
+ parser = optparse.OptionParser()
+ parser.disable_interspersed_args()
+ parser.add_option('--sources-list')
+ parser.add_option('--verbose', default=False, action='store_true')
+ parser.add_option('--remove-notes', default=False, action='store_true')
parser.add_option('--ignore-errors', default=False, action='store_true')
parser.add_option('--kotlin', default=False, action='store_true')
- return parser.parse_args()
-
-
-COLORING = {
- r'^(?P<path>.*):(?P<line>\d*): error: (?P<msg>.*)': lambda m: '[[unimp]]{path}[[rst]]:[[alt2]]{line}[[rst]]: [[c:light-red]]error[[rst]]: [[bad]]{msg}[[rst]]'.format(
- path=m.group('path'),
- line=m.group('line'),
- msg=m.group('msg'),
- ),
- r'^(?P<path>.*):(?P<line>\d*): warning: (?P<msg>.*)': lambda m: '[[unimp]]{path}[[rst]]:[[alt2]]{line}[[rst]]: [[c:light-yellow]]warning[[rst]]: {msg}'.format(
- path=m.group('path'),
- line=m.group('line'),
- msg=m.group('msg'),
- ),
- r'^warning: ': lambda m: '[[c:light-yellow]]warning[[rst]]: ',
- r'^error: (?P<msg>.*)': lambda m: '[[c:light-red]]error[[rst]]: [[bad]]{msg}[[rst]]'.format(msg=m.group('msg')),
- r'^Note: ': lambda m: '[[c:light-cyan]]Note[[rst]]: ',
-}
-
-
-def colorize(err):
- for regex, sub in COLORING.iteritems():
- err = re.sub(regex, sub, err, flags=re.MULTILINE)
- return err
-
-
-def remove_notes(err):
- return '\n'.join([line for line in err.split('\n') if not line.startswith('Note:')])
-
-
+ return parser.parse_args()
+
+
+COLORING = {
+ r'^(?P<path>.*):(?P<line>\d*): error: (?P<msg>.*)': lambda m: '[[unimp]]{path}[[rst]]:[[alt2]]{line}[[rst]]: [[c:light-red]]error[[rst]]: [[bad]]{msg}[[rst]]'.format(
+ path=m.group('path'),
+ line=m.group('line'),
+ msg=m.group('msg'),
+ ),
+ r'^(?P<path>.*):(?P<line>\d*): warning: (?P<msg>.*)': lambda m: '[[unimp]]{path}[[rst]]:[[alt2]]{line}[[rst]]: [[c:light-yellow]]warning[[rst]]: {msg}'.format(
+ path=m.group('path'),
+ line=m.group('line'),
+ msg=m.group('msg'),
+ ),
+ r'^warning: ': lambda m: '[[c:light-yellow]]warning[[rst]]: ',
+ r'^error: (?P<msg>.*)': lambda m: '[[c:light-red]]error[[rst]]: [[bad]]{msg}[[rst]]'.format(msg=m.group('msg')),
+ r'^Note: ': lambda m: '[[c:light-cyan]]Note[[rst]]: ',
+}
+
+
+def colorize(err):
+ for regex, sub in COLORING.iteritems():
+ err = re.sub(regex, sub, err, flags=re.MULTILINE)
+ return err
+
+
+def remove_notes(err):
+ return '\n'.join([line for line in err.split('\n') if not line.startswith('Note:')])
+
+
def find_javac(cmd):
if not cmd:
return None
@@ -84,39 +84,39 @@ def fix_cmd(cmd):
return cmd
-def main():
- opts, cmd = parse_args()
-
- with open(opts.sources_list) as f:
- input_files = f.read().strip().split()
-
+def main():
+ opts, cmd = parse_args()
+
+ with open(opts.sources_list) as f:
+ input_files = f.read().strip().split()
+
if opts.kotlin:
input_files = [i for i in input_files if i.endswith('.kt')]
- if not input_files:
- if opts.verbose:
- sys.stderr.write('No files to compile, javac is not launched.\n')
-
- else:
+ if not input_files:
+ if opts.verbose:
+ sys.stderr.write('No files to compile, javac is not launched.\n')
+
+ else:
p = subprocess.Popen(fix_cmd(cmd), stderr=subprocess.PIPE)
- _, err = p.communicate()
- rc = p.wait()
-
- if opts.remove_notes:
- err = remove_notes(err)
-
- try:
- err = colorize(err)
-
- except Exception:
- pass
-
+ _, err = p.communicate()
+ rc = p.wait()
+
+ if opts.remove_notes:
+ err = remove_notes(err)
+
+ try:
+ err = colorize(err)
+
+ except Exception:
+ pass
+
if opts.ignore_errors and rc:
sys.stderr.write('error: javac actually failed with exit code {}\n'.format(rc))
rc = 0
- sys.stderr.write(err)
- sys.exit(rc)
-
-
-if __name__ == '__main__':
- main()
+ sys.stderr.write(err)
+ sys.exit(rc)
+
+
+if __name__ == '__main__':
+ main()