aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts
diff options
context:
space:
mode:
authorsnermolaev <snermolaev@yandex-team.com>2023-10-05 08:13:52 +0300
committersnermolaev <snermolaev@yandex-team.com>2023-10-05 08:29:07 +0300
commit7a0f35d2179ef3cc81f12299d2333aae0035ca10 (patch)
tree9a713dd00b33c107831c8a434862ad7346fd4515 /build/scripts
parent6483c00d2ba9562c5ef3df64d05a0ddf7fc7d526 (diff)
downloadydb-7a0f35d2179ef3cc81f12299d2333aae0035ca10.tar.gz
use argparse instead of optparse
Diffstat (limited to 'build/scripts')
-rw-r--r--build/scripts/copy_to_dir.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/build/scripts/copy_to_dir.py b/build/scripts/copy_to_dir.py
index 9baeb5ffac..b53db8d066 100644
--- a/build/scripts/copy_to_dir.py
+++ b/build/scripts/copy_to_dir.py
@@ -1,16 +1,17 @@
+import argparse
import errno
import sys
import os
import shutil
-import optparse
import tarfile
def parse_args():
- parser = optparse.OptionParser()
- parser.add_option('--build-root')
- parser.add_option('--dest-dir')
- parser.add_option('--dest-arch')
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--build-root', required=True)
+ parser.add_argument('--dest-arch', default=None)
+ parser.add_argument('--dest-dir', required=True)
+ parser.add_argument('args', nargs='*')
return parser.parse_args()
@@ -41,9 +42,7 @@ def hardlink_or_copy(src, dst):
def main():
- opts, args = parse_args()
- assert opts.build_root
- assert opts.dest_dir
+ opts = parse_args()
dest_arch = None
if opts.dest_arch:
@@ -55,7 +54,7 @@ def main():
# TODO: move check to graph generation stage
raise Exception('Unsopported archive type for {}. Use one of: tar, tar.gz, tgz.'.format(os.path.basename(opts.dest_arch)))
- for arg in args:
+ for arg in opts.args:
dst = arg
if dst.startswith(opts.build_root):
dst = dst[len(opts.build_root) + 1:]