I have a Python project which is basically a set of command line scripts and a helper package. As these scripts have a number of command line options I decided to create a manual page for each script and used ronn (http://rtomayko.github.com/ronn/) to write manuals in Markdown and generate mdoc from it.
The question is: how to generate and install man pages in distutils based project?
I came up with the following solution: create an simple install.sh script which generates and installs manual pages. I call this script from the overloaded 'install' command and pass specified prefix to it... you can check actual code here: http://github.com/novel/lc-tools.
I don't quite like this solution as for the simple task I have to add some hacks to setup.py and implement a shell script as well. Moreover, I use ${PREFIX}/share/man for man page path and it's not correct for all systems, e.g. FreeBSD seem to install 3rd party man pages to /usr/local/man (i.e. no share/).
Are there more elegant ways to do this?
distutils does not support man pages. People have written extensions to support them, generally in the form of a custom distutils command. See for example python-distutils-extra from Ubuntu.
distutils2 will support installing man pages.
Your little hack in your setup.py does the trick.... In complement, you can add a special man_prefix options that can be passed at setup time to change the man path.
You can do this like this :
class lc_install(install):
description = "Custom Install Process"
user_options= install.user_options[:]
user_options.extend([('manprefix=', None, 'MAN Prefix Path')])
def initialize_options(self):
self.manprefix = None
install.initialize_options(self)
def finalize_options(self):
if self.manprefix is None :
self.manprefix = "DEFAULT MAN PREFIX PATH IF THE OPTION IS NOT SET"
install.finalize_options(self)
def run(self):
.... # Your run method
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With