Prettify output and fix copy of static files.

This commit is contained in:
Alexis Metaireau 2010-10-30 01:26:58 +01:00
commit 536245b006
2 changed files with 10 additions and 5 deletions

View file

@ -25,4 +25,4 @@ if __name__ == '__main__':
args = parser.parse_args() args = parser.parse_args()
gen = ArticlesGenerator(args.settings) gen = ArticlesGenerator(args.settings)
gen.generate(args.path, args.theme, args.output, args.markup) gen.generate(args.path, args.theme, args.output, args.markup)
print 'Done !' print "Enjoy !"

View file

@ -79,6 +79,8 @@ class Generator(object):
pass pass
fp = open(complete_path, 'w') fp = open(complete_path, 'w')
feed.write(fp, 'utf-8') feed.write(fp, 'utf-8')
print u' ✔ writing %s' % complete_path
fp.close() fp.close()
return feed return feed
@ -99,7 +101,7 @@ class Generator(object):
pass pass
with open(filename, 'w', encoding='utf-8') as f: with open(filename, 'w', encoding='utf-8') as f:
f.write(output) f.write(output)
print 'writing %s' % filename print u'writing %s' % filename
def get_templates(self, path=None): def get_templates(self, path=None):
"""Return the templates to use. """Return the templates to use.
@ -162,7 +164,7 @@ class ArticlesGenerator(Generator):
try: try:
article.check_properties() article.check_properties()
except NameError as e: except NameError as e:
print "Error, The '%s' metadata is not present in %s" % (e, f) print u" ☓ Skipping %s: impossible to find informations about '%s'" % (f, e)
continue continue
update_dict(self.dates, article.date.strftime('%Y-%m-%d'), article) update_dict(self.dates, article.date.strftime('%Y-%m-%d'), article)
@ -221,8 +223,11 @@ class ArticlesGenerator(Generator):
for path in self.settings['STATIC_PATHS']: for path in self.settings['STATIC_PATHS']:
try: try:
shutil.copytree(os.path.join(self.theme, path), fromp = os.path.expanduser(os.path.join(self.theme, path))
os.path.join(self.output_path, path)) to = os.path.expanduser(os.path.join(self.output_path, path))
shutil.copytree(fromp, to)
print u' ✔ copying %s to %s' % (fromp, to)
except OSError: except OSError:
pass pass