[PATCH V2] setup: build docs from setup.py

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Sep 5 02:12:39 CDT 2014



On 09/04/2014 08:17 PM, Kevin Bullock wrote:
> # HG changeset patch
> # User Kevin Bullock <kbullock at ringworld.org>
> # Date 1404923562 18000
> #      Wed Jul 09 11:32:42 2014 -0500
> # Node ID f882f3877921866af3da9dcf4d8502379ef7b351
> # Parent  c5df4af17110838b713d6c9ec3b824fb0b6c1b33
> setup: build docs from setup.py
>
> This patch enables the use of bdist_mpkg to build a Mercurial package
> for Mac OS X that includes the documentation. I've been using a version
> of this locally for several years to build my own packages before the
> official Mac OS X versions appear, and these packages seem to be
> indistinguishable from the official ones.
>
> This version of the patch looks for docutils and only tries to build the
> documentation if it's installed, so that `make install-bin` continues to
> work in the absence of docutils.
>
> diff --git a/setup.py b/setup.py
> --- a/setup.py
> +++ b/setup.py
> @@ -168,6 +168,13 @@ def runhg(cmd, env):
>           return ''
>       return out
>
> +try:
> +    # Only include the docs if we can build them
> +    from docutils import __version__ as docutilsver
> +    builddocs = True
> +except ImportError:
> +    builddocs = False
> +
>   version = ''
>
>   # Execute hg out of this directory with a custom environment which
> @@ -232,8 +239,10 @@ class hgbuild(build):
>       # thinking that those modules are global and, consequently, making
>       # a mess, now that all module imports are global.
>
> -                    ('build_ext', build.has_ext_modules),
> -                   ] + build.sub_commands
> +                    ('build_ext', build.has_ext_modules)]
> +    if builddocs:
> +        sub_commands.append(('build_doc', None))

Should we issue a warning if the documentation is skipped?

(Error should never be passed silently)


-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list