oslo.vmware conf.py for building sphinx is wrong and fails build

Bug #1370370 reported by Thomas Goirand
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.vmware
Fix Released
High
Unassigned

Bug Description

In doc/source/conf.py, we have the below code:

exclude_patterns = [
    'api/tests.*', # avoid of docs generation from tests
    'api/oslo.vmware.openstack.common.*', # skip common modules
    'api/oslo.vmware._*', # skip private modules
]

# Prune the excluded patterns from the autoindex
for line in fileinput.input('api/autoindex.rst', inplace=True):
    found = False
    for pattern in exclude_patterns:
        if fnmatch.fnmatch(line, '*' + pattern[4:]):
            found = True
    if not found:
        print line,

If I call sphinx-build to build the doc like this (which is standard in my OpenStack Debian packages):
PYTHONPATH=. sphinx-build -b html doc/source debian/python-oslo.vmware-doc/usr/share/doc/python-oslo.vmware-doc/html

I get:
Exception occurred:
  File "/usr/lib/python2.7/fileinput.py", line 321, in readline
    os.rename(self._filename, self._backupfilename)
OSError: [Errno 2] No such file or directory
The full traceback has been saved in /tmp/sphinx-err-EsbLrr.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!

The .log file contains the below traceback:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/sphinx/cmdline.py", line 253, in main
    warningiserror, tags, verbosity, parallel)
  File "/usr/lib/python2.7/dist-packages/sphinx/application.py", line 107, in __init__
    confoverrides or {}, self.tags)
  File "/usr/lib/python2.7/dist-packages/sphinx/config.py", line 229, in __init__
    execfile_(filename, config)
  File "/usr/lib/python2.7/dist-packages/sphinx/util/pycompat.py", line 105, in execfile_
    exec code in _globals
  File "conf.py", line 43, in <module>
  File "/usr/lib/python2.7/fileinput.py", line 252, in next
    line = self.readline()
  File "/usr/lib/python2.7/fileinput.py", line 321, in readline
    os.rename(self._filename, self._backupfilename)
OSError: [Errno 2] No such file or directory

Commenting out the block starting with "for line in fileinput.input" repairs the sphinx-build call, which is how I patched oslo.vmware in Debian. Please fix the conf.py so that it may work unmodified.

Changed in oslo.vmware:
milestone: none → next-kilo
status: New → Triaged
importance: Undecided → High
Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

Removing those lines means we end up documenting classes and modules that we don't want published because they are internal details, so we need some other solution.

Changed in oslo.vmware:
status: Triaged → Confirmed
Changed in oslo.vmware:
milestone: 0.7.0 → kilo-next
Changed in oslo.vmware:
status: Confirmed → Fix Committed
Changed in oslo.vmware:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.