diff options
author | akastornov <akastornov@yandex-team.ru> | 2022-02-10 16:46:03 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:03 +0300 |
commit | 3a2de774d91ca8d7325aaf81c200b1d2047725e6 (patch) | |
tree | 5674a780ce03a8bbd794733a19c7a70d587e4a14 /build/scripts/collect_java_srcs.py | |
parent | 7bd11ff35e97544d119e43447e3e865f2588ee7f (diff) | |
download | ydb-3a2de774d91ca8d7325aaf81c200b1d2047725e6.tar.gz |
Restoring authorship annotation for <akastornov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build/scripts/collect_java_srcs.py')
-rw-r--r-- | build/scripts/collect_java_srcs.py | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/build/scripts/collect_java_srcs.py b/build/scripts/collect_java_srcs.py index 170002520a..a8056932cc 100644 --- a/build/scripts/collect_java_srcs.py +++ b/build/scripts/collect_java_srcs.py @@ -1,51 +1,51 @@ -import os -import sys -import contextlib -import tarfile -import zipfile - - -if __name__ == '__main__': - build_root = sys.argv[1] +import os +import sys +import contextlib +import tarfile +import zipfile + + +if __name__ == '__main__': + build_root = sys.argv[1] root = os.path.normpath(sys.argv[2]) dest = os.path.normpath(sys.argv[3]) - srcs = sys.argv[4:] - - for src in srcs: + srcs = sys.argv[4:] + + for src in srcs: src = os.path.normpath(src) if src.endswith('.java') or src.endswith('.kt'): - src_rel_path = os.path.relpath(src, root) - - if os.path.join(root, src_rel_path) == src: - # Inside root - dst = os.path.join(dest, src_rel_path) - - else: - # Outside root + src_rel_path = os.path.relpath(src, root) + + if os.path.join(root, src_rel_path) == src: + # Inside root + dst = os.path.join(dest, src_rel_path) + + else: + # Outside root print>>sys.stderr, 'External src file "{}" is outside of srcdir {}, ignore'.format( - os.path.relpath(src, build_root), - os.path.relpath(root, build_root), - ) - continue - - if os.path.exists(dst): - print>>sys.stderr, 'Duplicate external src file {}, choice is undefined'.format( - os.path.relpath(dst, root) - ) - - else: + os.path.relpath(src, build_root), + os.path.relpath(root, build_root), + ) + continue + + if os.path.exists(dst): + print>>sys.stderr, 'Duplicate external src file {}, choice is undefined'.format( + os.path.relpath(dst, root) + ) + + else: destdir = os.path.dirname(dst) if destdir and not os.path.exists(destdir): os.makedirs(destdir) os.rename(src, dst) - - elif src.endswith('.jsr'): - with contextlib.closing(tarfile.open(src, 'r')) as tf: - tf.extractall(dst) - - elif src.endswith('-sources.jar'): + + elif src.endswith('.jsr'): + with contextlib.closing(tarfile.open(src, 'r')) as tf: + tf.extractall(dst) + + elif src.endswith('-sources.jar'): with zipfile.ZipFile(src) as zf: - zf.extractall(dst) - - else: - print>>sys.stderr, 'Unrecognized file type', os.path.relpath(src, build_root) + zf.extractall(dst) + + else: + print>>sys.stderr, 'Unrecognized file type', os.path.relpath(src, build_root) |