paths are now relative to project root when checked out
This commit is contained in:
@@ -323,7 +323,7 @@ class bam_utils:
|
|||||||
paths_modified[fn_rel] = fn_abs
|
paths_modified[fn_rel] = fn_abs
|
||||||
|
|
||||||
# TESTING ONLY
|
# TESTING ONLY
|
||||||
fn_abs_remote = os.path.join("/shared/software/bam/storage/bam_test", fn_rel)
|
fn_abs_remote = os.path.join("/pro", fn_rel)
|
||||||
paths_remap_subset_add[fn_rel] = fn_abs_remote
|
paths_remap_subset_add[fn_rel] = fn_abs_remote
|
||||||
|
|
||||||
del paths_used
|
del paths_used
|
||||||
|
@@ -34,6 +34,7 @@ del os, sys, path
|
|||||||
|
|
||||||
|
|
||||||
def pack(blendfile_src, blendfile_dst, mode='FILE',
|
def pack(blendfile_src, blendfile_dst, mode='FILE',
|
||||||
|
paths_remap_relbase=None,
|
||||||
deps_remap=None, paths_remap=None, paths_uuid=None,
|
deps_remap=None, paths_remap=None, paths_uuid=None,
|
||||||
# yield reports
|
# yield reports
|
||||||
report=None):
|
report=None):
|
||||||
@@ -166,11 +167,19 @@ def pack(blendfile_src, blendfile_dst, mode='FILE',
|
|||||||
|
|
||||||
# store path mapping {dst: src}
|
# store path mapping {dst: src}
|
||||||
if paths_remap is not None:
|
if paths_remap is not None:
|
||||||
|
|
||||||
|
if paths_remap_relbase is not None:
|
||||||
|
relbase = lambda fn: os.path.relpath(fn, paths_remap_relbase)
|
||||||
|
else:
|
||||||
|
relbase = lambda fn: fn
|
||||||
|
|
||||||
for src, dst in path_copy_files:
|
for src, dst in path_copy_files:
|
||||||
# TODO. relative to project-basepath
|
# TODO. relative to project-basepath
|
||||||
paths_remap[os.path.relpath(dst, base_dir_dst).decode('utf-8')] = src.decode('utf-8')
|
paths_remap[os.path.relpath(dst, base_dir_dst).decode('utf-8')] = relbase(src).decode('utf-8')
|
||||||
# main file XXX, should have better way!
|
# main file XXX, should have better way!
|
||||||
paths_remap[os.path.basename(blendfile_src).decode('utf-8')] = blendfile_src.decode('utf-8')
|
paths_remap[os.path.basename(blendfile_src).decode('utf-8')] = relbase(blendfile_src).decode('utf-8')
|
||||||
|
|
||||||
|
del relbase
|
||||||
|
|
||||||
if paths_uuid is not None:
|
if paths_uuid is not None:
|
||||||
from bam_utils.system import sha1_from_file
|
from bam_utils.system import sha1_from_file
|
||||||
|
@@ -265,7 +265,7 @@ class FileAPI(Resource):
|
|||||||
return jsonify(message='File not allowed')
|
return jsonify(message='File not allowed')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def pack_fn(filepath, filepath_zip, base_path, report):
|
def pack_fn(filepath, filepath_zip, paths_remap_relbase, report):
|
||||||
import os
|
import os
|
||||||
assert(os.path.exists(filepath) and not os.path.isdir(filepath))
|
assert(os.path.exists(filepath) and not os.path.isdir(filepath))
|
||||||
|
|
||||||
@@ -281,6 +281,7 @@ class FileAPI(Resource):
|
|||||||
try:
|
try:
|
||||||
yield from blendfile_pack.pack(
|
yield from blendfile_pack.pack(
|
||||||
filepath.encode('utf-8'), filepath_zip.encode('utf-8'), mode='ZIP',
|
filepath.encode('utf-8'), filepath_zip.encode('utf-8'), mode='ZIP',
|
||||||
|
paths_remap_relbase=paths_remap_relbase.encode('utf-8'),
|
||||||
# TODO(cam) this just means the json is written in the zip
|
# TODO(cam) this just means the json is written in the zip
|
||||||
deps_remap=deps_remap, paths_remap=paths_remap, paths_uuid=paths_uuid,
|
deps_remap=deps_remap, paths_remap=paths_remap, paths_uuid=paths_uuid,
|
||||||
report=report)
|
report=report)
|
||||||
|
Reference in New Issue
Block a user