From 5a3f244bf063ea4323252b7193fb3a6f61aa2c80 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Fri, 2 Jun 2017 20:16:41 +0100 Subject: [PATCH] Tweaks to setup.py and associates. --- MANIFEST.in | 6 ++++-- README.md | 6 ++---- fsl/version.py | 2 +- setup.cfg | 3 +++ setup.py | 44 ++++++++++++++++++++------------------------ 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 8b6aa5b42..43a8f2413 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 a3ab1ba2f..b79542f16 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 a298768cc..857e009a6 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__ = '1.0.1' """Current version number, as a string. """ diff --git a/setup.cfg b/setup.cfg index b7e478982..945205e40 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 0d3977c53..3af744c9c 100644 --- a/setup.py +++ b/setup.py @@ -38,6 +38,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 +63,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 +105,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 +116,4 @@ setup( test_suite='tests', cmdclass={'doc' : doc}, - - entry_points={ - 'console_scripts' : [ - 'fslpy_imcp = fsl.scripts.imcp:main', - 'fslpy_immv = fsl.scripts.immv:main' - ] - } ) -- GitLab