# HG changeset patch # User Ludovic Chabant # Date 1421994223 28800 # Node ID 989d0abd7c1730e3be3a83d4ecce4a9692d968c4 # Parent c5330cb35794f28400d36605295173681e5d0b8c processing: Use the correct full path for mounts. diff -r c5330cb35794 -r 989d0abd7c17 piecrust/processing/base.py --- a/piecrust/processing/base.py Thu Jan 22 22:23:20 2015 -0800 +++ b/piecrust/processing/base.py Thu Jan 22 22:23:43 2015 -0800 @@ -128,7 +128,7 @@ baker_params = app.config.get('baker') or {} assets_dirs = baker_params.get('assets_dirs', app.assets_dirs) - self.mounts = make_mount_info(assets_dirs) + self.mounts = make_mount_infos(assets_dirs, self.app.root_dir) self.num_workers = baker_params.get('workers', 4) @@ -212,15 +212,17 @@ if src_dir_or_file is not None: # Process only the given path. # Find out what mount point this is in. - for path, info in self.mounts.items(): + for name, info in self.mounts.items(): + path = info['path'] if src_dir_or_file[:len(path)] == path: base_dir = path mount_info = info break else: + known_roots = [i['path'] for i in self.mounts.values()] raise Exception("Input path '%s' is not part of any known " "mount point: %s" % - (src_dir_or_file, self.mounts.keys())) + (src_dir_or_file, known_roots)) ctx = ProcessingContext(base_dir, mount_info, queue, record) logger.debug("Initiating processing pipeline on: %s" % src_dir_or_file) @@ -231,7 +233,8 @@ else: # Process everything. - for path, info in self.mounts.items(): + for name, info in self.mounts.items(): + path = info['path'] ctx = ProcessingContext(path, info, queue, record) logger.debug("Initiating processing pipeline on: %s" % path) self.processDirectory(ctx, path, new_only) @@ -388,7 +391,7 @@ logger.error("Error processing %s: %s" % (rel_path, ex)) -def make_mount_info(mounts): +def make_mount_infos(mounts, root_dir): if isinstance(mounts, list): mounts = {m: {} for m in mounts} @@ -397,6 +400,7 @@ raise Exception("Asset directory info for '%s' is not a " "dictionary." % name) info.setdefault('processors', 'all -uglifyjs -cleancss') + info['path'] = os.path.join(root_dir, name) return mounts