changeset 8:16d41af2d8ef

add ability to print templates
author k0s <k0scist@gmail.com>
date Thu, 24 Dec 2009 22:48:55 -0500
parents ffb7753bb7bf
children ec2d0d850b83
files decoupage/templates.py setup.py
diffstat 2 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/decoupage/templates.py	Thu Dec 24 22:38:50 2009 -0500
+++ b/decoupage/templates.py	Thu Dec 24 22:48:55 2009 -0500
@@ -4,6 +4,7 @@
 import sys
 from optparse import OptionParser
 from pkg_resources import iter_entry_points
+from pkg_resources import resource_filename
 
 def template_dirs():
     template_dirs = set()
@@ -17,10 +18,17 @@
             template_dirs.add(template_dir)
     return template_dirs
         
+def templates():
+    templates = []
+    for directory in template_dirs():
+        templates.extend([os.path.join(directory, filename) 
+                          for filename in os.listdir(directory)
+                          if filename.endswith('.html')])
+    return templates
+
 def main(args=sys.argv[1:]):
-    _template_dirs = template_dirs()
-    for d in _template_dirs:
-        print d
+    for template in templates():
+        print template
 
 if __name__ == '__main__':
     main()
--- a/setup.py	Thu Dec 24 22:38:50 2009 -0500
+++ b/setup.py	Thu Dec 24 22:48:55 2009 -0500
@@ -6,7 +6,7 @@
 except IOError:
     description = ''
 
-version = '0.3'
+version = '0.3.1'
 
 setup(name='decoupage',
       version=version,
@@ -30,6 +30,9 @@
          ],
       entry_points="""
       # -*- Entry points: -*-
+      [console_scripts]
+      decoupage-templates = decoupage.templates:main
+
       [paste.app_factory]
       main = decoupage.factory:factory