mirror of
https://github.com/vale981/releases
synced 2025-03-04 17:21:43 -05:00
Passthru kwargs from parse_changelog to make_app
This commit is contained in:
parent
8aa126d4f5
commit
c31cce8799
2 changed files with 16 additions and 8 deletions
|
@ -2,10 +2,11 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
* :feature:`75` When loading changelogs for programmatic use (via
|
||||
``releases.util.parse_changelog`` and friends), there's now an optional
|
||||
``load_extensions`` kwarg for parsing the real underlying ``conf.py`` and
|
||||
using it to initialize extensions.
|
||||
* :feature:`75` Update ``releases.util.parse_changelog`` so it hands kwargs
|
||||
into ``releases.util.make_app``, which in turn now accepts a
|
||||
``load_extensions`` argument triggering loading of one's configured
|
||||
extensions. This is only of interest if you're using ``parse_changelog``
|
||||
directly; it does not impact normal Releases usage.
|
||||
* :release:`1.5.0 <2018-05-02>`
|
||||
* :feature:`59` Allow multiple changelog files -- ``releases_document_name``
|
||||
may now optionally be a list of strings instead of a single string. Thanks to
|
||||
|
|
|
@ -29,7 +29,7 @@ except ImportError:
|
|||
from . import construct_releases, setup
|
||||
|
||||
|
||||
def parse_changelog(path):
|
||||
def parse_changelog(path, **kwargs):
|
||||
"""
|
||||
Load and parse changelog file from ``path``, returning data structures.
|
||||
|
||||
|
@ -44,6 +44,10 @@ def parse_changelog(path):
|
|||
print("Unreleased issues for 2.3.x: {}".format(changelog['2.3']))
|
||||
print("Contents of v1.2.1: {}".format(changelog['1.2.1']))
|
||||
|
||||
Aside from the documented arguments, any additional keyword arguments are
|
||||
passed unmodified into an internal `get_doctree` call (which then passes
|
||||
them to `make_app`).
|
||||
|
||||
:param str path: A relative or absolute file path string.
|
||||
|
||||
:returns:
|
||||
|
@ -60,7 +64,7 @@ def parse_changelog(path):
|
|||
``unreleased_1_feature``, whereas one with 1.x and 2.x releases will
|
||||
have ``unreleased_1_feature`` and ``unreleased_2_feature``, etc).
|
||||
"""
|
||||
app, doctree = get_doctree(path)
|
||||
app, doctree = get_doctree(path, **kwargs)
|
||||
# Have to semi-reproduce the 'find first bullet list' bit from main code,
|
||||
# which is unfortunately side-effect-heavy (thanks to Sphinx plugin
|
||||
# design).
|
||||
|
@ -94,7 +98,7 @@ def parse_changelog(path):
|
|||
return ret
|
||||
|
||||
|
||||
def get_doctree(path):
|
||||
def get_doctree(path, **kwargs):
|
||||
"""
|
||||
Obtain a Sphinx doctree from the RST file at ``path``.
|
||||
|
||||
|
@ -102,6 +106,9 @@ def get_doctree(path):
|
|||
Sphinx itself, but things there are pretty tightly coupled. So we wrote
|
||||
this.
|
||||
|
||||
Any additional kwargs are passed unmodified into an internal `make_app`
|
||||
call.
|
||||
|
||||
:param str path: A relative or absolute file path string.
|
||||
|
||||
:returns:
|
||||
|
@ -112,7 +119,7 @@ def get_doctree(path):
|
|||
docname, _ = os.path.splitext(filename)
|
||||
# TODO: this only works for top level changelog files (i.e. ones where
|
||||
# their dirname is the project/doc root)
|
||||
app = make_app(srcdir=root)
|
||||
app = make_app(srcdir=root, **kwargs)
|
||||
# Create & init a BuildEnvironment. Mm, tasty side effects.
|
||||
app._init_env(freshenv=True)
|
||||
env = app.env
|
||||
|
|
Loading…
Add table
Reference in a new issue