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

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

import avocado.version

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

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 已提交
42 43 44 45 46 47 48 49 50
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


51 52 53 54 55 56
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 已提交
57
    data_files.append((get_docs_dir(), ['man/avocado.rst']))
58 59 60
    return data_files


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