Repository: nipy/nipype

Issue:
Building docs - sphinx inheritance diagram
Building docs fails with Sphinx 1.2
Apparently xfileref_role has been removed from sphinx.

This post on debian may contain any useful info:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=711200

This is beyond my current python skill level.

Here's the error log:
MH01918702MACLT:nipype-github inatisj$ python setup.py build_sphinx
Warning: No module named info/bin/sh: hg: command not found
running build_sphinx
running api_docs
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_py
running build_scripts
running install_lib
copying build/lib/nipype/COMMIT_INFO.txt -> build/install/nipype
running install_scripts
changing mode of build/install/nipype_display_crash to 755
running install_data
running install_egg_info
Removing build/install/nipype-0.9.0.pre-py2.7.egg-info
Writing build/install/nipype-0.9.0.pre-py2.7.egg-info
running install_clib
customize UnixCCompiler
/Users/inatisj/local/src/nipype-github/nipype/interfaces/dipy/tensors.py:26: UserWarning: dipy not installed
  warnings.warn('dipy not installed')
/Users/inatisj/local/src/nipype-github/nipype/interfaces/nipy/model.py:20: UserWarning: nipy not installed
  warnings.warn('nipy not installed')
/Users/inatisj/local/src/nipype-github/nipype/interfaces/nipy/preprocess.py:22: UserWarning: nipy not installed
  warnings.warn('nipy not installed')
/Users/inatisj/local/src/nipype-github/nipype/interfaces/nipy/utils.py:18: UserWarning: nipy not installed
  warnings.warn('nipy not installed')
Installed version: 0.9.0.pre
Current stable version: 0.8.0
Current dev version: 0.9.0.pre
WARNING: Empty - nipype
WARNING: Empty - nipype.algorithms
ICC
AddCSVColumn
CalculateNormalizedMoments
CreateNifti
Distance
Gunzip
Matlab2CSV
MergeCSVFiles
ModifyAffine
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/inatisj/local/src/nipype-github/tools/build_interface_docs.py", line 54, in <module>
    docwriter.write_api_docs(outdir)
  File "/Users/inatisj/local/src/nipype-github/tools/interfacedocgen.py", line 467, in write_api_docs
    self.write_modules_api(modules,outdir)
  File "/Users/inatisj/local/src/nipype-github/tools/interfacedocgen.py", line 434, in write_modules_api
    api_str = self.generate_api_doc(m)
  File "/Users/inatisj/local/src/nipype-github/tools/interfacedocgen.py", line 306, in generate_api_doc
    ad += trim(classinst.help(returnhelp=True),
  File "/Users/inatisj/local/src/nipype-github/nipype/interfaces/base.py", line 694, in help
    cls._outputs_help() + [''])
  File "/Users/inatisj/local/src/nipype-github/nipype/interfaces/base.py", line 759, in _inputs_help
    opthelpstr += cls._get_trait_desc(inputs, name, spec)
  File "/Users/inatisj/local/src/nipype-github/nipype/interfaces/base.py", line 714, in _get_trait_desc
    def_val = ', nipype default value: %s' % def_arg
TypeError: not all arguments converted during string formatting
Running Sphinx v1.2b1
Traceback (most recent call last):
  File "setup.py", line 103, in <module>
    main(**extra_setuptools_args)
  File "setup.py", line 98, in main
    **extra_args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/distutils/core.py", line 186, in setup
    return old_setup(**new_attr)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/Users/inatisj/local/src/nipype-github/build_docs.py", line 129, in run
    BuildDoc.run(self)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sphinx/setup_command.py", line 140, in run
    freshenv=self.fresh_env)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sphinx/application.py", line 119, in __init__
    self.setup_extension(extension)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sphinx/application.py", line 285, in setup_extension
    err)
sphinx.errors.ExtensionError: Could not import extension inheritance_diagram (exception: cannot import name xfileref_role)



Discussion:

Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -36,7 +36,6 @@
               'sphinx.ext.doctest',
               'sphinx.ext.pngmath',
               'sphinx.ext.autosummary',
-              'inheritance_diagram',
               'numpy_ext.numpydoc',
               'matplotlib.sphinxext.plot_directive',
               'matplotlib.sphinxext.only_directives'
diff --git a/nipype/interfaces/base.py b/nipype/interfaces/base.py
--- a/nipype/interfaces/base.py
+++ b/nipype/interfaces/base.py
@@ -711,7 +711,7 @@ def _get_trait_desc(self, inputs, name, spec):
             def_val = ''
             if getattr(spec, 'usedefault'):
                 def_arg = getattr(spec, 'default_value')()[1]
-                def_val = ', nipype default value: %s' % def_arg
+                def_val = ', nipype default value: %s' % str(def_arg)
             line = "(%s%s)" % (excp.info, def_val)
             manhelpstr = wrap(line, 70,
                               initial_indent=manhelpstr[0]+': ',


Test patch: