aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/fs_tools.py
diff options
context:
space:
mode:
authorsvidyuk <svidyuk@yandex-team.ru>2022-02-10 16:47:12 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:12 +0300
commite23df0602fedd83374b43b6137a296baa2aad3f6 (patch)
tree1facb78b6535ac70f17ba39ed606d949f932fcea /build/scripts/fs_tools.py
parent92661c40a019d4809586c8ce322075d197427346 (diff)
downloadydb-e23df0602fedd83374b43b6137a296baa2aad3f6.tar.gz
Restoring authorship annotation for <svidyuk@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build/scripts/fs_tools.py')
-rw-r--r--build/scripts/fs_tools.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/build/scripts/fs_tools.py b/build/scripts/fs_tools.py
index dec4c349c8..f58cce00b6 100644
--- a/build/scripts/fs_tools.py
+++ b/build/scripts/fs_tools.py
@@ -1,28 +1,28 @@
-from __future__ import print_function
-
+from __future__ import print_function
+
import os
import platform
import sys
import shutil
-import errno
+import errno
import process_command_files as pcf
-def link_or_copy(src, dst):
- try:
- if platform.system().lower() == 'windows':
- shutil.copy(src, dst)
- else:
- os.link(src, dst)
- except OSError as e:
- if e.errno == errno.EEXIST:
- print('link_or_copy: destination file already exists: {}'.format(dst), file=sys.stderr)
- if e.errno == errno.ENOENT:
- print('link_or_copy: source file doesn\'t exists: {}'.format(src), file=sys.stderr)
- raise
-
-
+def link_or_copy(src, dst):
+ try:
+ if platform.system().lower() == 'windows':
+ shutil.copy(src, dst)
+ else:
+ os.link(src, dst)
+ except OSError as e:
+ if e.errno == errno.EEXIST:
+ print('link_or_copy: destination file already exists: {}'.format(dst), file=sys.stderr)
+ if e.errno == errno.ENOENT:
+ print('link_or_copy: source file doesn\'t exists: {}'.format(src), file=sys.stderr)
+ raise
+
+
if __name__ == '__main__':
mode = sys.argv[1]
args = pcf.get_args(sys.argv[2:])
@@ -79,17 +79,17 @@ if __name__ == '__main__':
except OSError:
pass
elif mode == 'link_or_copy':
- link_or_copy(args[0], args[1])
- elif mode == 'link_or_copy_to_dir':
- assert len(args) > 1
+ link_or_copy(args[0], args[1])
+ elif mode == 'link_or_copy_to_dir':
+ assert len(args) > 1
start = 0
if args[0] == '--no-check':
if args == 2:
sys.exit()
start = 1
- dst = args[-1]
+ dst = args[-1]
for src in args[start:-1]:
- link_or_copy(src, os.path.join(dst, os.path.basename(src)))
+ link_or_copy(src, os.path.join(dst, os.path.basename(src)))
elif mode == 'cat':
with open(args[0], 'w') as dst:
for input_name in args[1:]: