aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/tar_directory.py
diff options
context:
space:
mode:
authorheretic <heretic@yandex-team.ru>2022-02-10 16:45:46 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:46 +0300
commit81eddc8c0b55990194e112b02d127b87d54164a9 (patch)
tree9142afc54d335ea52910662635b898e79e192e49 /build/scripts/tar_directory.py
parent397cbe258b9e064f49c4ca575279f02f39fef76e (diff)
downloadydb-81eddc8c0b55990194e112b02d127b87d54164a9.tar.gz
Restoring authorship annotation for <heretic@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'build/scripts/tar_directory.py')
-rw-r--r--build/scripts/tar_directory.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/build/scripts/tar_directory.py b/build/scripts/tar_directory.py
index 8bacdec3a9d..a91889fa22f 100644
--- a/build/scripts/tar_directory.py
+++ b/build/scripts/tar_directory.py
@@ -1,22 +1,22 @@
-import os
-import sys
-import tarfile
-
-
-def is_exe(fpath):
- return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
-
-
-def main(args):
- if len(args) < 2 or len(args) > 3:
+import os
+import sys
+import tarfile
+
+
+def is_exe(fpath):
+ return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+
+
+def main(args):
+ if len(args) < 2 or len(args) > 3:
raise Exception("Illegal usage: `tar_directory.py archive.tar directory [skip prefix]` or `tar_directory.py archive.tar output_directory --extract`")
tar, directory, prefix, extract = args[0], args[1], None, False
- if len(args) == 3:
+ if len(args) == 3:
if args[2] == '--extract':
extract = True
else:
prefix = args[2]
- for tar_exe in ('/usr/bin/tar', '/bin/tar'):
+ for tar_exe in ('/usr/bin/tar', '/bin/tar'):
if not is_exe(tar_exe):
continue
if extract:
@@ -26,9 +26,9 @@ def main(args):
os.execv(tar_exe, [tar_exe, '-xf', tar, '-C', dest])
else:
source = os.path.relpath(directory, prefix) if prefix else directory
- os.execv(tar_exe, [tar_exe, '-cf', tar] + (['-C', prefix] if prefix else []) + [source])
+ os.execv(tar_exe, [tar_exe, '-cf', tar] + (['-C', prefix] if prefix else []) + [source])
break
- else:
+ else:
if extract:
dest = os.path.abspath(directory)
if not os.path.exists(dest):
@@ -39,7 +39,7 @@ def main(args):
source = directory
with tarfile.open(tar, 'w') as out:
out.add(os.path.abspath(source), arcname=os.path.relpath(source, prefix) if prefix else source)
-
-
-if __name__ == '__main__':
- main(sys.argv[1:])
+
+
+if __name__ == '__main__':
+ main(sys.argv[1:])