How to install/uninstall manpages with distutils/setuptools?

S

Santosh Kumar

Hey,

I have an app hosted on PyPi, it actually is a small script which is
in bin/ directory of the project. Here is the part of setup.py file of
my app:

#!/usr/bin/env python
#-*- coding: utf-8 -*-

import sys, os, shutil
try:
from setuptools import setup
except ImportError:
from distutils.core import setup

__AUTHOR__ = 'Santosh Kumar'
__AUTHOR_EMAIL__ = '(e-mail address removed)'

setup(
name='sampleapp',
version='1.02.02',
author=__AUTHOR__,
author_email=__AUTHOR_EMAIL__,
packages=['sampler'],
scripts=['bin/sampler'],
url='https://github.com/sampleapp/sampleapp',
zip_safe=False,
include_package_data=True,
license=open('LICENSE').read(),
description='A sample application',
long_description=open('README.rst').read()
)

if 'install' in sys.argv:
man_path = '/usr/share/man/man1/'
if os.path.exists(man_path):
print("Installing man pages")
man_page = "doc/sampleapp.1.gz"
shutil.copy2(man_page, man_path)
os.chmod(man_path + 'sampleapp.1.gz', int('444', 8))

When uploaded on PyPi, this app can be installed either by downloading
the archive form https://pypi.python.org/pypi/ and doing python
setup.py install or by easy_install or pip. pip is my favorite because
it supports uninstall option.

I can install this app (script) with pip with no problem (to
/usr/bin/). But I can't install the manpage to /usr/share/man/man1/.
That is why I created installation of manpages in my setup.py.

So with the installation of manpages my installation is complete. But
the problem is I can't uninstall the manpages with `pip uninstall
sampleapp`, that will only uninstall the script. So my final question
is there any patch to make distutils install and uninstall man pages?

Please don't tell me about any other packages, I want to stick with
Python's own http://guide.python-distribute.org/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top