Skip to content

Commit 73ce5d6

Browse files
committed
Merge pull request #124 from matthew-brett/checkfor-missing-scripts
RF: refactor installation checks to check scripts Rewrite of testers module for clarity, in part. Add a routine that allows us to check if any scripts have been missed in the installation. Add this to the Makefile as a target and to the release checklist. Refactor nifti diagnostic script, rename to nib-nifti-dx Add nib-dicomfs, nib-nifti-dx to setup.py
2 parents 15ab87a + 0f56d47 commit 73ce5d6

File tree

6 files changed

+279
-99
lines changed

6 files changed

+279
-99
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ bdist_rpm:
229229
bdist_mpkg:
230230
$(PYTHON) tools/mpkg_wrapper.py setup.py install
231231

232+
# Check for files not installed
233+
check-files:
234+
$(PYTHON) -c 'from nisext.testers import check_files; check_files("nibabel")'
232235

233236
# Print out info for possible install methods
234237
check-version-info:

bin/nib-nifti-dx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env python
2+
# emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
3+
# vi: set ft=python sts=4 ts=4 sw=4 et:
4+
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
5+
#
6+
# See COPYING file distributed along with the NiBabel package for the
7+
# copyright and license terms.
8+
#
9+
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
10+
''' Print nifti diagnostics for header files '''
11+
12+
import sys
13+
14+
from optparse import OptionParser
15+
16+
import nibabel as nib
17+
18+
19+
def main():
20+
""" Go go team """
21+
parser = OptionParser(
22+
usage="%s [FILE ...]\n\n" % sys.argv[0] + __doc__,
23+
version="%prog " + nib.__version__)
24+
(opts, files) = parser.parse_args()
25+
26+
for fname in files:
27+
fobj = nib.volumeutils.allopen(fname)
28+
hdr = fobj.read(nib.nifti1.header_dtype.itemsize)
29+
result = nib.Nifti1Header.diagnose_binaryblock(hdr)
30+
if len(result):
31+
print 'Picky header check output for "%s"\n' % fname
32+
print result
33+
print
34+
else:
35+
print 'Header for "%s" is clean' % fname
36+
37+
38+
if __name__ == '__main__':
39+
main()

bin/nifti1_diagnose.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

doc/source/devel/make_release.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,20 @@ Release checklist
9696
{'sys_version': '2.6.6 (r266:84374, Aug 31 2010, 11:00:51) \n[GCC 4.0.1 (Apple Inc. build 5493)]', 'commit_source': 'archive substitution', 'np_version': '1.5.0', 'commit_hash': '25b4125', 'pkg_path': '/var/folders/jg/jgfZ12ZXHwGSFKD85xLpLk+++TI/-Tmp-/tmpGPiD3E/pylib/nibabel', 'sys_executable': '/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python', 'sys_platform': 'darwin'}
9797
/var/folders/jg/jgfZ12ZXHwGSFKD85xLpLk+++TI/-Tmp-/tmpGPiD3E/pylib/nibabel/__init__.pyc
9898
{'sys_version': '2.6.6 (r266:84374, Aug 31 2010, 11:00:51) \n[GCC 4.0.1 (Apple Inc. build 5493)]', 'commit_source': 'installation', 'np_version': '1.5.0', 'commit_hash': '25b4125', 'pkg_path': '/var/folders/jg/jgfZ12ZXHwGSFKD85xLpLk+++TI/-Tmp-/tmpGPiD3E/pylib/nibabel', 'sys_executable': '/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python', 'sys_platform': 'darwin'}
99-
Files not taken across by the installation:
100-
[]
10199
/Users/mb312/dev_trees/nibabel/nibabel/__init__.pyc
102100
{'sys_version': '2.6.6 (r266:84374, Aug 31 2010, 11:00:51) \n[GCC 4.0.1 (Apple Inc. build 5493)]', 'commit_source': 'repository', 'np_version': '1.5.0', 'commit_hash': '25b4125', 'pkg_path': '/Users/mb312/dev_trees/nibabel/nibabel', 'sys_executable': '/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python', 'sys_platform': 'darwin'}
103101

102+
* Check the ``setup.py`` file is picking up all the library code and scripts,
103+
with::
104+
105+
make check-files
106+
107+
Look for output at the end about missed files, such as::
108+
109+
Missed script files: /Users/mb312/dev_trees/nibabel/bin/nib-dicomfs, /Users/mb312/dev_trees/nibabel/bin/nifti1_diagnose.py
110+
111+
Fix ``setup.py`` to carry across any files that should be in the distribution.
112+
104113
* You probably have virtualenvs for different python versions. Check the tests
105114
pass for different configurations. If you have pytox_ and a network
106115
connnection, and lots of pythons installed, you might be able to do::

0 commit comments

Comments
 (0)