setup.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # -*- coding: utf-8 -*-
  2. import re
  3. from io import open
  4. from setuptools import find_packages, setup
  5. PACKAGE_NAME = "num2words"
  6. CLASSIFIERS = [
  7. 'Development Status :: 5 - Production/Stable',
  8. 'Intended Audience :: Developers',
  9. 'License :: OSI Approved :: GNU Library or Lesser General Public License '
  10. '(LGPL)',
  11. 'Programming Language :: Python :: 2.7',
  12. 'Programming Language :: Python :: 3',
  13. 'Topic :: Software Development :: Internationalization',
  14. 'Topic :: Software Development :: Libraries :: Python Modules',
  15. 'Topic :: Software Development :: Localization',
  16. 'Topic :: Text Processing :: Linguistic',
  17. ]
  18. LONG_DESC = open('README.rst', 'rt', encoding="utf-8").read() + '\n\n' + \
  19. open('CHANGES.rst', 'rt', encoding="utf-8").read()
  20. def find_version(fname):
  21. """Parse file & return version number matching 0.0.1 regex
  22. Returns str or raises RuntimeError
  23. """
  24. version = ''
  25. with open(fname, 'r', encoding="utf-8") as fp:
  26. reg = re.compile(r'__version__ = [\'"]([^\'"]*)[\'"]')
  27. for line in fp:
  28. m = reg.match(line)
  29. if m:
  30. version = m.group(1)
  31. break
  32. if not version:
  33. raise RuntimeError('Cannot find version information')
  34. return version
  35. setup(
  36. name=PACKAGE_NAME,
  37. version=find_version("bin/num2words"),
  38. description='Modules to convert numbers to multilingual words.',
  39. long_description=LONG_DESC,
  40. license='Alibaba Group',
  41. author='Zhang Chong, Alibaba DAMO Academy',
  42. author_email='',
  43. maintainer='Zhang Chong',
  44. maintainer_email='',
  45. keywords=' number word numbers words convert conversion '
  46. 'localisation localization internationalisation '
  47. 'internationalization',
  48. url='https://github.com/num2words',
  49. packages=find_packages(exclude=['tests']),
  50. test_suite='tests',
  51. classifiers=CLASSIFIERS,
  52. scripts=['bin/num2words'],
  53. install_requires=["docopt>=0.6.2"],
  54. tests_require=['delegator.py'],
  55. )