Skip to content

Commit

Permalink
Merge pull request #1082 from effigies/py2/simplify_wrapper
Browse files Browse the repository at this point in the history
fmriprep-docker: Support Python 2/3 without future or other helpers
  • Loading branch information
effigies committed May 1, 2018
2 parents 1a9f70f + 016fe74 commit 057fa41
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
21 changes: 19 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,27 @@ jobs:
poldracklab/fmriprep:latest . \
--doctest-modules --ignore=docs --ignore=setup.py
- run:
name: Test fmriprep-wrapper
name: Test fmriprep-wrapper (Python 2)
command: |
pip install future numpy
export PY2=$(pyenv versions | grep '2\.' |
sed -e 's/.* 2\./2./' -e 's/ .*//')
pyenv local $PY2
echo -n "Python version: "
python --version
pip install --upgrade wrapper/
which fmriprep-docker
fmriprep-docker -i poldracklab/fmriprep:latest --help
fmriprep-docker -i poldracklab/fmriprep:latest --version
- run:
name: Test fmriprep-wrapper (Python 3)
command: |
export PY3=$(pyenv versions | grep '3\.' |
sed -e 's/.* 3\./3./' -e 's/ .*//')
pyenv local $PY3
echo -n "Python version: "
python --version
pip install --upgrade wrapper/
which fmriprep-docker
fmriprep-docker -i poldracklab/fmriprep:latest --help
fmriprep-docker -i poldracklab/fmriprep:latest --version
- store_artifacts:
Expand Down
17 changes: 9 additions & 8 deletions wrapper/fmriprep_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@
forget to credit all the authors of software that fMRIPrep
uses (http://fmriprep.rtfd.io/en/latest/citing.html).
"""
from __future__ import print_function, unicode_literals, division, absolute_import
from builtins import int, map, input, zip
from future import standard_library
import sys
import os
import re
import subprocess
from warnings import warn

standard_library.install_aliases()

__version__ = '99.99.99'
__packagename__ = 'fmriprep-docker'
__author__ = 'The CRN developers'
Expand Down Expand Up @@ -96,6 +91,13 @@ def _run(args, stdout=None, stderr=None):
subprocess.run = _run


# De-fang Python 2's input - we don't eval user input
try:
input = raw_input
except NameError:
pass


def check_docker():
"""Verify that docker is installed and the user has permission to
run docker images.
Expand Down Expand Up @@ -302,11 +304,10 @@ def main():
print('fmriprep wrapper {!s}'.format(__version__))
if opts.help:
parser.print_help()
print("fmriprep: ", end='')
if check == -1:
print("Could not find docker command... Is it installed?")
print("fmriprep: Could not find docker command... Is it installed?")
else:
print("Make sure you have permission to run 'docker'")
print("fmriprep: Make sure you have permission to run 'docker'")
return 1

# For --help or --version, ask before downloading an image
Expand Down
4 changes: 2 additions & 2 deletions wrapper/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def main():
license=info['__license__'],
classifiers=info['CLASSIFIERS'],
# Dependencies handling
setup_requires=['future'],
install_requires=['future'],
setup_requires=[],
install_requires=[],
tests_require=[],
extras_require={},
dependency_links=[],
Expand Down

0 comments on commit 057fa41

Please sign in to comment.