comparison piecrust/baking/single.py @ 827:570f89414b2c

Assetor is now responsible for copying assets, to allow customization
author Ben Artin <ben@artins.org>
date Sun, 01 Jan 2017 18:22:24 -0500
parents ab5c6a8ae90a
children f19b52844948
comparison
equal deleted inserted replaced
826:7f235e65ef5d 827:570f89414b2c
1 import os.path 1 import os.path
2 import queue 2 import queue
3 import shutil
4 import logging 3 import logging
5 import threading 4 import threading
6 import urllib.parse 5 import urllib.parse
7 from piecrust import ASSET_DIR_SUFFIX 6 from piecrust import ASSET_DIR_SUFFIX
8 from piecrust.baking.records import SubPageBakeInfo 7 from piecrust.baking.records import SubPageBakeInfo
165 out_name_noext) 164 out_name_noext)
166 165
167 logger.debug("Copying page assets to: %s" % out_assets_dir) 166 logger.debug("Copying page assets to: %s" % out_assets_dir)
168 _ensure_dir_exists(out_assets_dir) 167 _ensure_dir_exists(out_assets_dir)
169 168
170 page_pathname, _ = os.path.splitext(qualified_page.path) 169 qualified_path.source.buildPageAssetor().copyAssets(page, out_assets_dir)
171 in_assets_dir = page_pathname + ASSET_DIR_SUFFIX
172 for fn in os.listdir(in_assets_dir):
173 full_fn = os.path.join(in_assets_dir, fn)
174 if os.path.isfile(full_fn):
175 dest_ap = os.path.join(out_assets_dir, fn)
176 logger.debug(" %s -> %s" % (full_fn, dest_ap))
177 shutil.copy(full_fn, dest_ap)
178 170
179 # Figure out if we have more work. 171 # Figure out if we have more work.
180 has_more_subs = False 172 has_more_subs = False
181 if sub_entry.anyPass(lambda p: p.pagination_has_more): 173 if sub_entry.anyPass(lambda p: p.pagination_has_more):
182 cur_sub += 1 174 cur_sub += 1