aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/extract_jacoco_report.py
diff options
context:
space:
mode:
authoralexv-smirnov <alex@ydb.tech>2023-06-13 11:05:01 +0300
committeralexv-smirnov <alex@ydb.tech>2023-06-13 11:05:01 +0300
commitbf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0 (patch)
tree1d1df72c0541a59a81439842f46d95396d3e7189 /build/scripts/extract_jacoco_report.py
parent8bfdfa9a9bd19bddbc58d888e180fbd1218681be (diff)
downloadydb-bf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0.tar.gz
add ymake export to ydb
Diffstat (limited to 'build/scripts/extract_jacoco_report.py')
-rw-r--r--build/scripts/extract_jacoco_report.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/build/scripts/extract_jacoco_report.py b/build/scripts/extract_jacoco_report.py
new file mode 100644
index 0000000000..02e4ba9f13
--- /dev/null
+++ b/build/scripts/extract_jacoco_report.py
@@ -0,0 +1,29 @@
+import argparse
+import os
+import re
+import tarfile
+
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+
+ parser.add_argument('--archive', action='store')
+ parser.add_argument('--source-re', action='store')
+ parser.add_argument('--destination', action='store')
+
+ args = parser.parse_args()
+
+ with tarfile.open(args.archive) as tf:
+ open(args.destination, 'wb').close()
+ extract_list = []
+ matcher = re.compile(args.source_re)
+ temp_dir = os.path.join(os.path.dirname(args.destination), 'temp_profiles')
+ if not os.path.exists(temp_dir):
+ os.makedirs(temp_dir)
+ for f in [i for i in tf if matcher.match(i.name)]:
+ tf.extract(f, path=temp_dir)
+ for directory, _, srcs in os.walk(temp_dir):
+ for f in srcs:
+ with open(args.destination, 'ab') as dst:
+ with open(os.path.join(temp_dir, directory, f), 'rb') as src:
+ dst.write(src.read())