#!/usr/bin/env python
# $Id: setup.py.in 600 2014-05-22 16:22:47Z toni $
# This script isn't used directly to generate the distributed files
# since some files are generated from the source and the zip and tar.gz
# differ.
# GNU Make is used instead.

from distutils.core import setup
import distutils.command.install_scripts
import shutil

class my_install(distutils.command.install_scripts.install_scripts):
    ''' Rename scripts that use the .py extension after installation.
    NOTE: breaks bdist_rpm
    Reference: http://stackoverflow.com/questions/4359231/rename-script-file-in-distutils
    '''
    def run(self):
        distutils.command.install_scripts.install_scripts.run(self)
        for script in self.get_outputs():
            if script.endswith(".py"):
                shutil.move(script, script[:-3])

setup(name='relevation',
      version='@VERSION@',
      author='Toni Corvera',
      author_email='outlyer@gmail.com',
      url='http://p.outlyer.net/relevation',
      description='Command-line interface to query Revelation files',
      long_description=
      '''This is a command-line tool capable of retrieving passwords from a Revelation password file.

Please note files can only be searched, not edited with this tool.''',
      license='BSD',
      package_dir={'': 'src'},
      packages=['relevation'],
      scripts=['src/relevation.py'],
      cmdclass = {"install_scripts": my_install}, # hook
      data_files=[
                  ('share/man/man1/', ['relevation.1']),
                  #('share/doc/relevation', ['CHANGELOG']),
                  ('share/doc/relevation/extra', ['src/gui.py','devtools/checkpw.py','devtools/genpw.py']),
                 ]
      )

# vim:set ts=4 et ai: #
