Skip to content

REF: make invocations of python and pytest consistent with the one used/desired python #3208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ zipdoc: html

sdist: zipdoc
@echo "Building source distribution..."
python setup.py sdist
$(PYTHON) setup.py sdist
@echo "Done building source distribution."
# XXX copy documentation.zip to dist directory.

egg: zipdoc
@echo "Building egg..."
python setup.py bdist_egg
$(PYTHON) setup.py bdist_egg
@echo "Done building egg."

upload_to_pypi: zipdoc
@echo "Uploading to PyPi..."
python setup.py sdist --formats=zip,gztar upload
$(PYTHON) setup.py sdist --formats=zip,gztar upload

trailing-spaces:
find . -name "*[.py|.rst]" -type f | xargs perl -pi -e 's/[ \t]*$$//'
Expand Down Expand Up @@ -56,10 +56,10 @@ inplace:
$(PYTHON) setup.py build_ext -i

test-code: in
py.test --doctest-modules nipype
$(PYTHON) -m pytest --doctest-modules nipype

test-coverage: clean-tests in
py.test --doctest-modules --cov-config .coveragerc --cov=nipype nipype
$(PYTHON) -m pytest --doctest-modules --cov-config .coveragerc --cov=nipype nipype

test: tests # just another name
tests: clean test-code
Expand All @@ -70,7 +70,7 @@ html:

specs:
@echo "Checking specs and autogenerating spec tests"
env PYTHONPATH=".:$(PYTHONPATH)" python tools/checkspecs.py
env PYTHONPATH=".:$(PYTHONPATH)" $(PYTHON) tools/checkspecs.py

check: check-before-commit # just a shortcut
check-before-commit: specs trailing-spaces html test
Expand Down
5 changes: 3 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from pathlib import Path
from tempfile import TemporaryDirectory
import shutil
import sys
from packaging.version import Version
import nipype
import subprocess as sp
Expand Down Expand Up @@ -54,7 +55,7 @@

sp.run(
[
"python",
sys.executable,
ex2rst,
"--outdir",
str(example_dir),
Expand All @@ -70,7 +71,7 @@
)
sp.run(
[
"python",
sys.executable,
ex2rst,
"--outdir",
str(example_dir),
Expand Down
3 changes: 2 additions & 1 deletion nipype/interfaces/freesurfer/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os.path as op
from glob import glob
import shutil
import sys

import numpy as np
from nibabel import load
Expand Down Expand Up @@ -726,7 +727,7 @@ def cmdline(self):
outdir = self._get_outdir()
cmd = []
if not os.path.exists(outdir):
cmdstr = "python -c \"import os; os.makedirs('%s')\"" % outdir
cmdstr = "%s -c \"import os; os.makedirs('%s')\"" % (op.basename(sys.executable), outdir)
cmd.extend([cmdstr])
infofile = os.path.join(outdir, "shortinfo.txt")
if not os.path.exists(infofile):
Expand Down
2 changes: 1 addition & 1 deletion tools/toollib.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def sh(cmd):
def compile_tree():
"""Compile all Python files below current directory."""
vstr = ".".join(map(str, sys.version_info[:2]))
stat = os.system("python %s/lib/python%s/compileall.py ." % (sys.prefix, vstr))
stat = os.system("%s %s/lib/python%s/compileall.py ." % (sys.executable, sys.prefix, vstr))
if stat:
msg = "*** ERROR: Some Python files in tree do NOT compile! ***\n"
msg += "See messages above for the actual file that produced it.\n"
Expand Down