Commit Graph
100 Commits
Author SHA1 Message Date
Stephen Finucane 0b81af6a2e doc: Rework "extensions" documents
This is mostly spacing and other "niceness" fixes.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-06-20 09:26:59 +01:00
Stephen Finucane b595c4a45b doc: Add "builders" to usage guide
This is placed in a directory as this document will eventually be split
up. However, this is not the day to do this.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-06-20 09:26:59 +01:00
Stephen Finucane 7e27e09493 doc: Rework "builders" document
There are a number of cleanup items.

- Some paragraphs are reworded or clarified
- Semantic markup is added where possible
- Everything is wrapped to ~80 characters

A number of TODOs are inserted. These will be resolved separately.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-06-20 09:26:59 +01:00
Stephen Finucane 0bf8886fc4 doc: Address review comments
These came up in the review for pull request #4799.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-04-30 21:41:12 +01:00
Stephen Finucane 16e76faba3 doc: Add "config" to usage guide
Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-04-30 21:36:45 +01:00
Stephen Finucane ac19be3585 doc: Rework "config" document
Wrap some lines and format some definition lists as such.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-04-30 21:36:44 +01:00
Stephen Finucane d1972ac5b5 doc: Add "markdown" section to usage guide
Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-04-30 21:36:44 +01:00
Stephen Finucane dcf07f8005 doc: Rework "markdown" document
There are a number of cleanup items.

- Some paragraphs are reworded or clarified
- Semantic markup is added where possible
- Everything is wrapped to ~80 characters

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-04-30 21:36:44 +01:00
Stephen Finucane 7a8d1dc08c doc: Fix line length
Keep things in the fixed docs under 80 characters.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-04-30 21:36:44 +01:00
Stephen Finucane 651d41e1c7 Mark raw string as such
Resolves the following warning when building docs:

  sphinx/ext/autosummary/__init__.py:94: DeprecationWarning: invalid
  escape sequence \.
    periods_re = re.compile('\.(?:\s+)')

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-04-08 23:35:01 +09:00
Stephen Finucane 2565195a44 doc: Add "domains" doc to usage guide
Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-03-27 15:37:28 +01:00
Stephen Finucane 893a7ac1f2 doc: Rework "showing code" section
This makes the section more consistent with the rest of the document.
This adds a new section to the basics guide for doctest blocks, which
are a docutils thing. It also update the default highlight language,
which is now 'default'.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-03-27 15:37:28 +01:00
Stephen Finucane ecd193cde8 doc: Extend "directives" doc, part 3
Finish building up this combined doc by adding the contents of the
former 'misc' document. There are no changes to the content.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-03-27 15:37:28 +01:00
Stephen Finucane e01e9e34bb doc: Extend "directives" doc, part 2
Continue building up this combined doc by adding the contents of the
former 'code' document. There are no changes to the content.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-03-27 15:37:28 +01:00
Stephen Finucane 0641209da9 doc: Extend "directives" doc, part 1
Continue building up this combined doc by adding the contents of the
former 'para' document. There are no changes to the content.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-03-27 15:37:28 +01:00
Stephen Finucane fdf91e502c doc: Add "directives" doc to restructuredtext section
There's simply no need to artificially divide up the documentation on
directives into multiple, hard-to-navigate documents. Gather all
documentation for directives into one easy-to-reference guide, starting
with the former 'toctree' document. There are no changes to the content.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-03-27 15:37:28 +01:00
Stephen Finucane 0167c009c2 doc: Rework "markup" documents
These are going to form the basis of a future 'directive' document, so
we do some cleanup before this happens. There are a number of cleanup
items.

