File: setup.py

package info (click to toggle)
gammapy 1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 10,448 kB
  • sloc: python: 75,353; makefile: 228; sh: 11; javascript: 10
file content (88 lines) | stat: -rwxr-xr-x 2,154 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst

# NOTE: The configuration for the package, including the name, version, and
# other information are set in the setup.cfg file.
import sys

# First provide helpful messages if contributors try and run legacy commands
# for tests or docs.

TEST_HELP = """
Note: running tests is no longer done using 'python setup.py test'. Instead
you will need to run:

    tox -e test

If you don't already have tox installed, you can install it with:

    pip install tox

If you only want to run part of the test suite, you can also use pytest
directly with::

    pip install -e .[test]
    pytest

For more information, see:

  http://docs.astropy.org/en/latest/development/testguide.html#running-tests
"""

if "test" in sys.argv:
    print(TEST_HELP)
    sys.exit(1)

DOCS_HELP = """
Note: building the documentation is no longer done using
'python setup.py build_docs'. Instead you will need to run:

    tox -e build_docs

If you don't already have tox installed, you can install it with:

    pip install tox

You can also build the documentation with Sphinx directly using::

    pip install -e .[docs]
    cd docs
    make html

For more information, see:

  http://docs.astropy.org/en/latest/install.html#builddocs
"""

if "build_docs" in sys.argv or "build_sphinx" in sys.argv:
    print(DOCS_HELP)
    sys.exit(1)


# imports here so that people get the nice error messages above without needing
# build dependencies
import numpy as np  # noqa: E402
from Cython.Build import cythonize  # noqa: E402
from setuptools import Extension, setup  # noqa: E402

kwargs = dict(
    include_dirs=[np.get_include()],
    define_macros=[
        # fixes a warning when compiling
        ("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION"),
        # defines the oldest numpy we want to be compatible with
        ("NPY_TARGET_VERSION", "NPY_1_21_API_VERSION"),
    ],
)

extensions = [
    Extension(
        "gammapy.stats.fit_statistics_cython",
        sources=["gammapy/stats/fit_statistics_cython.pyx"],
        **kwargs,
    ),
]

setup(
    ext_modules=cythonize(extensions),
)