aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/fs_tools.py
diff options
context:
space:
mode:
authorheretic <heretic@yandex-team.ru>2022-02-10 16:45:43 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:43 +0300
commit397cbe258b9e064f49c4ca575279f02f39fef76e (patch)
treea0b0eb3cca6a14e4e8ea715393637672fa651284 /build/scripts/fs_tools.py
parent43f5a35593ebc9f6bcea619bb170394ea7ae468e (diff)
downloadydb-397cbe258b9e064f49c4ca575279f02f39fef76e.tar.gz
Restoring authorship annotation for <heretic@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build/scripts/fs_tools.py')
-rw-r--r--build/scripts/fs_tools.py62
1 files changed, 31 insertions, 31 deletions
diff --git a/build/scripts/fs_tools.py b/build/scripts/fs_tools.py
index dec4c349c8..f6d81ca488 100644
--- a/build/scripts/fs_tools.py
+++ b/build/scripts/fs_tools.py
@@ -1,7 +1,7 @@
from __future__ import print_function
import os
-import platform
+import platform
import sys
import shutil
import errno
@@ -46,29 +46,29 @@ if __name__ == '__main__':
except OSError:
pass
shutil.copy(s, d)
- elif mode == 'copy_all_files':
- src = args[0]
- dst = args[1]
- for root, _, files in os.walk(src):
- for f in files:
- if os.path.islink(os.path.join(root, f)):
- continue
- file_dst = os.path.join(dst, os.path.relpath(root, src), f)
- if os.path.exists(file_dst):
- continue
- try:
- os.makedirs(os.path.dirname(file_dst))
- except OSError:
- pass
- shutil.copy(os.path.join(root, f), file_dst)
+ elif mode == 'copy_all_files':
+ src = args[0]
+ dst = args[1]
+ for root, _, files in os.walk(src):
+ for f in files:
+ if os.path.islink(os.path.join(root, f)):
+ continue
+ file_dst = os.path.join(dst, os.path.relpath(root, src), f)
+ if os.path.exists(file_dst):
+ continue
+ try:
+ os.makedirs(os.path.dirname(file_dst))
+ except OSError:
+ pass
+ shutil.copy(os.path.join(root, f), file_dst)
elif mode == 'rename_if_exists':
if os.path.exists(args[0]):
shutil.move(args[0], args[1])
elif mode == 'rename':
- targetdir = os.path.dirname(args[1])
- if targetdir and not os.path.exists(targetdir):
- os.makedirs(os.path.dirname(args[1]))
- shutil.move(args[0], args[1])
+ targetdir = os.path.dirname(args[1])
+ if targetdir and not os.path.exists(targetdir):
+ os.makedirs(os.path.dirname(args[1]))
+ shutil.move(args[0], args[1])
elif mode == 'remove':
for f in args:
try:
@@ -78,7 +78,7 @@ if __name__ == '__main__':
shutil.rmtree(f)
except OSError:
pass
- elif mode == 'link_or_copy':
+ elif mode == 'link_or_copy':
link_or_copy(args[0], args[1])
elif mode == 'link_or_copy_to_dir':
assert len(args) > 1
@@ -90,15 +90,15 @@ if __name__ == '__main__':
dst = args[-1]
for src in args[start:-1]:
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:]:
- with open(input_name) as src:
- dst.write(src.read())
- elif mode == 'md':
- try:
- os.makedirs(args[0])
- except OSError:
- pass
+ elif mode == 'cat':
+ with open(args[0], 'w') as dst:
+ for input_name in args[1:]:
+ with open(input_name) as src:
+ dst.write(src.read())
+ elif mode == 'md':
+ try:
+ os.makedirs(args[0])
+ except OSError:
+ pass
else:
raise Exception('unsupported tool %s' % mode)