views:

52

answers:

1

Hello,

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 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?

+1  A: 

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
ohe
Yeah, I guess it would be nice thing to add.
Roman Bogorodskiy