PageRenderTime 35ms CodeModel.GetById 15ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 1ms

/setup.py

https://bitbucket.org/neithere/argh/
Python | 112 lines | 62 code | 20 blank | 30 comment | 4 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
 22
 23import io
 24import os
 25import sys
 26
 27from setuptools import setup
 28from setuptools.command.test import test as TestCommand
 29
 30
 31# Importing `__version__` from `argh` would trigger a cascading import
 32# of `argparse`. We need to avoid this as Python < 2.7 ships without argparse.
 33__version__ = None
 34with io.open('argh/__init__.py', encoding='utf8') as f:
 35    for line in f:
 36        if line.startswith('__version__'):
 37            exec(line)
 38            break
 39assert __version__, 'argh.__version__ must be imported correctly'
 40
 41
 42with io.open(os.path.join(os.path.dirname(__file__), 'README'), encoding='ascii') as f:
 43	readme = f.read()
 44
 45
 46class PyTest(TestCommand):
 47    # see http://pytest.org/latest/goodpractises.html#integration-with-setuptools-distribute-test-commands
 48
 49    def finalize_options(self):
 50        TestCommand.finalize_options(self)
 51        self.test_args = []
 52        self.test_suite = True
 53
 54    def run_tests(self):
 55        #import here, cause outside the eggs aren't loaded
 56        import pytest
 57        errno = pytest.main(self.test_args)
 58        sys.exit(errno)
 59
 60
 61if sys.version_info < (2,7):
 62    install_requires = ['argparse >= 1.1']
 63else:
 64    install_requires = []
 65
 66
 67setup(
 68    # overview
 69    name             = 'argh',
 70    description      = 'An unobtrusive argparse wrapper with natural syntax',
 71    long_description = readme,
 72
 73    # technical info
 74    version  = __version__,
 75    packages = ['argh'],
 76    provides = ['argh'],
 77    install_requires = install_requires,
 78
 79    # testing
 80    tests_require=['pytest'],
 81    cmdclass = {'test': PyTest},
 82
 83    # copyright
 84    author   = 'Andrey Mikhaylenko',
 85    author_email = 'neithere@gmail.com',
 86    license  = 'GNU Lesser General Public License (LGPL), Version 3',
 87
 88    # more info
 89    url          = 'http://bitbucket.org/neithere/argh/',
 90    download_url = 'http://bitbucket.org/neithere/argh/src/',
 91
 92    # categorization
 93    keywords     = ('cli command line argparse optparse argument option'),
 94    classifiers  = [
 95        'Development Status :: 4 - Beta',
 96        'Environment :: Console',
 97        'Intended Audience :: Developers',
 98        'Intended Audience :: Information Technology',
 99        'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
100        'Programming Language :: Python',
101        'Programming Language :: Python :: 2',
102        'Programming Language :: Python :: 2.6',
103        'Programming Language :: Python :: 2.7',
104        'Programming Language :: Python :: 3',
105        'Programming Language :: Python :: 3.2',
106        'Programming Language :: Python :: 3.3',
107        'Programming Language :: Python :: Implementation :: CPython',
108        'Programming Language :: Python :: Implementation :: PyPy',
109        'Topic :: Software Development :: User Interfaces',
110        'Topic :: Software Development :: Libraries :: Python Modules',
111    ],
112)