- Some paragraphs are reworded or clarified
- Semantic markup is added where possible
- Everything is wrapped to ~80 characters

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-03-27 15:37:28 +01:00
Stephen Finucane 08ff8160b8 doc: Add "field-lists" doc to restructuredtext section
These are very poorly documented at present, especially given their
power and use in basically all non-Napoleon based Python documentation.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-03-27 15:37:25 +01:00
Stephen Finucane 3fcb1bd2dd doc: Add "roles" doc to restructuredtext section
This is essentially the 'markup/inline' with a few small fixes. There
are also some modifications to the basic rST guide to highlight what a
role is; we were doing this for directives but not roles.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-03-27 15:34:36 +01:00
Stephen Finucane 9c2ab8c3bb doc: Add "restructuredtext" section to usage guide
This is taken from the existing 'rest' documents. Little to no
modifications are necessary, thankfully.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-03-27 15:34:26 +01:00
Stephen Finucane cef28eedfe codecov: Disable status checks
We don't currently care if a commit changes our coverage metrics, so we
can disable the status checks that would enforce that.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: #4738
2018-03-20 15:33:35 +00:00
Stephen Finucane ff579b3c66 doc: Add "quickstart" doc to usage guide
This is simply the former 'tutorial' document renamed. A number of
references need to be updated, so this is done.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-02-26 11:36:46 +00:00
Stephen Finucane 4bc03706e8 doc: Rework "tutorial" document
We're going to use this document as the basis for a future usage
document, so we start by cleaning things up beforehand. A couple of
changes are necessary:

- The installation guide is referenced, rather than duplicating the
  steps

In addition, there is a number of cleanup items.

- Some paragraphs are reworded or clarified
- Semantic markup is added where possible
- Everything is wrapped to ~80 characters

A number of TODOs are inserted. These will be resolved separately.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-02-26 11:36:36 +00:00
Stephen Finucane c8d1db72a8 make: Group test commands together
We may want to eventually deprecate these in favour of 'tox', but this
cleans things up a little until then.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-02-12 11:52:53 +00:00
Stephen Finucane 690714f4c4 make: Remove deprecated targets
These have been deprecated for a while and can now be removed.

Some indentation is also fixed, while we're at it.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-02-12 11:52:53 +00:00
Stephen Finucane cb4b7177d8 doc: Create usage guide section
Start structuring our docs a little better starting with a usage guide.
There are a number of changes happening here. We're going to start with
the installation guide, which is simply moved to the appropriate
subdirectory.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-02-10 16:22:44 +00:00
Stephen Finucane 4fa7d6037c doc: Rework "install" document
This is a large rework of the installation guide. There are a couple of
changes necessary:

- 'Mac OSX' is replaced by 'macOS'
- PyPI installation steps are moved to their own section
- Instructions are no longer provided for installing Python on Windows:
instead, we refer to the other, better-maintained guides.

In addition, there are a number of cleanup items.

- Some paragraphs are reworded or clarified
- Semantic markup is added where possible
- Everything is wrapped to ~80 characters

A number of TODOs are inserted. These will be resolved separately.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-02-10 16:22:40 +00:00
Stephen Finucane d35cda9943 util: Mark deprecated functions with warning
This ensures the functions can actually be removed as expected.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-02-07 11:26:59 +00:00
Stephen Finucane 05f851fa19 trivial: Remove 'tests/etree13'
This vendored code had no callers in modern Sphinx and has not been
needed since Python 2.5, which included the ElementTree API [1], was
released. It can be removed in its entirety.

