diff --git a/MANIFEST.in b/MANIFEST.in index 8b6aa5b4271766573d220d4697b3f02888b4851d..43a8f2413ac698be518bddfce023c8de834c71bc 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,5 +2,7 @@ include LICENSE include COPYRIGHT include README.md include requirements.txt -recursive-include doc * -recursive-include tests * +include pytest.ini +recursive-include doc * +recursive-exclude doc/html * +recursive-include tests * diff --git a/README.md b/README.md index a3ab1ba2fc53104b2e61fb65808ad41e3a2094d4..b79542f1663cb2d807c408f8f6630b40e72e277e 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,7 @@ Documentation ------------- `fslpy` is documented using [sphinx](http://http://sphinx-doc.org/). You can -build the API documentation by installing `sphinx` and `sphinx-rtd-theme`, and -running: +build the API documentation by running: python setup.py doc @@ -35,8 +34,7 @@ guide](doc/contributing.rst). Tests ----- -To run the tests, install `mock`, `pytest`, `pytest-runner`, `pytest-html`, -and `pytest-cov`, and then run: +Run the test suite via: python setup.py test diff --git a/fsl/version.py b/fsl/version.py index a298768cc78e91752f334c35a2356eac9b12d80b..9acc9d7fd9b8247e8cf26252b5e34c05df77064f 100644 --- a/fsl/version.py +++ b/fsl/version.py @@ -32,7 +32,7 @@ which roughly obeys the Semantic Versioning conventions (http://semver.org/): import string -__version__ = '1.0.0' +__version__ = 'dev' """Current version number, as a string. """ @@ -44,6 +44,9 @@ def parseVersionString(versionString): An error is raised if the ``versionString`` is invalid. """ + if versionString == 'dev': + return 9999, 9999, 9999 + components = versionString.split('.') # Major, minor, and point diff --git a/setup.cfg b/setup.cfg index b7e478982ccf9ab1963c74e1084dfccb6e42c583..945205e404da5e22ef53f57f01f3d5fdf37f78d7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,5 @@ [aliases] test=pytest + +[bdist_wheel] +universal=1 \ No newline at end of file diff --git a/setup.py b/setup.py index 0d3977c53b6a1ed84ef68bf1c025d26f0c783214..8cb8e1dff62868e3fb34cfdd161c30c6b4db3be3 100644 --- a/setup.py +++ b/setup.py @@ -8,11 +8,8 @@ from __future__ import print_function -import os -import os.path as op -import subprocess as sp -import shutil -import pkgutil +import os.path as op +import shutil from setuptools import setup from setuptools import find_packages @@ -38,6 +35,7 @@ with open(op.join(basedir, "fsl", "version.py")) as f: if line.startswith('__version__'): exec(line, version) break +version = version['__version__'] with open(op.join(basedir, 'README.md'), 'rt') as f: readme = f.read() @@ -62,34 +60,37 @@ class doc(Command): if op.exists(destdir): shutil.rmtree(destdir) - env = dict(os.environ) - dirname = pkgutil.get_loader('fsl').get_filename() - dirname = op.dirname(dirname) - dirname = op.abspath(op.join(dirname, '..')) - ppath = [dirname] + print('Building documentation [{}]'.format(destdir)) - env['PYTHONPATH'] = op.pathsep.join(ppath) + import sphinx - print('Building documentation [{}]'.format(destdir)) + try: + import unittest.mock as mock + except: + import mock - sp.call(['sphinx-build', docdir, destdir], env=env) + mockedModules = [ + 'nibabel', + 'nibabel.fileslice', + 'numpy', + 'numpy.linalg'] + mockobj = mock.MagicMock() + mockedModules = { m : mockobj for m in mockedModules} -setup( + with mock.patch.dict('sys.modules', **mockedModules): + sphinx.main(['sphinx-build', docdir, destdir]) - name='fslpy', - version=version['__version__'], +setup( + name='fslpy', + version=version, description='FSL Python library', long_description=readme, - url='https://git.fmrib.ox.ac.uk/fsl/fslpy', - author='Paul McCarthy', - author_email='pauldmccarthy@gmail.com', - license='Apache License Version 2.0', classifiers=[ @@ -101,10 +102,9 @@ setup( 'Topic :: Software Development :: Libraries :: Python Modules'], packages=packages, - install_requires=install_requires, + setup_requires=['pytest-runner', 'sphinx', 'sphinx-rtd-theme', 'mock'], - setup_requires=['pytest-runner'], tests_require=['mock', 'pytest-cov', 'pytest-html', @@ -113,11 +113,4 @@ setup( test_suite='tests', cmdclass={'doc' : doc}, - - entry_points={ - 'console_scripts' : [ - 'fslpy_imcp = fsl.scripts.imcp:main', - 'fslpy_immv = fsl.scripts.immv:main' - ] - } )