diff options
author | heretic <heretic@yandex-team.ru> | 2022-02-10 16:45:43 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:43 +0300 |
commit | 397cbe258b9e064f49c4ca575279f02f39fef76e (patch) | |
tree | a0b0eb3cca6a14e4e8ea715393637672fa651284 /build/scripts/fix_java_command_file_cp.py | |
parent | 43f5a35593ebc9f6bcea619bb170394ea7ae468e (diff) | |
download | ydb-397cbe258b9e064f49c4ca575279f02f39fef76e.tar.gz |
Restoring authorship annotation for <heretic@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build/scripts/fix_java_command_file_cp.py')
-rw-r--r-- | build/scripts/fix_java_command_file_cp.py | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/build/scripts/fix_java_command_file_cp.py b/build/scripts/fix_java_command_file_cp.py index fc87048c32..6497733b73 100644 --- a/build/scripts/fix_java_command_file_cp.py +++ b/build/scripts/fix_java_command_file_cp.py @@ -1,34 +1,34 @@ -import sys -import os -import argparse -import subprocess -import platform - - -def fix_files(args): - args = args[:] - parser = argparse.ArgumentParser() - parser.add_argument('--build-root', default=None) - args, tail = parser.parse_known_args(args) - for idx, arg in list(enumerate(tail)): - if arg.startswith('@') and os.path.isfile(arg[1:]): - with open(arg[1:]) as f: - fixed = [i.strip() for i in f] - if args.build_root: +import sys +import os +import argparse +import subprocess +import platform + + +def fix_files(args): + args = args[:] + parser = argparse.ArgumentParser() + parser.add_argument('--build-root', default=None) + args, tail = parser.parse_known_args(args) + for idx, arg in list(enumerate(tail)): + if arg.startswith('@') and os.path.isfile(arg[1:]): + with open(arg[1:]) as f: + fixed = [i.strip() for i in f] + if args.build_root: fixed = [os.path.join(args.build_root, i) for ln in fixed for i in ln.split(os.path.pathsep)] - fixed = os.pathsep.join([i.strip() for i in fixed]) - fixed_name = list(os.path.splitext(arg)) - fixed_name[0] += '_fixed' - fixed_name = ''.join(fixed_name) - with open(fixed_name[1:], 'w') as f: - f.write(fixed) - tail[idx:idx + 1] = [fixed_name] - return tail - - -if __name__ == '__main__': - args = fix_files(sys.argv[1:]) - if platform.system() == 'Windows': - sys.exit(subprocess.Popen(args).wait()) - else: - os.execv(args[0], args) + fixed = os.pathsep.join([i.strip() for i in fixed]) + fixed_name = list(os.path.splitext(arg)) + fixed_name[0] += '_fixed' + fixed_name = ''.join(fixed_name) + with open(fixed_name[1:], 'w') as f: + f.write(fixed) + tail[idx:idx + 1] = [fixed_name] + return tail + + +if __name__ == '__main__': + args = fix_files(sys.argv[1:]) + if platform.system() == 'Windows': + sys.exit(subprocess.Popen(args).wait()) + else: + os.execv(args[0], args) |