[1] https://docs.python.org/2/library/xml.etree.elementtree.html

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-02-06 20:15:25 +00:00
Stephen Finucane f3074d1747 setup: Configure flake8 extension as a local plugin
We don't want to install this as a system plugin. Now that flake8 3.5.0
is in the wild, we can use this.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: #4492
2018-01-26 09:41:50 +00:00
Stephen Finucane 1ec03ec1b0 doc: Add 'deprecated' directive to docstrings
This helps emphasize the deprecated nature of these directives.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-21 11:38:03 +00:00
Stephen Finucane 487480ca01 doc: Add 'is_parallel_allowed'
This is an important function and should be documented.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-21 11:37:59 +00:00
Stephen Finucane 6c23dac5a6 doc: Reorder 'sphinx.application' docs to match code
Use the same ordering to minimize cognitive load.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-21 11:19:52 +00:00
Stephen Finucane b7ff955472 doc: Move 'sphinx.application' API docs to code
This allows us to do something like 'help(sphinx.application)' in code.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-21 11:19:46 +00:00
Stephen Finucane eaaab75ec2 doc: Rework 'sphinx.application' API documentation
Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-21 10:49:38 +00:00
Stephen Finucane ecbe08d467 sphinx: Call 'sphinx.cmd.build.main' function
This was missed in commit '89f9c7cab'.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: #4470
2018-01-20 23:19:38 +00:00
Stephen Finucane 78a44b5825 doc: Resolve inconsistent 'sphinx-apidoc' docs
The signature for the 'sphinx-apidoc' call differs between the man page
and the output of 'sphinx-apidoc --help'. Resolve this by considering
the 'sphinx-apidoc --help' output the canonical reference.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: #4451
2018-01-20 23:02:18 +00:00
Stephen Finucane 30b7f3f4d6 setuptools: Don't create directories
Don't create the build or doctree directories. These are already handled
by 'sphinx.application.Application' and 'sphinx.builder.Builder',
respectively.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-20 13:05:06 +00:00
Stephen Finucane 3a85b3502f app: Centralize directory validation
This allows us to avoid duplication of code and ensure validation
happens regardless of who's initializing the class. We introduce a new
exception - ApplicationError - to indicate these kinds of issues. This
subclasses SphinxError, meaning we don't need to modify our exception
handling code.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-20 13:04:29 +00:00
Stephen Finucane b215f523f7 doc: Move sphinx.logging API docs to code
Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-20 13:00:43 +00:00
Stephen Finucane b7749c6ca3 doc: Move sphinx.config API docs to code
Once again, we make things a little smarter by using Python domain
roles.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-20 12:53:45 +00:00
Stephen Finucane 391cd8195b doc: Move sphinx.errors API docs to code
This allows us to do something like 'help(sphinx.errors)' in code. We
reword the exception descriptions per Python stdlib conventions.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-20 12:47:49 +00:00
Stephen Finucane 4420b43e5a tox: Ignore distutils deprecation warning
distutils/__init__.py:4: DeprecationWarning: the imp module is
    deprecated in favour of importlib; see the module's documentation
    for alternative uses
      import imp

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-15 09:09:53 +00:00
Stephen Finucane b16fd2ce01 make.bat: Make SOURCEDIR configurable
It's unlikely that anyone will need to do this but at least give them
the opportunity.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-11 20:57:03 +00:00
Stephen Finucane f6a045d171 Makefile: Make SOURCEDIR configurable
It's unlikely that anyone will need to do this but at least give them
the opportunity.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-11 20:57:03 +00:00
Stephen Finucane 6f9a262f45 make.bat: Remove unnecessary targets
As with the Makefile previously, these are not necessary now that we're
not printing anything different for various builders.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-11 20:57:03 +00:00
Stephen Finucane aa2c5c9065 Makefile: Remove unnecessary targets
Most of these are not necessary now that we're not printing different
messages for various builders.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-11 20:57:03 +00:00
Stephen Finucane 221dffda3c make_mode: Remove unnecessary 'make_*' functions
These are handled by the default case.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-11 20:57:03 +00:00
Stephen Finucane a83e8bab7d builders: Add 'Builder.epilog' option
This allows builders to emit a final epilog message containing
information such as where resulting files can be found. This is only
emitted if the build was successful.

This allows us to remove this content from the 'make_mode' tool and
the legacy 'Makefile' and 'make.bat' templates. There's room for more
dramatic simplification of the former, but this will come later.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-11 20:57:03 +00:00
Stephen Finucane 69f39e44d9 tox: Enable 'skipsdist'
Given that we install Sphinx as part of the dependencies, there's no
reason to do it twice. Skip that step.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-01 18:47:12 +09:00
Stephen Finucane 60e25090a3 tox: Enable 'skipsdist'
Given that we install Sphinx as part of the dependencies, there's no
reason to do it twice. Skip that step.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-29 13:02:33 +00:00
Stephen Finucane 9a3ebaaff5 Resolve warning filter issues
There's an issue with 'pkgutils' and namespace packages. This has been
reported against setuptools [1], but until this is resolved, we simply
need to live with it. Ensure said warnings are filtered from tox too and
remove some unnecessary ones.

[1] https://github.com/pypa/setuptools/issues/1111

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-29 13:02:32 +00:00
Stephen Finucane 7c0723fd46 tests: Remove 'tests/run.py'
This is no longer necessary. One test needs to be modified to deal with
how 'python -m pytest' modifies the PATH.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-29 13:02:31 +00:00
Stephen Finucane 529c96a3c9 tests: Use 'pytest_sessionstart'
This is the recommended way to do pre-session configuration in pytest if
not using session fixtures [1].

With this, we're able to remove the custom 'test/run.py' script in its
entirety and run 'pytest' like everyone else does. We'll do this
separately to keep things simple.

[1] https://stackoverflow.com/a/12600154/613428

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-29 13:02:26 +00:00
Stephen Finucane c33ecd1f8f tests: Use 'pytest_report_header'
This is the recommended way to print extra headers [1].

[1] https://docs.pytest.org/en/latest/example/simple.html#adding-info-to-test-report-header

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-29 13:02:07 +00:00
Stephen Finucane 9348c4bea1 tests: Stop explicitly checking for modules
This will have already been handled by setuptools. If the user isn't
using this then they've dug their own grave.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-29 13:02:04 +00:00
Stephen Finucane 4fd217ce88 circleci: Install packages ourselves
Start installing Python dependencies and Sphinx itself as part of the
CircleCI job rather than expecting it to be done in the Docker
container. This ensures we will use the version of the packages for a
given commit.

This is the other half of sphinx-doc/docker-ci#1.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-29 13:01:59 +00:00
Stephen Finucane 9f7f5f2a44 doc: Add missing sphinx-apidocs opt, envvar
Add docs for '--module-first' option and 'SPHINX_APIDOC_OPTIONS'
environment variable. Per the closest thing we have to official man page
guidelines [1]:

  ENVIRONMENT

  lists all environment variables that affect the program or function
  and how they affect it.

[1] https://linux.die.net/man/7/man-pages

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes #2250
2017-12-28 23:00:53 +00:00
Stephen Finucane 35ad6910a9 epub: Remove dead templates
These are no longer used since 'f2c93b31'.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-28 21:37:37 +00:00
Stephen Finucane f048d668e5 doc: Remove invalid note for epub3 builder
This doesn't appear to be true any more, based on the code.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-28 21:28:55 +00:00
Stephen Finucane f4f677c8f7 templates: Remove 'epub3' targets
This appears to have been missed in commit 69d1dfaa. One could add an
alias for this to restore behavior, but no one has reported the issue
since Sphinx meaning this seems unnecessary.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-28 21:18:23 +00:00
Stephen Finucane f068627176 gitignore: Ignore 'htmlcov' directory
This is generated if you run 'coverage html'. Hide it from Git.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-24 21:24:41 +00:00
Stephen Finucane 77ca894723 tox: Report coverage to user
Run 'coverage report' after a successful coverage run. There's enough
coverage-related stuff here at this point to warrant its own section.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-24 21:24:41 +00:00
Stephen Finucane a3f9935d95 travis: Enable codecov coverage
This necessitates adding some basic coverage-py configuration [1] and
making sure the pytest-cov plugin uses said configuration [2]. Badges
are included.

Note that we do not run the 'coverage' tox target, which is reserved for
users.

[1] https://github.com/codecov/example-python
[2] https://bitbucket.org/ned/coveragepy/issues/512/

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-24 21:24:41 +00:00
Stephen Finucane 411055905c tox: Add 'PERL5LIB' to 'passenv' list
This is required by 'makeinfo'.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes #4339
2017-12-24 14:47:31 +00:00
Stephen Finucane ac9ae4d54b README: Fix typo
Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: 393f59d ("Improve README")
2017-12-19 16:02:05 +00:00
Stephen Finucane a2a873d58a tox: Add documentation for all targets
This should make 'tox -av' more helpful.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-19 15:55:10 +00:00
Stephen Finucane 638e646766 doc: Rework CONTRIBUTING to encourage use of tox
Embrace the tox-ified future. This explicitly asks users to use a
virtualenv to stop them shooting themselves in the foot.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-19 15:22:14 +00:00
Stephen Finucane 76bd631872 travis: Start using tox for testing
This allows us to validate and reuse the testing tools we use locally
for "gate" tests and moves us closer to the eventual goal of deprecating
the Makefile targets. This involves adding two new targets to the list
of default targets run by tox - docs and mypy.

Note that we don't use tox-travis because, wonderful though it may be,
configuring it to exclude as many of the tests as we want to exclude is
a little convoluted (we have a big test matrix).

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-19 15:21:42 +00:00
Stephen Finucane a6f0ba0fc9 README: Cleanup badges
Add AppVeyor badge and include 'alt' attributes for the others.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-19 15:05:44 +00:00
Stephen Finucane 393f59da00 Improve README
We're going to be adding additional badges to this but, before we do
that, we should improve the README and remove a lot of the duplication
that has built up here.

The 'long_description' from 'setup.py' is moved into the README as there
is serious value in displaying this on GitHub, as much as there is value
in including the badges and other content from README.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-19 15:00:06 +00:00
Stephen Finucane f74b6756ac setup.cfg: Restructure file
Place configuration of the package itself first in the file, followed by
configuration of other tools.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-19 12:06:16 +00:00
Stephen Finucane fd1df0815b tox: Make further use of factor-conditional deps
This is how we reduce boilerplate [1]. Succinctness FTW.

[1] https://tox.readthedocs.io/en/latest/config.html#factors-and-factor-conditional-settings

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-18 20:10:18 +00:00
Stephen Finucane 5d812ccefc tox: Add 'coverage' target
Enabling coverage results in an increase in runtime, and while this may
be an acceptable compromise for some developers, it's not necessarily
something we need to run all the time. Move it to a separate target so
it can be run only by those who wish to use it.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-18 20:10:18 +00:00
Stephen Finucane c8d56236c9 tests: Ignore roots using 'collect_ignore'
This is slightly cleaner than how we're doing this at the moment.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-18 20:10:18 +00:00
Stephen Finucane e243e82723 tests: Ignore tests using 'collect_ignore'
Per the pytest docs [1], this is the preferred way to ignore tests. This
necessitates removing the 'test-async' target as it no longer makes any
sense.

[1] https://docs.pytest.org/en/latest/example/pythoncollection.html

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-18 20:10:18 +00:00
Stephen Finucane 41c19ddf91 tests: Skip tests with missing binaries
While there are already some skips included here, they clearly aren't
doing their job and the test fail locally. Resolve this.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-18 20:10:18 +00:00
Stephen Finucane a102e8e29b setup.py: Include 'flake8' in 'test' requirements
We are using this in our testing and actually need it for the flake8
plugin, so include this in the list of 'test' requirements.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-18 19:44:05 +00:00
Stephen Finucane a5ef67b96a setup: Install mock for Python 3 too
'mock' is part of the standard library in Python 3 since Python 3.3.
However, it's found in 'unittest.mock' - not 'mock'. We should install
the version for PyPi in all cases to minimize differences between the
two. When Python 2.7 support is dropped, we can consider switching to
the standard library version.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes #4284
2017-12-13 19:59:45 +00:00
Stephen Finucane 974b1be218 Fix #1421: Respect the quiet flag in sphinx-quickstart
Calling 'sphinx-quickstart --quiet' should not print anything to stdout.
Resolve this.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-13 19:39:29 +00:00
Stephen Finucane 77ff7d7e90 sphinx-build: Use 'ArgumentParser.error'
This simplifies a common pattern used here. This does result in a change
in the output code from 1 to 2 for some cases, but this shouldn't be an
issue as we already emit 2 for any parser issues.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-04 17:19:58 +00:00
Stephen Finucane d46273ca4a quickstart: Rework how we collect extensions
This is a little more flexible than the existing set up and makes
maximum use of argparse capabilities.

This has the side-effect of no longer including configuration for the
'sphinx.ext.todo' extension when said extension is not enabled.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-03 19:24:58 +00:00
Stephen Finucane 4c0f657ee6 quickstart: Rework 'do_prompt' function
The 'd' and 'key' values are used on a single line. Move these outside
the function to allow us to do other things with this function.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-03 19:24:58 +00:00
Stephen Finucane 88d7dc1bd3 quickstart: Simplify --(no-)option handling
The standard pattern for doing this is to use a common 'dest'.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-03 19:24:58 +00:00
Stephen Finucane 67753b7ce3 Remove 'test-reqs.txt'
We were never really using this file for its specified purpose [1]. Now
that we have everything cleanly organized in 'setup.py', there really
isn't any reason to keep it around. Remove it.

[1] https://caremad.io/posts/2013/07/setup-vs-requirement/

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-10 14:13:09 +01:00
Stephen Finucane eb8efce7d8 requirements: Reduce duplication
Simply installing packages will ensure that most of the dependencies in
'setup.py' are installed, meaning 'test-reqs.txt' need only contain
those necessary for testing.

