How to install/uninstall manpages with distutils/setuptools?

Discussion in 'Python' started by Santosh Kumar, Apr 13, 2013.

  1. 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__ = ''

    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/
     
    Santosh Kumar, Apr 13, 2013
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hartmut Goebel

    Install man-pages with distutils/setuptools

    Hartmut Goebel, May 17, 2008, in forum: Python
    Replies:
    1
    Views:
    721
    Sebastian 'lunar' Wiesner
    May 17, 2008
  2. Roger Erens

    How to uninstall setuptools

    Roger Erens, Nov 3, 2008, in forum: Python
    Replies:
    1
    Views:
    628
    Diez B. Roggisch
    Nov 3, 2008
  3. Replies:
    12
    Views:
    2,336
    excord80
    Dec 15, 2008
  4. Rahul
    Replies:
    0
    Views:
    594
    Rahul
    Apr 24, 2008
  5. Am Nym
    Replies:
    4
    Views:
    725
    Am Nym
    May 21, 2012
Loading...

Share This Page