rename/reshuffle modules

This commit is contained in:
2014-11-05 14:48:10 +01:00
parent 4ebe917ee1
commit 8b1085edd1
6 changed files with 27 additions and 25 deletions

View File

@@ -300,6 +300,13 @@ class bam_utils:
print(" %s" % name_short) print(" %s" % name_short)
@staticmethod
def deps(paths):
# TODO(cam) multiple paths
path = paths[0]
def subcommand_checkout_cb(args): def subcommand_checkout_cb(args):
bam_utils.checkout(args.paths) bam_utils.checkout(args.paths)

View File

@@ -69,7 +69,7 @@ def pack(blendfile_src, blendfile_dst, mode='FILE',
WRITE_JSON_REMAP = True WRITE_JSON_REMAP = True
if report is None: if report is None:
raise Exception("report not set!") report = lambda msg: msg
yield report("%s: %r...\n" % (colorize("\nscanning deps", color='bright_green'), blendfile_src)) yield report("%s: %r...\n" % (colorize("\nscanning deps", color='bright_green'), blendfile_src))
@@ -282,6 +282,9 @@ def create_argparse():
parser.add_argument( parser.add_argument(
"-s", "--paths_remap", dest="paths_remap", metavar='FILE', "-s", "--paths_remap", dest="paths_remap", metavar='FILE',
help="Write out the original paths to a JSON file") help="Write out the original paths to a JSON file")
parser.add_argument(
"-u", "--paths_uuid", dest="paths_uuid", metavar='FILE',
help="Write out the original paths UUID to a JSON file")
return parser return parser
@@ -296,13 +299,17 @@ def main():
deps_remap = {} if args.deps_remap else None deps_remap = {} if args.deps_remap else None
paths_remap = {} if args.paths_remap else None paths_remap = {} if args.paths_remap else None
paths_uuid = {} if args.paths_uuid else None
pack(args.path_src.encode(encoding), for msg in pack(
args.path_dst.encode(encoding), args.path_src.encode(encoding),
args.mode, args.path_dst.encode(encoding),
deps_remap, args.mode,
paths_remap, deps_remap=deps_remap,
) paths_remap=paths_remap,
paths_uuid=paths_uuid,
):
print(msg)
def write_dict_as_json(fn, dct): def write_dict_as_json(fn, dct):
with open(fn, 'w', encoding='utf-8') as f: with open(fn, 'w', encoding='utf-8') as f:
@@ -320,6 +327,9 @@ def main():
if paths_remap is not None: if paths_remap is not None:
write_dict_as_json(args.paths_remap, paths_remap) write_dict_as_json(args.paths_remap, paths_remap)
if paths_uuid is not None:
write_dict_as_json(args.paths_uuid, paths_uuid)
del write_dict_as_json del write_dict_as_json
if __name__ == "__main__": if __name__ == "__main__":

View File

@@ -21,7 +21,7 @@
# Ensure module path # Ensure module path
import os import os
import sys import sys
path = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "modules")) path = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "..", "modules"))
if path not in sys.path: if path not in sys.path:
sys.path.append(path) sys.path.append(path)
del os, sys, path del os, sys, path
@@ -255,28 +255,13 @@ class FileAPI(Resource):
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))
modpath = \ import blendfile_pack
os.path.normpath(
os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"..",
"packer")))
import sys
if modpath not in sys.path:
sys.path.append(modpath)
del modpath
import packer
print(" Source path:", filepath) print(" Source path:", filepath)
print(" Zip path:", filepath_zip) print(" Zip path:", filepath_zip)
try: try:
yield from packer.pack( yield from blendfile_pack.pack(
filepath.encode('utf-8'), filepath_zip[-1].encode('utf-8'), mode='ZIP', filepath.encode('utf-8'), filepath_zip[-1].encode('utf-8'), mode='ZIP',
# 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={}, paths_remap={}, paths_uuid={}, deps_remap={}, paths_remap={}, paths_uuid={},