setup.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/env python
  2. import re
  3. import sys
  4. from setuptools import find_packages, setup
  5. needs_pytest = set(['pytest', 'test', 'ptr']).intersection(sys.argv)
  6. pytest_runner = ['pytest-runner'] if needs_pytest else []
  7. # Get version without importing, which avoids dependency issues
  8. def get_version():
  9. with open('chardet/version.py') as version_file:
  10. return re.search(r"""__version__\s+=\s+(['"])(?P<version>.+?)\1""",
  11. version_file.read()).group('version')
  12. def readme():
  13. with open('README.rst') as f:
  14. return f.read()
  15. setup(name='chardet',
  16. version=get_version(),
  17. description='Universal encoding detector for Python 2 and 3',
  18. long_description=readme(),
  19. author='Mark Pilgrim',
  20. author_email='mark@diveintomark.org',
  21. maintainer='Daniel Blanchard',
  22. maintainer_email='dan.blanchard@gmail.com',
  23. url='https://github.com/chardet/chardet',
  24. license="LGPL",
  25. keywords=['encoding', 'i18n', 'xml'],
  26. classifiers=["Development Status :: 4 - Beta",
  27. "Intended Audience :: Developers",
  28. ("License :: OSI Approved :: GNU Library or Lesser General"
  29. " Public License (LGPL)"),
  30. "Operating System :: OS Independent",
  31. "Programming Language :: Python",
  32. 'Programming Language :: Python :: 2',
  33. 'Programming Language :: Python :: 2.6',
  34. 'Programming Language :: Python :: 2.7',
  35. 'Programming Language :: Python :: 3',
  36. 'Programming Language :: Python :: 3.3',
  37. 'Programming Language :: Python :: 3.4',
  38. 'Programming Language :: Python :: 3.5',
  39. 'Programming Language :: Python :: 3.6',
  40. ("Topic :: Software Development :: Libraries :: Python "
  41. "Modules"),
  42. "Topic :: Text Processing :: Linguistic"],
  43. packages=find_packages(),
  44. setup_requires=pytest_runner,
  45. tests_require=['pytest', 'hypothesis'],
  46. entry_points={'console_scripts':
  47. ['chardetect = chardet.cli.chardetect:main']})