re-work packer so absolute paths have '_' prefix.

This commit is contained in:
2014-11-27 12:29:17 +01:00
parent 673b0b0187
commit d99d9e1adf
2 changed files with 12 additions and 8 deletions

View File

@@ -20,7 +20,7 @@
import blendfile_path_walker
TIMEIT = True
TIMEIT = False
# ------------------
# Ensure module path
@@ -75,7 +75,6 @@ def _relpath_remap(
# SHOULD NEVER HAPPEN
path_dst = path_dst.replace(b'..', b'__nonproject__')
path_dst = os.path.normpath(path_dst)
else:
path_dst = b'_' + path_dst
path_dst_final = os.path.join(os.path.relpath(fp_basedir, base_dir_src), path_dst)
@@ -129,6 +128,12 @@ def pack(
from bam_utils.system import colorize
# first check args are OK
# fakeroot _cant_ start with a separator, since we prepend chars to it.
assert((blendfile_src_dir_fakeroot is None) or
(not blendfile_src_dir_fakeroot.startswith(os.sep.encode('ascii'))))
path_temp_files = set()
path_copy_files = set()
@@ -145,8 +150,8 @@ def pack(
base_dir_src = os.path.dirname(blendfile_src)
base_dir_dst = os.path.dirname(blendfile_dst)
_dbg(blendfile_src)
_dbg(blendfile_dst)
# _dbg(blendfile_src)
# _dbg(blendfile_dst)
if mode == 'ZIP':
base_dir_dst_temp = os.path.join(base_dir_dst, b'__blendfile_temp__')
@@ -158,7 +163,6 @@ def pack(
Create temp files in the destination path.
"""
filepath = blendfile_path_walker.utils.compatpath(filepath)
print(repr((os.path.join(rootdir, b'dummy'), base_dir_src, base_dir_src, blendfile_src_dir_fakeroot)))
# first remap this blend file to the location it will end up (so we can get images relative to _that_)
# TODO(cam) cache the results

View File

@@ -835,7 +835,7 @@ class BamRelativeAbsoluteTest(BamSessionTestCase):
# now delete the file we just checked out
session_path = os.path.join(proj_path, "new_out")
# print(run(["find"], proj_path)[0].decode('utf-8'))
# _dbg_dump_path(session_path)
# Now check if all the paths we expected are found!
for f_proj, f_local in images:
@@ -864,8 +864,8 @@ class BamRelativeAbsoluteTest(BamSessionTestCase):
blendfile = ("shots/01/shot_01.blend", "shot_01.blend")
if 1:
images = (
("shots/01/maps/special.png", "_maps/special.png"),
("maps/generic.png", "maps/generic.png"),
("shots/01/maps/special.png", "maps/special.png"),
("maps/generic.png", "_maps/generic.png"),
)
else:
images = (