Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install python package man pages with pip

I maintain a custom-compiled Python installation in /opt/python-2.7.6. I expect man pages to be installed in share/man. I have installed several libraries already using pip (numpy, scipy, matplotlib, sympy). I'm not sure if they should come with man pages.

Now, I installed pygments. It comes with a binary called pygmentize, which is correctly installed in bin.

Sidetracking: I looked up the files in the Debian package python-pygments and it comes with a man page:

$ apt-file list python-pygments
...
/usr/share/man/man1/pygmentize.1.gz
...

Back to main topic: I do not want to install python-pygments with apt-get because it will be associated with the system Python. I want to keep using pip to maintain my custom Python installation. It should be easy to add the share/man directory to the MANPATH environment variable using .bashrc

export MANPATH=/opt/python-2.7.6/share/man:$MANPATH

Question: How do I use pip to install man pages together with the Python library?

like image 979
Kit Avatar asked Nov 15 '13 14:11

Kit


People also ask

Can you install Python packages using pip?

The pip command has options for installing, upgrading and deleting packages, and can be run from the Windows command line. By default, pip installs packages located in the Python Package Index (PyPI), but can also install from other indexes.


1 Answers

The package does not have a man page, see here. It's the Debian policy that requires that each program adds a man page. Hence, the package installs one for you.

As a side note

If you maintain your own package, you can use the directive data_files in your setup.py:

setup(
   ...
   data_files = [('man/man1', [path/to/your/manpage.1/'])],
   )

If you would like to create a man page automatically for your program (if you are using argparse, take a look at my package man-utils.

like image 73
oz123 Avatar answered Oct 17 '22 05:10

oz123