|
| 1 | +import os |
| 2 | +import sys |
| 3 | + |
| 4 | +from setuptools import setup, find_packages |
| 5 | +from setuptools.command.test import test as TestCommand |
| 6 | + |
| 7 | +import version |
| 8 | + |
| 9 | +# Hack to prevent stupid "TypeError: 'NoneType' object is not callable" error |
| 10 | +# in multiprocessing/util.py _exit_function when running `python |
| 11 | +# setup.py test` or `python setup.py flake8`. See: |
| 12 | +# * http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html) |
| 13 | +# * https://github.com/getsentry/raven-python/blob/master/setup.py |
| 14 | +import multiprocessing |
| 15 | +assert multiprocessing # silence flake8 |
| 16 | + |
| 17 | + |
| 18 | +class PyTest(TestCommand): |
| 19 | + |
| 20 | + user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')] |
| 21 | + |
| 22 | + def initialize_options(self): |
| 23 | + TestCommand.initialize_options(self) |
| 24 | + self.pytest_args = [] |
| 25 | + |
| 26 | + def finalize_options(self): |
| 27 | + TestCommand.finalize_options(self) |
| 28 | + self.test_args = [] |
| 29 | + self.test_suite = True |
| 30 | + |
| 31 | + def run_tests(self): |
| 32 | + import pytest |
| 33 | + if isinstance(self.pytest_args, str): |
| 34 | + # pytest requires arguments as a list or tuple even if singular |
| 35 | + self.pytest_args = [self.pytest_args] |
| 36 | + errno = pytest.main(self.pytest_args) |
| 37 | + sys.exit(errno) |
| 38 | + |
| 39 | + |
| 40 | +def read(fname): |
| 41 | + """ |
| 42 | + Utility function to read the README file. |
| 43 | + :rtype : String |
| 44 | + """ |
| 45 | + return open(os.path.join(os.path.dirname(__file__), fname)).read() |
| 46 | + |
| 47 | + |
| 48 | +setup(name='omero-user-token', |
| 49 | + version=version.getVersion(), |
| 50 | + description='OMERO user token management system', |
| 51 | + long_description=read('README.md'), |
| 52 | + long_description_content_type='text/markdown', |
| 53 | + classifiers=[], # Get strings from |
| 54 | + # http://pypi.python.org/pypi?%3Aaction=list_classifiers |
| 55 | + keywords='', |
| 56 | + author='Glencoe Software, Inc.', |
| 57 | + |
| 58 | + url='https://github.com/glencoesoftware/omero-user-token', |
| 59 | + license='License :: OSI Approved :: BSD License', |
| 60 | + packages=find_packages(), |
| 61 | + zip_safe=True, |
| 62 | + include_package_data=True, |
| 63 | + platforms='any', |
| 64 | + setup_requires=['flake8'], |
| 65 | + install_requires=[ |
| 66 | + 'click==7.0', |
| 67 | + ], |
| 68 | + tests_require=[], |
| 69 | + cmdclass={'test': PyTest}, |
| 70 | + data_files=[( |
| 71 | + 'config', [ |
| 72 | + 'message_consumer.cfg.example', |
| 73 | + 'message-consumer.service' |
| 74 | + ] |
| 75 | + )], |
| 76 | + entry_points={ |
| 77 | + 'console_scripts': [ |
| 78 | + 'omero_user_token = omero_user_token.cli.omero_user_token:main', |
| 79 | + ] |
| 80 | + } |
| 81 | + ) |
0 commit comments