/setup.py

https://bitbucket.org/neithere/argh/ · Python · 112 lines · 62 code · 20 blank · 30 comment · 6 complexity · 7607b8c25eaffc722bc1903ad828d30a MD5 · raw file

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Argh is a simple argparse wrapper.
  5. # Copyright © 2010—2013 Andrey Mikhaylenko
  6. #
  7. # This file is part of Argh.
  8. #
  9. # Argh is free software: you can redistribute it and/or modify
  10. # it under the terms of the GNU Lesser General Public License as published
  11. # by the Free Software Foundation, either version 3 of the License, or
  12. # (at your option) any later version.
  13. #
  14. # Argh is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU Lesser General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Lesser General Public License
  20. # along with Argh. If not, see <http://gnu.org/licenses/>.
  21. import io
  22. import os
  23. import sys
  24. from setuptools import setup
  25. from setuptools.command.test import test as TestCommand
  26. # Importing `__version__` from `argh` would trigger a cascading import
  27. # of `argparse`. We need to avoid this as Python < 2.7 ships without argparse.
  28. __version__ = None
  29. with io.open('argh/__init__.py', encoding='utf8') as f:
  30. for line in f:
  31. if line.startswith('__version__'):
  32. exec(line)
  33. break
  34. assert __version__, 'argh.__version__ must be imported correctly'
  35. with io.open(os.path.join(os.path.dirname(__file__), 'README'), encoding='ascii') as f:
  36. readme = f.read()
  37. class PyTest(TestCommand):
  38. # see http://pytest.org/latest/goodpractises.html#integration-with-setuptools-distribute-test-commands
  39. def finalize_options(self):
  40. TestCommand.finalize_options(self)
  41. self.test_args = []
  42. self.test_suite = True
  43. def run_tests(self):
  44. #import here, cause outside the eggs aren't loaded
  45. import pytest
  46. errno = pytest.main(self.test_args)
  47. sys.exit(errno)
  48. if sys.version_info < (2,7):
  49. install_requires = ['argparse >= 1.1']
  50. else:
  51. install_requires = []
  52. setup(
  53. # overview
  54. name = 'argh',
  55. description = 'An unobtrusive argparse wrapper with natural syntax',
  56. long_description = readme,
  57. # technical info
  58. version = __version__,
  59. packages = ['argh'],
  60. provides = ['argh'],
  61. install_requires = install_requires,
  62. # testing
  63. tests_require=['pytest'],
  64. cmdclass = {'test': PyTest},
  65. # copyright
  66. author = 'Andrey Mikhaylenko',
  67. author_email = 'neithere@gmail.com',
  68. license = 'GNU Lesser General Public License (LGPL), Version 3',
  69. # more info
  70. url = 'http://bitbucket.org/neithere/argh/',
  71. download_url = 'http://bitbucket.org/neithere/argh/src/',
  72. # categorization
  73. keywords = ('cli command line argparse optparse argument option'),
  74. classifiers = [
  75. 'Development Status :: 4 - Beta',
  76. 'Environment :: Console',
  77. 'Intended Audience :: Developers',
  78. 'Intended Audience :: Information Technology',
  79. 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
  80. 'Programming Language :: Python',
  81. 'Programming Language :: Python :: 2',
  82. 'Programming Language :: Python :: 2.6',
  83. 'Programming Language :: Python :: 2.7',
  84. 'Programming Language :: Python :: 3',
  85. 'Programming Language :: Python :: 3.2',
  86. 'Programming Language :: Python :: 3.3',
  87. 'Programming Language :: Python :: Implementation :: CPython',
  88. 'Programming Language :: Python :: Implementation :: PyPy',
  89. 'Topic :: Software Development :: User Interfaces',
  90. 'Topic :: Software Development :: Libraries :: Python Modules',
  91. ],
  92. )