Skip to content

Commit 24375b2

Browse files
authored
Merge pull request #3208 from yarikoptic/rf-sys-python
REF: make invocations of python and pytest consistent with the one used/desired python
2 parents 3bfd2f2 + c7efd5b commit 24375b2

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ zipdoc: html
1111

1212
sdist: zipdoc
1313
@echo "Building source distribution..."
14-
python setup.py sdist
14+
$(PYTHON) setup.py sdist
1515
@echo "Done building source distribution."
1616
# XXX copy documentation.zip to dist directory.
1717

1818
egg: zipdoc
1919
@echo "Building egg..."
20-
python setup.py bdist_egg
20+
$(PYTHON) setup.py bdist_egg
2121
@echo "Done building egg."
2222

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

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

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

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

6464
test: tests # just another name
6565
tests: clean test-code
@@ -70,7 +70,7 @@ html:
7070

7171
specs:
7272
@echo "Checking specs and autogenerating spec tests"
73-
env PYTHONPATH=".:$(PYTHONPATH)" python tools/checkspecs.py
73+
env PYTHONPATH=".:$(PYTHONPATH)" $(PYTHON) tools/checkspecs.py
7474

7575
check: check-before-commit # just a shortcut
7676
check-before-commit: specs trailing-spaces html test

doc/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from pathlib import Path
1717
from tempfile import TemporaryDirectory
1818
import shutil
19+
import sys
1920
from packaging.version import Version
2021
import nipype
2122
import subprocess as sp
@@ -54,7 +55,7 @@
5455

5556
sp.run(
5657
[
57-
"python",
58+
sys.executable,
5859
ex2rst,
5960
"--outdir",
6061
str(example_dir),
@@ -70,7 +71,7 @@
7071
)
7172
sp.run(
7273
[
73-
"python",
74+
sys.executable,
7475
ex2rst,
7576
"--outdir",
7677
str(example_dir),

nipype/interfaces/freesurfer/preprocess.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import os.path as op
88
from glob import glob
99
import shutil
10+
import sys
1011

1112
import numpy as np
1213
from nibabel import load
@@ -726,7 +727,7 @@ def cmdline(self):
726727
outdir = self._get_outdir()
727728
cmd = []
728729
if not os.path.exists(outdir):
729-
cmdstr = "python -c \"import os; os.makedirs('%s')\"" % outdir
730+
cmdstr = "%s -c \"import os; os.makedirs('%s')\"" % (op.basename(sys.executable), outdir)
730731
cmd.extend([cmdstr])
731732
infofile = os.path.join(outdir, "shortinfo.txt")
732733
if not os.path.exists(infofile):

tools/toollib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def sh(cmd):
3131
def compile_tree():
3232
"""Compile all Python files below current directory."""
3333
vstr = ".".join(map(str, sys.version_info[:2]))
34-
stat = os.system("python %s/lib/python%s/compileall.py ." % (sys.prefix, vstr))
34+
stat = os.system("%s %s/lib/python%s/compileall.py ." % (sys.executable, sys.prefix, vstr))
3535
if stat:
3636
msg = "*** ERROR: Some Python files in tree do NOT compile! ***\n"
3737
msg += "See messages above for the actual file that produced it.\n"

0 commit comments

Comments
 (0)