Skip to content

setup.py: generate man pages at install time

To run a command on install, we need to override the install class with our own. And we want to convert md to man through pandoc, so let's use pypandoc for that.

Unfortunately, pypandoc 1.4 (latest release) spews helpful install instructions for pandoc to stderr when it fails to call pandoc, not something we want. So let's redirect stderr for the first check if it works and bail out accordingly.

If we fail, we just drop the man pages, they're not that important. pandoc requires the haskell toolchain installed, there will be plenty of cases where just installing without man pages is preferable.

It's unclear if self.distribution in the install subclass is considered public API or will break at some point. The documentation is lacking.

Merge request reports