summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2013-04-05 21:14:06 +0100
committerLars Wirzenius <liw@liw.fi>2013-04-05 21:14:06 +0100
commit338e52e2ecc67db2f378f86b5d7791b80c28064e (patch)
tree116bcc238b8a81bb6ff2d0718b6be573374e67ee /setup.py
parent92e01b3584c6783af7d4cbdfb6f37854ff13b372 (diff)
downloadcachedir-338e52e2ecc67db2f378f86b5d7791b80c28064e.tar.gz
Add manpage to .deb and check/clean commands to setup.py
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index 79333f5..74d5556 100644
--- a/setup.py
+++ b/setup.py
@@ -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,
+ },
)