setup.py 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # Copyright 2009-2015 Jason Stitt
  2. #
  3. # Permission is hereby granted, free of charge, to any person obtaining a copy
  4. # of this software and associated documentation files (the "Software"), to deal
  5. # in the Software without restriction, including without limitation the rights
  6. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. # copies of the Software, and to permit persons to whom the Software is
  8. # furnished to do so, subject to the following conditions:
  9. #
  10. # The above copyright notice and this permission notice shall be included in
  11. # all copies or substantial portions of the Software.
  12. #
  13. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. # THE SOFTWARE.
  20. from distutils.core import setup
  21. longdesc = """\
  22. `PyTidyLib`_ is a Python package that wraps the `HTML Tidy`_ library. This
  23. allows you, from Python code, to "fix" invalid (X)HTML markup. Some of the
  24. library's many capabilities include:
  25. * Clean up unclosed tags and unescaped characters such as ampersands
  26. * Output HTML 4 or XHTML, strict or transitional, and add missing doctypes
  27. * Convert named entities to numeric entities, which can then be used in XML
  28. documents without an HTML doctype.
  29. * Clean up HTML from programs such as Word (to an extent)
  30. * Indent the output, including proper (i.e. no) indenting for ``pre`` elements,
  31. which some (X)HTML indenting code overlooks.
  32. Changes
  33. =======
  34. * 0.3.2: Initialization bug fix
  35. * 0.3.1: find_library support while still allowing a list of library names
  36. * 0.3.0: Refactored to use Tidy and PersistentTidy classes while keeping the
  37. functional interface (which will lazily create a global Tidy() object) for
  38. backward compatibility. You can now pass a list of library names and base
  39. options when instantiating Tidy. The keep_doc argument is now deprecated
  40. and does nothing; use PersistentTidy.
  41. * 0.2.4: Bugfix for a strange memory allocation corner case in Tidy.
  42. * 0.2.3: Python 3 support (2 + 3 cross compatible) with passing Tox tests.
  43. Small example of use
  44. ====================
  45. The following code cleans up an invalid HTML document and sets an option::
  46. from tidylib import tidy_document
  47. document, errors = tidy_document('''<p>f&otilde;o <img src="bar.jpg">''',
  48. options={'numeric-entities':1})
  49. print document
  50. print errors
  51. Docs
  52. ====
  53. Documentation is shipped with the source distribution and is available at
  54. the `PyTidyLib`_ web page.
  55. .. _`HTML Tidy`: http://tidy.sourceforge.net/
  56. .. _`PyTidyLib`: http://countergram.com/open-source/pytidylib/
  57. """
  58. VERSION = "0.3.2"
  59. setup(
  60. name="pytidylib",
  61. version=VERSION,
  62. description="Python wrapper for HTML Tidy (tidylib) on Python 2 and 3",
  63. long_description=longdesc,
  64. author="Jason Stitt",
  65. author_email="js@jasonstitt.com",
  66. url="http://countergram.com/open-source/pytidylib/",
  67. packages=['tidylib'],
  68. classifiers=[
  69. 'Development Status :: 5 - Production/Stable',
  70. 'Environment :: Other Environment',
  71. 'Intended Audience :: Developers',
  72. 'License :: OSI Approved :: MIT License',
  73. 'Programming Language :: Python',
  74. 'Programming Language :: Python :: 3',
  75. 'Natural Language :: English',
  76. 'Topic :: Utilities',
  77. 'Topic :: Text Processing :: Markup :: HTML',
  78. 'Topic :: Text Processing :: Markup :: XML',
  79. ],
  80. )