setup.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. try:
  2. from setuptools import setup
  3. except ImportError:
  4. from distutils.core import setup
  5. import codecs
  6. import os
  7. import re
  8. here = os.path.abspath(os.path.dirname(__file__))
  9. # Read the version number from a source file.
  10. # Why read it, and not import?
  11. # see https://groups.google.com/d/topic/pypa-dev/0PkjVpcxTzQ/discussion
  12. def find_version(*file_paths):
  13. # Open in Latin-1 so that we avoid encoding errors.
  14. # Use codecs.open for Python 2 compatibility
  15. with codecs.open(os.path.join(here, *file_paths), 'r', 'latin1') as f:
  16. version_file = f.read()
  17. # The version line must have the form
  18. # __version__ = 'ver'
  19. version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
  20. version_file, re.M)
  21. if version_match:
  22. return version_match.group(1)
  23. raise RuntimeError('Unable to find version string')
  24. def read_description(filename):
  25. with codecs.open(filename, encoding='utf-8') as f:
  26. return f.read()
  27. def read_requirements(filename):
  28. try:
  29. with open(filename) as f:
  30. return [line.rstrip() for line in f]
  31. except IOError:
  32. raise IOError(os.getcwd())
  33. setup(
  34. name='http-prompt',
  35. version=find_version('http_prompt', '__init__.py'),
  36. url='https://github.com/eliangcs/http-prompt',
  37. description='An interactive HTTP command-line client',
  38. long_description=read_description('README.rst'),
  39. author='Chang-Hung Liang',
  40. author_email='eliang.cs@gmail.com',
  41. license='MIT',
  42. packages=['http_prompt', 'http_prompt.context'],
  43. entry_points="""
  44. [console_scripts]
  45. http-prompt=http_prompt.cli:cli
  46. """,
  47. install_requires=read_requirements('requirements.txt'),
  48. classifiers=[
  49. 'Development Status :: 3 - Alpha',
  50. 'Environment :: Console',
  51. 'Intended Audience :: Developers',
  52. 'Intended Audience :: System Administrators',
  53. 'License :: OSI Approved :: MIT License',
  54. 'Topic :: Internet :: WWW/HTTP',
  55. 'Topic :: Software Development',
  56. 'Topic :: System :: Networking',
  57. 'Topic :: Terminals',
  58. 'Topic :: Text Processing',
  59. 'Topic :: Utilities',
  60. 'Operating System :: OS Independent',
  61. 'Programming Language :: Python',
  62. 'Programming Language :: Python :: 3.6',
  63. 'Programming Language :: Python :: 3.7',
  64. 'Programming Language :: Python :: 3.8',
  65. ]
  66. )