Skip to content
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

doc/man: avoid file builtin to solve build error #11984

Merged
merged 1 commit into from Nov 15, 2016

Conversation

batrick
Copy link
Member

@batrick batrick commented Nov 15, 2016

Sphinx running with Python 3.X fails:

# Sphinx version: 1.4.8
# Python version: 3.5.2 (CPython)
# Docutils version: 0.12 release
# Jinja2 version: 2.8
# Last messages:

# Loaded extensions:
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/sphinx/cmdline.py", line 243, in main
    opts.warningiserror, opts.tags, opts.verbosity, opts.jobs)
  File "/usr/lib/python3.5/site-packages/sphinx/application.py", line 137, in __init__
    confoverrides or {}, self.tags)
  File "/usr/lib/python3.5/site-packages/sphinx/config.py", line 287, in __init__
    execfile_(filename, config)
  File "/usr/lib/python3.5/site-packages/sphinx/util/pycompat.py", line 130, in execfile_
    exec_(code, _globals)
  File "conf.py", line 56, in <module>
  File "conf.py", line 47, in _get_manpages
  File "conf.py", line 12, in _get_description
NameError: name 'file' is not defined

Signed-off-by: Patrick Donnelly pdonnell@redhat.com

@@ -9,7 +10,7 @@


def _get_description(fname, base):
with file(fname) as f:
with contextlib.closing(open(fname)) as f:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just put open(fname) which is acceptable in both py2 and py3.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. I was thinking of sockets which need contextlib.closing. Thanks @tchaikov!

Fixed in new commit.

Sphinx running with Python 3.X fails:

    # Sphinx version: 1.4.8
    # Python version: 3.5.2 (CPython)
    # Docutils version: 0.12 release
    # Jinja2 version: 2.8
    # Last messages:

    # Loaded extensions:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/site-packages/sphinx/cmdline.py", line 243, in main
        opts.warningiserror, opts.tags, opts.verbosity, opts.jobs)
      File "/usr/lib/python3.5/site-packages/sphinx/application.py", line 137, in __init__
        confoverrides or {}, self.tags)
      File "/usr/lib/python3.5/site-packages/sphinx/config.py", line 287, in __init__
        execfile_(filename, config)
      File "/usr/lib/python3.5/site-packages/sphinx/util/pycompat.py", line 130, in execfile_
        exec_(code, _globals)
      File "conf.py", line 56, in <module>
      File "conf.py", line 47, in _get_manpages
      File "conf.py", line 12, in _get_description
    NameError: name 'file' is not defined

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
@tchaikov
Copy link
Contributor

lgtm, tested manually.

@tchaikov tchaikov merged commit eadf98f into ceph:master Nov 15, 2016
@batrick batrick deleted the sphinx-py3-error branch November 15, 2016 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants