setup.py 3.89 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# -*- coding: utf-8 -*-
# Copyright (C) Brian Moe, Branson Stephens (2015)
#
# This file is part of gracedb
#
# gracedb is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# It 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with gracedb.  If not, see <http://www.gnu.org/licenses/>.
18

19 20
import os
import re
21
import sys
22
from setuptools import setup, find_packages
23 24 25


def parse_version(path):
Tanner Prestegard's avatar
Tanner Prestegard committed
26
    """Extract the `__version__` string from the given file"""
27 28 29
    with open(path, 'r') as fp:
        version_file = fp.read()
    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
30
                              version_file, re.M)
31 32 33 34
    if version_match:
        return version_match.group(1)
    raise RuntimeError("Unable to find version string.")

35

36 37 38 39 40
# Get readme file for long_description
readme_file = os.path.join(os.path.dirname(__file__), 'README.md')
with open(readme_file, 'r') as f:
    long_description = f.read()

41
# Required packages for tests
42 43 44 45 46 47
tests_require = []
# Add pytest requirement - 5.0.0+ only supports Python 3.5+
pytest_requirement = 'pytest>=3.1.0'
if sys.version_info < (3, 5):
    pytest_requirement += ',<5.0.0'
tests_require.append(pytest_requirement)
48 49
tests_require.append('pytest-cov')

50
# Add mock for Python 2
51
if sys.version_info.major < 3:
52
    tests_require.append('mock>=2.0.0')
53

54 55 56
# Only install setup_requires for the specific command being used
SETUP_REQUIRES = []
if 'test' in sys.argv:
57
    SETUP_REQUIRES.append('pytest-runner>=2.12')
58

Tanner Prestegard's avatar
Tanner Prestegard committed
59 60 61 62 63 64
# Classifiers
CLASSIFIERS = [
    'Development Status :: 4 - Beta',
    'Intended Audience :: Developers',
    'Intended Audience :: End Users/Desktop',
    'Intended Audience :: Science/Research',
65 66
    ('License :: OSI Approved :: GNU General Public License v3 or later '
        '(GPLv3+)'),
Tanner Prestegard's avatar
Tanner Prestegard committed
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
    'Operating System :: POSIX',
    'Programming Language :: Python :: 2',
    'Programming Language :: Python :: 2.7',
    'Programming Language :: Python :: 3',
    'Programming Language :: Python :: 3.4',
    'Programming Language :: Python :: 3.5',
    'Programming Language :: Python :: 3.6',
    'Programming Language :: Python :: 3.7',
    'Topic :: Scientific/Engineering',
    'Topic :: Scientific/Engineering :: Astronomy',
    'Topic :: Scientific/Engineering :: Physics',
]


###############################################################################
# Call setup() ################################################################
###############################################################################
Tanner Prestegard's avatar
Tanner Prestegard committed
84 85 86
setup(
    name="ligo-gracedb",
    version=parse_version(os.path.join('ligo', 'gracedb', 'version.py')),
87
    author=("Tanner Prestegard, Alexander Pace, Branson Stephens, Brian Moe, "
88
            "Patrick Brady"),
89
    author_email="tanner.prestegard@ligo.org, alexander.pace@ligo.org",
90 91 92
    description="A Python package for accessing the GraceDB API.",
    long_description=long_description,
    long_description_content_type='text/markdown',
Tanner Prestegard's avatar
Tanner Prestegard committed
93
    url="https://git.ligo.org/lscsoft/gracedb-client",
94
    license='GPL-3.0-or-later',
Tanner Prestegard's avatar
Tanner Prestegard committed
95 96
    namespace_packages=['ligo'],
    packages=find_packages(),
Tanner Prestegard's avatar
Tanner Prestegard committed
97
    classifiers=CLASSIFIERS,
98
    install_requires=['future>=0.15.0', 'six>=1.9.0', 'cryptography>=1.7.2'],
99
    setup_requires=SETUP_REQUIRES,
Tanner Prestegard's avatar
Tanner Prestegard committed
100 101 102 103 104 105 106 107
    tests_require=tests_require,
    package_data={
        'ligo.gracedb.test': [
            'integration/data/*',
        ],
    },
    entry_points={
        'console_scripts': [
108 109
            'gracedb=ligo.gracedb.cli.client:main',
            'gracedb_legacy=ligo.gracedb.legacy_cli:main',
Tanner Prestegard's avatar
Tanner Prestegard committed
110 111
        ],
    },
112
)