[Checkins] SVN: zopyx.smartprintng.core/trunk/ making demo_app available through an entry point

Andreas Jung andreas at andreas-jung.com
Sat Oct 4 10:23:33 EDT 2008


Log message for revision 91747:
  making demo_app available through an entry point
  
  

Changed:
  U   zopyx.smartprintng.core/trunk/buildout.cfg
  U   zopyx.smartprintng.core/trunk/setup.py
  U   zopyx.smartprintng.core/trunk/zopyx/smartprintng/core/demo/demo_app.py

-=-
Modified: zopyx.smartprintng.core/trunk/buildout.cfg
===================================================================
--- zopyx.smartprintng.core/trunk/buildout.cfg	2008-10-04 14:18:58 UTC (rev 91746)
+++ zopyx.smartprintng.core/trunk/buildout.cfg	2008-10-04 14:23:32 UTC (rev 91747)
@@ -2,7 +2,6 @@
 parts = test
 extensions = gp.svndevelop
 develop = zopyx.convert2
-
 svn-develop = svn://svn.zope.org/repos/main/zopyx.convert2/trunk/#egg=zopyx.convert2
 
 [test]

Modified: zopyx.smartprintng.core/trunk/setup.py
===================================================================
--- zopyx.smartprintng.core/trunk/setup.py	2008-10-04 14:18:58 UTC (rev 91746)
+++ zopyx.smartprintng.core/trunk/setup.py	2008-10-04 14:23:32 UTC (rev 91747)
@@ -31,7 +31,5 @@
           # -*- Extra requirements: -*-
       ],
       extras_require=dict(test=['pysqlite', 'zope.testing']),
-      entry_points="""
-      # -*- Entry points: -*-
-      """,
+      entry_points={'console_scripts': ['spng-demo= zopyx.smartprintng.core.demo.demo_app:main',]},
       )

Modified: zopyx.smartprintng.core/trunk/zopyx/smartprintng/core/demo/demo_app.py
===================================================================
--- zopyx.smartprintng.core/trunk/zopyx/smartprintng/core/demo/demo_app.py	2008-10-04 14:18:58 UTC (rev 91746)
+++ zopyx.smartprintng.core/trunk/zopyx/smartprintng/core/demo/demo_app.py	2008-10-04 14:23:32 UTC (rev 91747)
@@ -25,18 +25,22 @@
 
 # register resources directory for demo purposes 
 from zopyx.smartprintng.core import resources
-resources_configuration_file = os.path.join(os.path.dirname(__file__), 'resources', 'resources.ini')
-resources.registerResource(ITestContent, resources_configuration_file)
 
-context = TestContent()
-result = convert(context=context,
-                 html=html,
-                 aggregator_name='foo',
-                 styles=['fop_styles.css', 'demo_styles.css'],
-                 transformations=['zopyx.smartprintng.imageremover', 'zopyx.smartprintng.pagebreaker'],
-                 resource_name='demo',
-                 converter='pdf-prince',
-                 beautify_html=False,
-                 destination_filename='demo.pdf')
+def main():
+    resources_configuration_file = os.path.join(os.path.dirname(__file__), 'resources', 'resources.ini')
+    resources.registerResource(ITestContent, resources_configuration_file)
 
-print result
+    context = TestContent()
+    result = convert(context=context,
+                     html=html,
+                     aggregator_name='foo',
+                     styles=['fop_styles.css', 'demo_styles.css'],
+                     transformations=['zopyx.smartprintng.imageremover', 'zopyx.smartprintng.pagebreaker'],
+                     resource_name='demo',
+                     converter='pdf-prince',
+                     destination_filename='demo.pdf')
+    print 'Generated:', 
+    print os.path.abspath(result)
+
+if __name__ == '__main__':
+    sys.exit(main())



More information about the Checkins mailing list