#! /usr/bin/python
## vim: fileencoding=utf-8

from glob import glob
from distutils import archive_util
from distutils.core import setup
from distutils.command.sdist import sdist

from lib.const import Const


class debian_sdist(sdist):
    def initialize_options(self):
        sdist.initialize_options(self)
        self.dist_dir = '..'
        self.template = 'debian/MANIFEST.in'

    def make_archive (self, base_name, format, **kwargs):
        base_name = base_name.replace('-', '_', 1) + '.orig'
        return sdist.make_archive(self, base_name, format, **kwargs)


setup(name='debcache',
        version=Const.VERSION,
        author='Adeodato Simó',
        author_email='dato@net.com.org.es',
        url='http://people.debian.org/~adeodato/code/debian/debcache',
        description='Python package to maintain and serve a cache of Debian packages',

        package_dir={ 'debcache': 'lib' }, packages=[ 'debcache' ],
        scripts=[ 'bin/debcache' ],
        data_files=[ ('/etc/debcache', glob('conf/*.conf')), ],

        cmdclass={'sdist': debian_sdist}
    )
