aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/copy_docs_files_to_dir.py
diff options
context:
space:
mode:
authorsnermolaev <snermolaev@yandex-team.com>2024-02-09 09:21:08 +0300
committersnermolaev <snermolaev@yandex-team.com>2024-02-09 09:36:51 +0300
commit9b498b3ccd9256f4ece0f7413f96f62b8f6d7924 (patch)
tree35825257c5001a8f9ed9e1a4a6ba9f1f5641b020 /build/scripts/copy_docs_files_to_dir.py
parentc090dc604ba74c72f2a403ecab77276e504ef3c5 (diff)
downloadydb-9b498b3ccd9256f4ece0f7413f96f62b8f6d7924.tar.gz
fix namespace for DOCS_SRCS
Diffstat (limited to 'build/scripts/copy_docs_files_to_dir.py')
-rw-r--r--build/scripts/copy_docs_files_to_dir.py39
1 files changed, 22 insertions, 17 deletions
diff --git a/build/scripts/copy_docs_files_to_dir.py b/build/scripts/copy_docs_files_to_dir.py
index 3af3ee8992..8ac23b0700 100644
--- a/build/scripts/copy_docs_files_to_dir.py
+++ b/build/scripts/copy_docs_files_to_dir.py
@@ -14,9 +14,11 @@ def parse_args():
parser.add_argument('--dest-dir', required=True)
parser.add_argument('--docs-dir', action='append', nargs=2, dest='docs_dirs', default=None)
parser.add_argument('--existing', choices=('skip', 'overwrite'), default='overwrite')
+ parser.add_argument('--include-srcs', nargs='*', default=[])
+ parser.add_argument('--skip-namespace', default=None)
parser.add_argument('--source-root', required=True)
parser.add_argument('--src-dir', action='append', nargs='*', dest='src_dirs', default=None)
- parser.add_argument('files', nargs='*')
+ parser.add_argument('--srcs', nargs='*', default=[])
return parser.parse_args(pcf.get_args(sys.argv[1:]))
@@ -144,22 +146,25 @@ def main():
file_dst = os.path.join(dst, file_src[len(bin_dir) :])
copy_file(file_src, file_dst, overwrite=is_overwrite_existing, orig_path=None)
- for src in args.files:
- file_src = os.path.normpath(src)
- assert os.path.isfile(file_src), 'File [{}] does not exist...'.format(file_src)
- rel_path = file_src
- orig_path = None
- if file_src.startswith(source_root):
- rel_path = file_src[len(source_root) :]
- orig_path = rel_path
- elif file_src.startswith(build_root):
- rel_path = file_src[len(build_root) :]
- else:
- raise Exception('Unexpected file path [{}].'.format(file_src))
- assert not os.path.isabs(rel_path)
- file_dst = os.path.join(args.dest_dir, rel_path)
- if file_dst != file_src:
- copy_file(file_src, file_dst, is_overwrite_existing, orig_path)
+ for skip_namespace, files in [(args.skip_namespace, args.srcs), (None, args.include_srcs)]:
+ for src in files:
+ file_src = os.path.normpath(src)
+ assert os.path.isfile(file_src), 'File [{}] does not exist...'.format(file_src)
+ rel_path = file_src
+ orig_path = None
+ if file_src.startswith(source_root):
+ rel_path = file_src[len(source_root) :]
+ if skip_namespace and rel_path.startswith(skip_namespace):
+ rel_path = rel_path[len(skip_namespace):]
+ orig_path = rel_path
+ elif file_src.startswith(build_root):
+ rel_path = file_src[len(build_root) :]
+ else:
+ raise Exception('Unexpected file path [{}].'.format(file_src))
+ assert not os.path.isabs(rel_path)
+ file_dst = os.path.join(args.dest_dir, rel_path)
+ if file_dst != file_src:
+ copy_file(file_src, file_dst, is_overwrite_existing, orig_path)
if __name__ == '__main__':