[1f991d6] | 1 | import sys |
---|
| 2 | from setuptools import setup |
---|
| 3 | from setuptools.command.test import test as TestCommand |
---|
| 4 | |
---|
| 5 | class PyTest(TestCommand): |
---|
| 6 | user_options = [('pytest-args=', 'a', "Arguments to pass to pytest")] |
---|
| 7 | |
---|
| 8 | def initialize_options(self): |
---|
| 9 | TestCommand.initialize_options(self) |
---|
| 10 | self.pytest_args = '' |
---|
| 11 | |
---|
| 12 | def run_tests(self): |
---|
| 13 | import shlex |
---|
| 14 | #import here, cause outside the eggs aren't loaded |
---|
| 15 | import pytest |
---|
| 16 | errno = pytest.main(shlex.split(self.pytest_args)) |
---|
| 17 | sys.exit(errno) |
---|
[040575f] | 18 | |
---|
[948b8c1] | 19 | def find_version(package): |
---|
| 20 | """Read package version string from __init__.py""" |
---|
| 21 | import os |
---|
| 22 | with open(os.path.join(package, '__init__.py')) as fid: |
---|
| 23 | for line in fid.readlines(): |
---|
| 24 | if line.startswith('__version__'): |
---|
| 25 | line = line[:line.find('#')] # strip comment, if any |
---|
| 26 | version = line.split('=', 2)[1].strip() |
---|
| 27 | if version[0] != version[-1] or version[0] not in "\"'": |
---|
| 28 | break |
---|
| 29 | return version[1:-1] |
---|
| 30 | raise RuntimeError("Could not read version from %s/__init__.py"%package) |
---|
[040575f] | 31 | |
---|
[783e76f] | 32 | install_requires = ['numpy', 'scipy'] |
---|
| 33 | |
---|
| 34 | if sys.platform=='win32' or sys.platform=='cygwin': |
---|
| 35 | install_requires.append('tinycc') |
---|
| 36 | |
---|
[040575f] | 37 | setup( |
---|
[948b8c1] | 38 | name='sasmodels', |
---|
| 39 | version=find_version('sasmodels'), |
---|
| 40 | description="sasmodels package", |
---|
[3a161d0] | 41 | long_description=open('README.rst').read(), |
---|
[948b8c1] | 42 | author="SasView Collaboration", |
---|
| 43 | author_email="management@sasview.org", |
---|
| 44 | url="http://www.sasview.org", |
---|
| 45 | keywords="small-angle x-ray and neutron scattering analysis", |
---|
| 46 | download_url="https://github.com/SasView/sasmodels", |
---|
[040575f] | 47 | classifiers=[ |
---|
| 48 | 'Development Status :: 4 - Beta', |
---|
| 49 | 'Environment :: Console', |
---|
| 50 | 'Intended Audience :: Science/Research', |
---|
| 51 | 'License :: Public Domain', |
---|
| 52 | 'Operating System :: OS Independent', |
---|
| 53 | 'Programming Language :: Python', |
---|
[948b8c1] | 54 | 'Programming Language :: C', |
---|
[040575f] | 55 | 'Topic :: Scientific/Engineering', |
---|
| 56 | 'Topic :: Scientific/Engineering :: Chemistry', |
---|
| 57 | 'Topic :: Scientific/Engineering :: Physics', |
---|
| 58 | ], |
---|
[948b8c1] | 59 | packages=[ |
---|
| 60 | 'sasmodels', |
---|
| 61 | 'sasmodels.models', |
---|
| 62 | 'sasmodels.custom' |
---|
| 63 | ], |
---|
| 64 | package_data={ |
---|
| 65 | 'sasmodels.models': ['*.c', 'lib/*.c'], |
---|
[32e3c9b] | 66 | 'sasmodels': ['*.c', '*.cl'], |
---|
[948b8c1] | 67 | }, |
---|
[783e76f] | 68 | install_requires=install_requires, |
---|
[1f991d6] | 69 | extras_require={ |
---|
[783e76f] | 70 | 'full': ['docutils', 'bumps', 'matplotlib'], |
---|
| 71 | 'server': ['bumps'], |
---|
[040575f] | 72 | 'OpenCL': ["pyopencl"], |
---|
[948b8c1] | 73 | }, |
---|
[1f991d6] | 74 | build_requires=['setuptools'], |
---|
| 75 | test_requires=['pytest'], |
---|
| 76 | cmdclass = {'test': PyTest}, |
---|
[948b8c1] | 77 | ) |
---|