Skip to content

setuptools: Support multiple builders - #3476

Merged
tk0miya merged 2 commits into
sphinx-doc:masterfrom
stephenfin:feat/sphinx-setuptools-multiple-builders
Mar 1, 2017
Merged

tk0miya merged 2 commits into
sphinx-doc:masterfrom
stephenfin:feat/sphinx-setuptools-multiple-builders

Conversation

@stephenfin

Copy link
Copy Markdown
Contributor

Subject: Support multiple builders in setuptools integration

Feature or Bugfix

  • Feature

Purpose

At present, the 'builder' option for the setuptools integration only
supports a single output format, typically HTML, like so:

[build_sphinx]
builder = man

There is value in being able to specify multiple format, like so:

[build_sphinx]
builder = html man

Make this possible.

Detail

  • N/A

Relates

  • N/A

@tk0miya tk0miya added the type:proposal a feature suggestion label Feb 28, 2017
@tk0miya tk0miya added this to the 1.6 milestone Feb 28, 2017

@tk0miya tk0miya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM with nits.

Comment thread sphinx/setup_command.py Outdated
self.mkpath(self.builder_target_dir) # type: ignore
self.builder_target_dirs = [
(builder, os.path.join(self.build_dir, builder))
for builder in self.builder] # type: List[(str, str)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This type annotation is invalid. You should use List[Tuple[str, str]] instead.
https://travis-ci.org/sphinx-doc/sphinx/jobs/205824862#L594

BTW, I think the second element of the tuple is a unicode string.
Certainly builder is raw string, but self.build_dir is a unicode (because we can build docs on path including multibytes). As a result, the joined string becomes a unicode string.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread sphinx/setup_command.py Outdated
self.config_dir = self.source_dir
self.config_dir = abspath(self.config_dir)

self.ensure_string_list('builder')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm sorry, but could you add # type: ignore label?
It seems mypy does not know ensure_string_list() unfortunately.
https://travis-ci.org/sphinx-doc/sphinx/jobs/205824862#L593

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@stephenfin
stephenfin force-pushed the feat/sphinx-setuptools-multiple-builders branch from 2c6243c to 581a693 Compare February 28, 2017 14:43
Comment thread sphinx/setup_command.py Outdated
self.mkpath(self.builder_target_dir) # type: ignore
self.builder_target_dirs = [
(builder, os.path.join(self.build_dir, builder))
for builder in self.builder] # type: List[Tuple[str, str]]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh, I'm very sorry. I'd forgotten to say you that you need to import Tuple like following:

 if False:
     # For type annotation
+    from typing import Any, Tuple  # NOQA
-    from typing import Any  # NOQA

https://travis-ci.org/sphinx-doc/sphinx/jobs/206202604#L591

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Weird - I'm running this locally (tox -e py36) and it's passing. Sorry about that

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now type verification is invoked outside of tox: make type-check. style check (flake8) is also. Sorry for confusing

@stephenfin
stephenfin force-pushed the feat/sphinx-setuptools-multiple-builders branch from 581a693 to 3cd9c93 Compare February 28, 2017 15:25
At present, the 'builder' option for the setuptools integration only
supports a single output format, typically HTML, like so:

  [build_sphinx]
  builder = man

There is value in being able to specify multiple format, like so:

  [build_sphinx]
  builder = html man

Make this possible.

Signed-off-by: Stephen Finucane <[email protected]>
Like the recently added 'docs' target, this is easier than creating a
virtualenv, installing deps and running make.

Signed-off-by: Stephen Finucane <[email protected]>
@stephenfin
stephenfin force-pushed the feat/sphinx-setuptools-multiple-builders branch from 3cd9c93 to 8b500fe Compare February 28, 2017 17:33
@tk0miya

tk0miya commented Mar 1, 2017

Copy link
Copy Markdown
Member

The test was broken, but it was caused by troubles in AWS.
Now I re-run tests manually, and it got succeeded.

@tk0miya
tk0miya merged commit a98818b into sphinx-doc:master Mar 1, 2017
@tk0miya

tk0miya commented Mar 1, 2017

Copy link
Copy Markdown
Member

Merged. Thank you for contribution!

@stephenfin
stephenfin deleted the feat/sphinx-setuptools-multiple-builders branch July 10, 2017 13:30
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

type:proposal a feature suggestion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants