Skip to content
Snippets Groups Projects
Commit 9bc7d650 authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Moved imcp/mv main scripts into a proper package, so they can be

programmatically invoked.
parent 5bf216bc
No related branches found
No related tags found
No related merge requests found
#!/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``.
"""
#!/usr/bin/env python #!/usr/bin/env python
# #
# imcp - Copy image files. # imcp.py - Copy image files.
# #
# Author: Paul McCarthy <paulmc@fmrib.ox.ac.uk> # 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 from __future__ import print_function
...@@ -33,6 +39,9 @@ def main(argv=None): ...@@ -33,6 +39,9 @@ def main(argv=None):
:func:`fsl.utils.imcp.imcp` function on each input. :func:`fsl.utils.imcp.imcp` function on each input.
""" """
if argv is None:
argv = sys.argv[1:]
if len(argv) < 2: if len(argv) < 2:
print(usage) print(usage)
sys.exit(1) sys.exit(1)
......
#!/usr/bin/env python #!/usr/bin/env python
# #
# immv - Move image files. # immv.py - Move image files.
# #
# Author: Paul McCarthy <paulmc@fmrib.ox.ac.uk> # 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 from __future__ import print_function
...@@ -53,7 +60,7 @@ def main(argv=None): ...@@ -53,7 +60,7 @@ def main(argv=None):
for src in srcs: for src in srcs:
try: try:
imcp.immv(src, dest, useDefaultExt=True, move=True) imcp.immv(src, dest, useDefaultExt=True)
except Exception as e: except Exception as e:
print(e) print(e)
......
...@@ -60,8 +60,10 @@ setup( ...@@ -60,8 +60,10 @@ setup(
tests_require=['pytest', 'pytest-runner'], tests_require=['pytest', 'pytest-runner'],
test_suite='tests', test_suite='tests',
scripts=[ entry_points={
op.join('bin', 'fslpy_imcp'), 'console_scripts' : [
op.join('bin', 'fslpy_immv'), 'fslpy_imcp = fsl.scripts.imcp:main',
] 'fslpy_immv = fsl.scripts.immv:main'
]
}
) )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment