diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-08-22 16:01:19 +0100 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-08-22 16:01:19 +0100 |
commit | 655163f94898c87b40dca91f788d7af1990a71f2 (patch) | |
tree | 40587f4d2fa6d6b87e3a212fc05c1ebce43802c2 /setup.py | |
parent | ea8834bd745f40bf766d23c27b93f96c12c71d9a (diff) | |
download | lorry-655163f94898c87b40dca91f788d7af1990a71f2.tar.gz |
Add a preliminary setup.py
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..cc5bde5 --- /dev/null +++ b/setup.py @@ -0,0 +1,95 @@ +# Copyright (C) 2011, 2012 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +'''Setup.py for lorry.''' + + +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 subprocess + +import morphlib + + +class GenerateManpage(build): + + def run(self): + build.run(self) + print 'building manpages' + for x in ['lorry']: + with open('%s.1' % x, 'w') as f: + subprocess.check_call(['python', x, + '--generate-manpage=%s.1.in' % x, + '--output=%s.1' % x], stdout=f) + + +class Clean(clean): + + clean_files = [ + '.coverage', + 'build', + ] + clean_globs = [ + '*/*.py[co]', + ] + + def run(self): + clean.run(self) + itemses = ([self.clean_files] + + [glob.glob(x) for x in self.clean_globs]) + for items in itemses: + for filename in items: + if os.path.isdir(filename): + shutil.rmtree(filename) + elif os.path.exists(filename): + os.remove(filename) + + +class Check(Command): + + user_options = [ + ] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + subprocess.check_call(['./check']) + + +setup(name='lorry', + description='FIXME', + long_description='''\ +FIXME +''', + author='Baserock', + author_email='baserock-dev@baserock.org', + url='http://wiki.baserock.org/', + scripts=['lorry'], + data_files=[('share/man/man1', glob.glob('*.[1-8]'))], + cmdclass={ + 'build': GenerateManpage, + 'check': Check, + 'clean': Clean, + }) |