The only notable change is that the 'simplejson' module is dropped from
the requirements list. This included as a dependency for the PyPy
target, but it appears that this is not necessary today (though it may
have been when the target was added in 2011).

This retains 'setup.py test' which, as noted in the tox docs [1], is
sometimes expected for downstream distribution testing. We may wish to
find a way to synchronize requirements between 'test-reqs.txt' and this
section in the future, but that's work for another day.

[1] https://tox.readthedocs.io/en/latest/example/basic.html#integration-with-setup-py-test-command

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-10 14:06:10 +01:00
Stephen Finucane dbd58d4c51 setup.py: Stop caring about pip 1.5.6
This version is silly old and anyone that's _still_ using this is not
going to be building Sphinx from source. Simply remove it.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-10 14:03:48 +01:00
Stephen Finucane aedeb2160a sphinx-build: Move parser to a separate function
This should be becoming passe at this point.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-09 16:28:39 +01:00
Stephen Finucane b778cfe299 sphinx-build: Convert to argparse
Once again, not much different to the previous conversions. We make best
use of the argparse module, allowing us to remove some funky
workarounds.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-09 16:28:39 +01:00
Stephen Finucane c68381bd65 sphinx-quickstart: Move parser to a separate function
For the same reasons as the 'sphinx-apidoc' and 'sphinx-autogen' moves.
As before, we also take the opportunity to add a help string.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-09 16:28:39 +01:00
Stephen Finucane bca566244a sphinx-quickstart: Convert to argparse
Nothing unusual to see here.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-09 16:28:39 +01:00
Stephen Finucane b506d87292 sphinx-autogen: Move main to end of file
Per Python customs.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-09 16:28:39 +01:00
Stephen Finucane 6a88b5a6c2 sphinx-autogen: Move parser to a separate function
For the same reasons as the 'sphinx-apidoc' move. We also take the
opportunity to add a help string and epilog while we're at it.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-09 16:28:39 +01:00
Stephen Finucane fcf0c1247f sphinx-autogen: Convert to argparse
Another mostly trivial conversion. The only odd thing here is that we
add a '--version' parameter to keep things in line with the other
applications.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-09 16:28:39 +01:00
Stephen Finucane a3f1489544 sphinx-apidoc: Remove 'normalize_excludes' function
This is a one-liner that really doesn't need to be split out, so don't
do it.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-09 16:28:39 +01:00
Stephen Finucane fa74085afd sphinx-apidoc: Move parser to a separate function
This lets us better reason about what the parser is doing and use tools
like 'sphinx-contrib.autoprogram' in our own documentation in the
future.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-09 16:28:39 +01:00
Stephen Finucane 87630c8ae8 sphinx-apidoc: Convert to argparse
This is pretty self-explanatory, with most changes coming about as a
side-effect of argparse vs. optparse API differences.

Lowercase characters are used in help strings, per argparse conventions.
Some tests are converted because argparse natively supports unicode.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-09 16:28:39 +01:00
Stephen Finucane bdaab9ef1b Remove static scripts
Executable scripts without the '.py' extension are already created and
installed by setuptools, by way of the 'console_scripts' section. These
scripts are unnecessary noise. If people want to test this behavior
locally, use a virtualenv.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-09 16:28:39 +01:00
Stephen Finucane 160e27e20f utils: Remove 'check_sources'
There are still a couple of checks here but all of them can be removed
now:

- Check if using valid Python syntax
- Check if line length too long
- Check if using 'x == None/True/False'
- Check if using old HTML 3 tags

The first three are already handled by default by the 'flake8' tool. The
last one isn't replaced by anything, but it really isn't worth worrying
about now because the tags it checks for have been dead for a really
long time and would not be used by anyone writing HTML in the last 10
years. Combined, it means we can remove the entire file.

The 'style-check' target is updated to simply alias 'flake8'. It can be
removed in a future release. This allows us to stop using this target in
the Travis jobs, seeing as we already run flake8.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-05 17:17:27 +01:00
Stephen Finucane f5c0d64658 utils: Move "header check" to a flake8 plugin
If we want to check style, we run 'tox -e flake8': it shouldn't be
necessary to run some obscure 'make' command too. Make this possible by
moving the sole useful test from the target of this make command to a
flake8 plugin.

This includes a fix for a header that was previously excluded from
checks, but is now included.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-10-05 17:17:27 +01:00