Skip to content
setup.py 2.23 KiB
Newer Older
#!/usr/bin/env python

# This file is part of CloudControl.
#
# CloudControl is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# CloudControl 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with CloudControl.  If not, see <http://www.gnu.org/licenses/>.


from setuptools import setup, find_packages
from distutils.command.build import build
Antoine Millet's avatar
Antoine Millet committed
import os
import sys

# Retrieval of version:
from cloudcontrol.server import __version__
Antoine Millet's avatar
Antoine Millet committed

ldesc = open(os.path.join(os.path.dirname(__file__), 'README')).read()

class BuildMan(build):

    '''
    Build command class used by distutil to generate manpages from RST sources
    while packaging.
    '''

    MANPAGES = ('cc-server', 'cc-addaccount')
    description = 'Build manual from RSt source'

    def run(self):
Antoine Millet's avatar
Antoine Millet committed
        from docutils.core import publish_file
        from docutils.writers import manpage
Antoine Millet's avatar
Antoine Millet committed

Antoine Millet's avatar
Antoine Millet committed
        srcdir = os.path.split(os.path.abspath(__file__))[0]

Antoine Millet's avatar
Antoine Millet committed
        for man in self.MANPAGES:
            publish_file(source_path=os.path.join(srcdir, 'doc/%s.rst' % man),
                         destination_path=os.path.join(srcdir, '%s.1' % man),
                         writer=manpage.Writer())

build.sub_commands.insert(0, ('build_man', None))

cmdclass = {'build_man': BuildMan}

Antoine Millet's avatar
Antoine Millet committed
setup(
    name='cc-server',
    version=__version__,
Antoine Millet's avatar
Antoine Millet committed
    description='CloudControl server',
    long_description=ldesc,
    author='Antoine Millet',
    author_email='antoine.millet@smartjog.com',
    license='LGPL3',
    packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
    scripts=['bin/cc-server', 'bin/cc-addaccount'],
    namespace_packages=['cloudcontrol'],
Antoine Millet's avatar
Antoine Millet committed
    data_files=(
        ('/etc/', ('etc/cc-server.conf',)),
    ),
    classifiers=[
        'Operating System :: Unix',
        'Programming Language :: Python',
    ],
Antoine Millet's avatar
Antoine Millet committed
)