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

Matt Mackall mpm at selenic.com
Thu Jul 10 03:51:54 CDT 2014


On Wed, 2014-07-09 at 11:37 -0500, 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 97d98ce9e84fdb788a21f38eb80abe51af52a858
> # Parent  5b8d2ba8dbdf8ef2aac257d28002ad1bcc4920f9
> setup: build docs from setup.py

What happens if the doc-building tools aren't installed?

> 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 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.
> 
> diff --git a/setup.py b/setup.py
> --- a/setup.py
> +++ b/setup.py
> @@ -229,6 +229,7 @@ class hgbuild(build):
>      # a mess, now that all module imports are global.
>  
>                      ('build_ext', build.has_ext_modules),
> +                    ('build_doc', None),
>                     ] + build.sub_commands
>  
>  class hgbuildmo(build):
> @@ -318,6 +319,18 @@ class hgbuildpy(build_py):
>              else:
>                  yield module
>  
> +class hgbuilddoc(Command):
> +    description = 'Build documentation in doc/ (manpages)'
> +
> +    def initialize_options(self):
> +        pass
> +
> +    def finalize_options(self):
> +        pass
> +
> +    def run(self):
> +        self.spawn(['make', 'doc'])
> +
>  class buildhgextindex(Command):
>      description = 'generate prebuilt index of hgext (for frozen package)'
>      user_options = []
> @@ -421,6 +434,7 @@ cmdclass = {'build': hgbuild,
>              'build_mo': hgbuildmo,
>              'build_ext': hgbuildext,
>              'build_py': hgbuildpy,
> +            'build_doc': hgbuilddoc,
>              'build_hgextindex': buildhgextindex,
>              'install_scripts': hginstallscripts,
>              'build_hgexe': buildhgexe,
> @@ -490,7 +504,8 @@ for root in ('templates',):
>              f = os.path.join(curdir, f)
>              packagedata['mercurial'].append(f)
>  
> -datafiles = []
> +datafiles = [('man/man1', ['doc/hg.1']),
> +             ('man/man5', ['doc/hgignore.5', 'doc/hgrc.5'])]
>  setupversion = version
>  extra = {}
>  
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list