pydu/setup.py

65 lines
2.0 KiB
Python
Raw Normal View History

2017-12-17 09:55:29 +00:00
import sys
2017-10-18 15:43:50 +00:00
from pydu import __version__
from pydu.compat import PY2
from setuptools import setup, find_packages
2017-12-17 09:55:29 +00:00
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
try:
from multiprocessing import cpu_count
2018-01-04 15:28:06 +00:00
self.pytest_args = ['-n', str(cpu_count())]
2017-12-17 09:55:29 +00:00
except (ImportError, NotImplementedError):
2018-01-04 15:28:06 +00:00
self.pytest_args = ['-n', '1']
2017-12-17 09:55:29 +00:00
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
test_requirements = []
for line in open('requirements-dev.txt'):
requirement = line.strip()
if requirement:
test_requirements.append(requirement)
2017-10-18 15:43:50 +00:00
open_kwargs = {} if PY2 else {'encoding': 'utf-8'}
setup(
2017-10-06 15:59:14 +00:00
name="pydu",
2017-10-18 15:43:50 +00:00
version=__version__,
2017-12-14 12:48:15 +00:00
description="Useful data structures, utils for Python.",
long_description=open('README.rst', **open_kwargs).read(),
author="Prodesire",
2017-12-14 12:48:15 +00:00
author_email='wangbinxin001@126.com',
license='MIT License',
2017-10-06 15:59:14 +00:00
url="https://github.com/Prodesire/pydu",
2017-12-17 09:55:29 +00:00
cmdclass={'test': PyTest},
tests_require=test_requirements,
packages=find_packages(),
2017-12-14 12:48:15 +00:00
classifiers=[
'Operating System :: OS Independent',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: Implementation',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Software Development :: Libraries'
],
)