From 2242226b503f72ae80b29085dc58421cb885ea81 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauld.mccarthy@gmail.com> Date: Fri, 4 Sep 2015 12:17:19 +0100 Subject: [PATCH] fslpy now has an official version number, as stored in fsl/version.py. The setup.py modification has not been tested. --- doc/conf.py | 8 ++++++-- doc/fsl.rst | 4 ++-- doc/fsl.version.rst | 7 +++++++ fsl/__init__.py | 13 ++++++++++++- fsl/version.py | 18 ++++++++++++++++++ setup.py | 16 +++++++++++++++- 6 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 doc/fsl.version.rst create mode 100644 fsl/version.py diff --git a/doc/conf.py b/doc/conf.py index 493064040..4d9c3e553 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -34,8 +34,11 @@ extensions = [ 'sphinx.ext.viewcode', 'sphinx.ext.mathjax', 'sphinx.ext.graphviz', + 'sphinx.ext.todo', ] +todo_include_todos = True + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -57,9 +60,10 @@ copyright = u'2015, Paul McCarthy, FMRIB Centre' # built documents. # # The short X.Y version. -version = '' +import fsl +version = fsl.__version__ # The full version, including alpha/beta/rc tags. -release = '' +release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/fsl.rst b/doc/fsl.rst index 378faff43..3a79585f8 100644 --- a/doc/fsl.rst +++ b/doc/fsl.rst @@ -1,5 +1,5 @@ -fsl package -=========== +fslpy |version| +=============== .. automodule:: fsl :members: diff --git a/doc/fsl.version.rst b/doc/fsl.version.rst new file mode 100644 index 000000000..0514d9588 --- /dev/null +++ b/doc/fsl.version.rst @@ -0,0 +1,7 @@ +fsl.version module +================== + +.. automodule:: fsl.version + :members: + :undoc-members: + :show-inheritance: diff --git a/fsl/__init__.py b/fsl/__init__.py index 482c7f16b..6a5e19bef 100644 --- a/fsl/__init__.py +++ b/fsl/__init__.py @@ -39,9 +39,12 @@ The conventional way to run ``fslpy`` is as follows:: ``logging`` level for tracking memory usage. The log level is attached to the ``logging`` module as ``logging.MEMORY``, and an associated log function is attached as ``logging.memory``. -""" +.. note:: The ``fslpy`` version number (currently |version|) is set in a + single place - the :mod:`fsl.version` module. +""" + import logging import pkgutil import warnings @@ -56,6 +59,14 @@ import subprocess import fsl.tools as tools import fsl.utils.settings as fslsettings +import fsl.version + + +__version__ = fsl.version.__version__ +"""The current ``fslpy`` version number. This information is stored in the +:mod:`fsl.version` module. +""" + def main(args=None): """``fslpy`` entry point. diff --git a/fsl/version.py b/fsl/version.py new file mode 100644 index 000000000..5a716b7ff --- /dev/null +++ b/fsl/version.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# +# version.py - fslpy version information. +# +# Author: Paul McCarthy <pauldmccarthy@gmail.com> +# +"""The sole purpose of this module is as a container for the ``fslpy`` +version number and information. + +.. autosummary:: + + __version__ + +.. todo:: Define a formal ``fslpy`` version number updating scheme. +""" + +__version__ = '0.1' +"""Current version number, as a string. """ diff --git a/setup.py b/setup.py index ae0c24edd..d50084c83 100644 --- a/setup.py +++ b/setup.py @@ -5,15 +5,29 @@ # Author: Paul McCarthy <pauldmccarthy@gmail.com> # +import os.path as op + from setuptools import setup from setuptools import find_packages +# The directory in whihc this setup.py file is contained. +basedir = op.dirname(__file__) + + +# Figure out the current fslpy version, as defined in fsl/version.py. We +# don't want to import the fsl package, as this may cause build problems. +# So we manually parse the contents of fsl/version.py to extract the +# version number. +version = {} +with open(op.join(basedir, "fsl", "version.py")) as f: + exec(f.read(), version) + setup( name='fslpy', - version='0.1', + version=version['__version__'], description='Front end to FSL tools', -- GitLab