diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-04-05 21:14:06 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-04-05 21:14:06 +0100 |
commit | 338e52e2ecc67db2f378f86b5d7791b80c28064e (patch) | |
tree | 116bcc238b8a81bb6ff2d0718b6be573374e67ee | |
parent | 92e01b3584c6783af7d4cbdfb6f37854ff13b372 (diff) | |
download | cachedir-338e52e2ecc67db2f378f86b5d7791b80c28064e.tar.gz |
Add manpage to .deb and check/clean commands to setup.py
-rwxr-xr-x | debian/rules | 2 | ||||
-rw-r--r-- | setup.py | 49 |
2 files changed, 50 insertions, 1 deletions
diff --git a/debian/rules b/debian/rules index 374df7b..87c455c 100755 --- a/debian/rules +++ b/debian/rules @@ -4,4 +4,4 @@ dh $@ --with=python2 --buildsystem=python_distutils override_auto_test: - cmdtest tests + python setup.py check @@ -16,7 +16,51 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. from distutils.core import setup +from distutils.cmd import Command +from distutils.command.build import build +from distutils.command.clean import clean import glob +import os +import shutil +import cliapp + + + +class GenerateManpage(build): + + def run(self): + build.run(self) + print 'building manpage' + with open('cachedir.1', 'w') as f: + cliapp.runcmd( + ['./cachedir', '--generate-manpage=cachedir.1.in'], + stdout=f) + + +class CleanMore(clean): + + def run(self): + clean.run(self) + dirty = ['cachedir.1'] + for x in dirty: + if os.path.exists(x): + os.remove(x) + if os.path.isdir('build'): + shutil.rmtree('build') + + +class Check(Command): + + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + cliapp.runcmd(['cmdtest', 'tests']) setup(name='cachedir', @@ -27,4 +71,9 @@ setup(name='cachedir', url='http://liw.fi/cachedir/', scripts=['cachedir'], data_files=[('share/man/man1', glob.glob('*.1'))], + cmdclass={ + 'build': GenerateManpage, + 'check': Check, + 'clean': CleanMore, + }, ) |