setup.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 f.read().splitlines()
  31. except IOError:
  32. import os
  33. raise IOError(os.getcwd())
  34. setup(
  35. name='http-prompt',
  36. version=find_version('http_prompt', '__init__.py'),
  37. url='https://github.com/eliangcs/http-prompt',
  38. description='An interactive HTTP command-line client',
  39. long_description=read_description('README.rst'),
  40. author='Chang-Hung Liang',
  41. author_email='eliang.cs@gmail.com',
  42. license='MIT',
  43. packages=['http_prompt'],
  44. entry_points="""
  45. [console_scripts]
  46. http-prompt=http_prompt.cli:cli
  47. """,
  48. install_requires=read_requirements('requirements.txt'),
  49. classifiers=[
  50. 'Development Status :: 2 - Pre-Alpha',
  51. 'Intended Audience :: Developers',
  52. 'License :: OSI Approved :: MIT License',
  53. 'Operating System :: OS Independent',
  54. 'Programming Language :: Python',
  55. 'Programming Language :: Python :: 2',
  56. 'Programming Language :: Python :: 2.6',
  57. 'Programming Language :: Python :: 2.7',
  58. 'Programming Language :: Python :: 3',
  59. 'Programming Language :: Python :: 3.3',
  60. 'Programming Language :: Python :: 3.4',
  61. 'Programming Language :: Python :: 3.5'
  62. ]
  63. )