Skip to content
Browse files

Moved __main__ code into main() function that can be referenced as an…

… entry point script, and added a reference to it in setup.py
  • Loading branch information...
1 parent 0586179 commit ff24bab2601665e59b1547b847dfd1ad42695a09 @stephenmcd stephenmcd committed Nov 20, 2011
Showing with 9 additions and 1 deletion.
  1. +5 −1 html2text.py
  2. +4 −0 setup.py
View
6 html2text.py
@@ -714,7 +714,7 @@ def html2text(html, baseurl=''):
h = HTML2Text(baseurl=baseurl)
return h.handle(html)
-if __name__ == "__main__":
+def main():
baseurl = ''
p = optparse.OptionParser('%prog [(filename|url) [encoding]]',
@@ -782,3 +782,7 @@ def html2text(html, baseurl=''):
h.hide_strikethrough = options.hide_strikethrough
wrapwrite(h.handle(data))
+
+
+if __name__ == "__main__":
+ main()
View
4 setup.py
@@ -24,6 +24,10 @@
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2'
],
+ entry_points="""
+ [console_scripts]
+ html2text=html2text:main
+ """,
license='GNU GPL 3',
packages=find_packages(),
py_modules=['html2text'],

0 comments on commit ff24bab

Please sign in to comment.
Something went wrong with that request. Please try again.