diff --git a/fsl/scripts/__init__.py b/fsl/scripts/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4ef1e04becbabc6280ce9106f84d943d0e8e923b --- /dev/null +++ b/fsl/scripts/__init__.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python +# +# __init__.py - The fsl.scripts package. +# +# Author: Paul McCarthy <pauldmccarthy@gmail.com> +# +"""The ``fsl.scripts`` package contains all of the executable scripts provided +by ``fslpy``. +""" diff --git a/bin/fslpy_imcp b/fsl/scripts/imcp.py similarity index 81% rename from bin/fslpy_imcp rename to fsl/scripts/imcp.py index eb4441bdc1677c0feab2212008c2753a9213f945..71af0fd86c682751ccc351d680c02b4576f9260b 100755 --- a/bin/fslpy_imcp +++ b/fsl/scripts/imcp.py @@ -1,9 +1,15 @@ #!/usr/bin/env python # -# imcp - Copy image files. +# imcp.py - Copy image files. # # Author: Paul McCarthy <paulmc@fmrib.ox.ac.uk> # +"""This module defines the ``imcp`` application, for copying NIFTI image +files. + +The :func:`main` function is essentially a wrapper around the +:func:`fsl.utils.imcp.imcp` function - see its documentation for more details. +""" from __future__ import print_function @@ -33,6 +39,9 @@ def main(argv=None): :func:`fsl.utils.imcp.imcp` function on each input. """ + if argv is None: + argv = sys.argv[1:] + if len(argv) < 2: print(usage) sys.exit(1) diff --git a/bin/fslpy_immv b/fsl/scripts/immv.py similarity index 81% rename from bin/fslpy_immv rename to fsl/scripts/immv.py index 0b5a5ae54ae0571a138284e5794cb6659edf539b..66f57bd497c2838d7b88a6f74676fda372cdb8e0 100755 --- a/bin/fslpy_immv +++ b/fsl/scripts/immv.py @@ -1,10 +1,17 @@ #!/usr/bin/env python # -# immv - Move image files. +# immv.py - Move image files. # # Author: Paul McCarthy <paulmc@fmrib.ox.ac.uk> # +"""This module defines the ``immv`` application, for moving NIFTI image +files. + +The :func:`main` function is essentially a wrapper around the +:func:`fsl.utils.imcp.immv` function - see its documentation for more details. +""" + from __future__ import print_function @@ -53,7 +60,7 @@ def main(argv=None): for src in srcs: try: - imcp.immv(src, dest, useDefaultExt=True, move=True) + imcp.immv(src, dest, useDefaultExt=True) except Exception as e: print(e) diff --git a/setup.py b/setup.py index 53c4edb9b53c11295ba32967850388efbdbd303b..3b86a76c02001d495ceb05bb68a680a6a51d062d 100644 --- a/setup.py +++ b/setup.py @@ -60,8 +60,10 @@ setup( tests_require=['pytest', 'pytest-runner'], test_suite='tests', - scripts=[ - op.join('bin', 'fslpy_imcp'), - op.join('bin', 'fslpy_immv'), - ] + entry_points={ + 'console_scripts' : [ + 'fslpy_imcp = fsl.scripts.imcp:main', + 'fslpy_immv = fsl.scripts.immv:main' + ] + } )