setup.py 2.3 KB
Newer Older
1 2
# 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
3 4
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
5 6 7 8 9 10 11
#
# 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 LICENSE for more details.
#
12
# Copyright: Red Hat Inc. 2013-2014
13 14
# Author: Lucas Meneghel Rodrigues <lmr@redhat.com>

15
import glob
16
import os
17
# pylint: disable=E0611
18 19 20 21
from distutils.core import setup

import avocado.version

22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

def get_settings_dir():
    settings_system_wide = os.path.join('/etc', 'avocado')
    settings_local_install = os.path.join('etc', 'avocado')
    if 'VIRTUAL_ENV' in os.environ:
        return settings_local_install
    else:
        return settings_system_wide


def get_tests_dir():
    settings_system_wide = os.path.join('/usr', 'share', 'avocado', 'tests')
    settings_local_install = os.path.join('tests')
    if 'VIRTUAL_ENV' in os.environ:
        return settings_local_install
    else:
        return settings_system_wide


C
Cleber Rosa 已提交
41 42 43 44 45 46 47 48 49
def get_docs_dir():
    settings_system_wide = os.path.join('/usr', 'share', 'doc', 'avocado')
    settings_local_install = ''
    if 'VIRTUAL_ENV' in os.environ:
        return settings_local_install
    else:
        return settings_system_wide


50 51 52 53 54 55
def get_data_files():
    data_files = [(get_settings_dir(), ['etc/settings.ini'])]
    data_files += [(get_tests_dir(), glob.glob('tests/*.py'))]
    for data_dir in glob.glob('tests/*.data'):
        fmt_str = '%s/*' % data_dir
        data_files += [(os.path.join(get_tests_dir(), os.path.basename(data_dir)), [glob.glob(fmt_str)[0]])]
C
Cleber Rosa 已提交
56
    data_files.append((get_docs_dir(), ['man/avocado.rst']))
57 58 59
    return data_files


60 61 62 63 64
setup(name='avocado',
      version=avocado.version.VERSION,
      description='Avocado Test Framework',
      author='Lucas Meneghel Rodrigues',
      author_email='lmr@redhat.com',
C
Cleber Rosa 已提交
65
      url='http://github.com/avocado-framework/avocado',
66 67
      packages=['avocado',
                'avocado.cli',
68 69
                'avocado.core',
                'avocado.linux',
R
Rudá Moura 已提交
70 71
                'avocado.utils',
                'avocado.plugins'],
72
      data_files=get_data_files(),
73
      scripts=['scripts/avocado'])