keep hierarchy option

This commit is contained in:
2026-02-19 18:06:25 +01:00
parent 6af9567a44
commit cbbe8be0d8
3 changed files with 182 additions and 6 deletions
Regular → Executable
+20 -1
View File
@@ -88,6 +88,15 @@ def add_parser(subparsers):
help="Only pack assets that are referred to with a relative path (e.g. "
"starting with `//`.",
)
parser.add_argument(
"--keep-hierarchy",
default=False,
action="store_true",
help="Preserve the full filesystem directory hierarchy in the pack. "
"All files (including the blend file) are placed at their absolute "
"path structure under the target directory. Paths in blend files are "
"rewritten to relative paths within this structure.",
)
def cli_pack(args):
@@ -119,6 +128,9 @@ def create_packer(
if args.relative_only:
raise ValueError("S3 uploader does not support the --relative-only option")
if args.keep_hierarchy:
raise ValueError("S3 uploader does not support the --keep-hierarchy option")
packer = create_s3packer(bpath, ppath, pathlib.PurePosixPath(target))
elif (
@@ -137,6 +149,11 @@ def create_packer(
"Shaman uploader does not support the --relative-only option"
)
if args.keep_hierarchy:
raise ValueError(
"Shaman uploader does not support the --keep-hierarchy option"
)
packer = create_shamanpacker(bpath, ppath, target)
elif target.lower().endswith(".zip"):
@@ -146,7 +163,8 @@ def create_packer(
raise ValueError("ZIP packer does not support on-the-fly compression")
packer = zipped.ZipPacker(
bpath, ppath, target, noop=args.noop, relative_only=args.relative_only
bpath, ppath, target, noop=args.noop, relative_only=args.relative_only,
keep_hierarchy=args.keep_hierarchy,
)
else:
packer = pack.Packer(
@@ -156,6 +174,7 @@ def create_packer(
noop=args.noop,
compress=args.compress,
relative_only=args.relative_only,
keep_hierarchy=args.keep_hierarchy,
)
if args.exclude: