setup.py 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import sys, os
  2. extra_options = {}
  3. try:
  4. import Cython
  5. # may need to work around setuptools bug by providing a fake Pyrex
  6. sys.path.insert(0, os.path.join(os.path.dirname(__file__), "fake_pyrex"))
  7. except ImportError:
  8. pass
  9. try:
  10. import pkg_resources
  11. try:
  12. pkg_resources.require("setuptools>=0.6c5")
  13. except pkg_resources.VersionConflict:
  14. from ez_setup import use_setuptools
  15. use_setuptools(version="0.6c5")
  16. #pkg_resources.require("Cython==0.9.6.10")
  17. from setuptools import setup
  18. extra_options["zip_safe"] = False
  19. except ImportError:
  20. # no setuptools installed
  21. from distutils.core import setup
  22. import versioninfo
  23. import setupinfo
  24. # override these and pass --static for a static build. See
  25. # doc/build.txt for more information. If you do not pass --static
  26. # changing this will have no effect.
  27. STATIC_INCLUDE_DIRS = []
  28. STATIC_LIBRARY_DIRS = []
  29. STATIC_CFLAGS = []
  30. STATIC_BINARIES = []
  31. # create lxml-version.h file
  32. svn_version = versioninfo.svn_version()
  33. versioninfo.create_version_h(svn_version)
  34. print("Building lxml version %s." % svn_version)
  35. OPTION_RUN_TESTS = setupinfo.has_option('run-tests')
  36. branch_link = """
  37. After an official release of a new stable series, current bug fixes become
  38. available at http://codespeak.net/svn/lxml/branch/lxml-%(branch_version)s .
  39. Running ``easy_install lxml==%(branch_version)sbugfix`` will install this
  40. version from
  41. http://codespeak.net/svn/lxml/branch/lxml-%(branch_version)s#egg=lxml-%(branch_version)sbugfix
  42. """
  43. if versioninfo.is_pre_release():
  44. branch_link = ""
  45. extra_options.update(setupinfo.extra_setup_args())
  46. setup(
  47. name = "lxml",
  48. version = versioninfo.version(),
  49. author="lxml dev team",
  50. author_email="lxml-dev@codespeak.net",
  51. maintainer="lxml dev team",
  52. maintainer_email="lxml-dev@codespeak.net",
  53. url="http://codespeak.net/lxml",
  54. download_url="http://pypi.python.org/packages/source/l/lxml/lxml-%s.tar.gz" % versioninfo.version(),
  55. description="Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.",
  56. long_description=((("""\
  57. lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It
  58. provides safe and convenient access to these libraries using the ElementTree
  59. API.
  60. It extends the ElementTree API significantly to offer support for XPath,
  61. RelaxNG, XML Schema, XSLT, C14N and much more.
  62. To contact the project, go to the `project home page
  63. <http://codespeak.net>`_ or see our bug tracker at
  64. https://launchpad.net/lxml
  65. In case you want to use the current in-development version of lxml, you can
  66. get it from the subversion repository at http://codespeak.net/svn/lxml/trunk .
  67. Running ``easy_install lxml==dev`` will install it from
  68. http://codespeak.net/svn/lxml/trunk#egg=lxml-dev
  69. """ + branch_link) % { "branch_version" : versioninfo.branch_version() }) +
  70. versioninfo.changes()),
  71. classifiers = [
  72. versioninfo.dev_status(),
  73. 'Intended Audience :: Developers',
  74. 'Intended Audience :: Information Technology',
  75. 'License :: OSI Approved :: BSD License',
  76. 'Programming Language :: Cython',
  77. 'Programming Language :: Python :: 2',
  78. 'Programming Language :: Python :: 2.3',
  79. 'Programming Language :: Python :: 2.4',
  80. 'Programming Language :: Python :: 2.5',
  81. 'Programming Language :: Python :: 2.6',
  82. 'Programming Language :: Python :: 3',
  83. 'Programming Language :: Python :: 3.0',
  84. 'Programming Language :: C',
  85. 'Operating System :: OS Independent',
  86. 'Topic :: Text Processing :: Markup :: HTML',
  87. 'Topic :: Text Processing :: Markup :: XML',
  88. 'Topic :: Software Development :: Libraries :: Python Modules'
  89. ],
  90. package_dir = {'': 'src'},
  91. packages = ['lxml', 'lxml.html'],
  92. ext_modules = setupinfo.ext_modules(
  93. STATIC_INCLUDE_DIRS, STATIC_LIBRARY_DIRS,
  94. STATIC_CFLAGS, STATIC_BINARIES),
  95. **extra_options
  96. )
  97. if OPTION_RUN_TESTS:
  98. print("Running tests.")
  99. import test
  100. sys.exit( test.main(sys.argv[:1]) )