setup.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env python
  2. try:
  3. from setuptools import setup
  4. except ImportError:
  5. from distutils.core import setup
  6. from platform import python_version_tuple, python_implementation
  7. import os
  8. import re
  9. # strip links from the descripton on the PyPI
  10. if python_version_tuple()[0] >= "3":
  11. LONG_DESCRIPTION = open("README.md", "r", encoding="utf-8").read()
  12. else:
  13. LONG_DESCRIPTION = open("README.md", "r").read()
  14. # strip Build Status from the PyPI package
  15. try:
  16. if python_version_tuple()[:2] >= ("2", "7"):
  17. status_re = "^Build status\n(.*\n){7}"
  18. LONG_DESCRIPTION = re.sub(status_re, "", LONG_DESCRIPTION, flags=re.M)
  19. except TypeError:
  20. if python_implementation() == "IronPython":
  21. # IronPython doesn't support flags in re.sub (IronPython issue #923)
  22. pass
  23. else:
  24. raise
  25. install_options = os.environ.get("TABULATE_INSTALL", "").split(",")
  26. libonly_flags = set(["lib-only", "libonly", "no-cli", "without-cli"])
  27. if libonly_flags.intersection(install_options):
  28. console_scripts = []
  29. else:
  30. console_scripts = ["tabulate = tabulate:_main"]
  31. setup(
  32. name="tabulate",
  33. version="0.8.9",
  34. description="Pretty-print tabular data",
  35. long_description=LONG_DESCRIPTION,
  36. long_description_content_type="text/markdown",
  37. author="Sergey Astanin",
  38. author_email="s.astanin@gmail.com",
  39. url="https://github.com/astanin/python-tabulate",
  40. license="MIT",
  41. classifiers=[
  42. "Development Status :: 4 - Beta",
  43. "License :: OSI Approved :: MIT License",
  44. "Operating System :: OS Independent",
  45. "Programming Language :: Python :: 2",
  46. "Programming Language :: Python :: 2.7",
  47. "Programming Language :: Python :: 3",
  48. "Programming Language :: Python :: 3.5",
  49. "Programming Language :: Python :: 3.6",
  50. "Programming Language :: Python :: 3.7",
  51. "Programming Language :: Python :: 3.8",
  52. "Programming Language :: Python :: 3.9",
  53. "Topic :: Software Development :: Libraries",
  54. ],
  55. py_modules=["tabulate"],
  56. entry_points={"console_scripts": console_scripts},
  57. extras_require={"widechars": ["wcwidth"]},
  58. )