setup   A
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 20
dl 0
loc 82
rs 10
c 0
b 0
f 0
1
#!/usr/bin/env python
2
# Licensed under a 3-clause BSD style license - see LICENSE.rst
3
4
# NOTE: The configuration for the package, including the name, version, and
5
# other information are set in the setup.cfg file.
6
7
import os
8
import sys
9
from extension_helpers import get_extensions
10
from setuptools import setup
11
12
# First provide helpful messages if contributors try and run legacy commands
13
# for tests or docs.
14
15
TEST_HELP = """
16
Note: running tests is no longer done using 'python setup.py test'. Instead
17
you will need to run:
18
19
    tox -e test
20
21
If you don't already have tox installed, you can install it with:
22
23
    pip install tox
24
25
If you only want to run part of the test suite, you can also use pytest
26
directly with::
27
28
    pip install -e .[test]
29
    pytest
30
31
For more information, see:
32
33
  http://docs.astropy.org/en/latest/development/testguide.html#running-tests
34
"""
35
36
if "test" in sys.argv:
37
    print(TEST_HELP)
38
    sys.exit(1)
39
40
DOCS_HELP = """
41
Note: building the documentation is no longer done using
42
'python setup.py build_docs'. Instead you will need to run:
43
44
    tox -e build_docs
45
46
If you don't already have tox installed, you can install it with:
47
48
    pip install tox
49
50
You can also build the documentation with Sphinx directly using::
51
52
    pip install -e .[docs]
53
    cd docs
54
    make html
55
56
For more information, see:
57
58
  http://docs.astropy.org/en/latest/install.html#builddocs
59
"""
60
61
if "build_docs" in sys.argv or "build_sphinx" in sys.argv:
62
    print(DOCS_HELP)
63
    sys.exit(1)
64
65
VERSION_TEMPLATE = """
66
# Note that we need to fall back to the hard-coded version if either
67
# setuptools_scm can't be imported or setuptools_scm can't determine the
68
# version, so we catch the generic 'Exception'.
69
try:
70
    from setuptools_scm import get_version
71
    version = get_version(root='..', relative_to=__file__)
72
except Exception:
73
    version = '{version}'
74
""".lstrip()
75
76
setup(
77
    use_scm_version={
78
        "write_to": os.path.join("gammapy", "version.py"),
79
        "write_to_template": VERSION_TEMPLATE,
80
    },
81
    ext_modules=get_extensions(),
82
)
83