| 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 |
|
| 10 |
from setuptools import setup |
| 11 |
|
| 12 |
from extension_helpers import get_extensions |
| 13 |
|
| 14 |
|
| 15 |
# First provide helpful messages if contributors try and run legacy commands |
| 16 |
# for tests or docs. |
| 17 |
|
| 18 |
TEST_HELP = """ |
| 19 |
Note: running tests is no longer done using 'python setup.py test'. Instead |
| 20 |
you will need to run: |
| 21 |
|
| 22 |
tox -e test |
| 23 |
|
| 24 |
If you don't already have tox installed, you can install it with: |
| 25 |
|
| 26 |
pip install tox |
| 27 |
|
| 28 |
If you only want to run part of the test suite, you can also use pytest |
| 29 |
directly with:: |
| 30 |
|
| 31 |
pip install -e .[test] |
| 32 |
pytest |
| 33 |
|
| 34 |
For more information, see: |
| 35 |
|
| 36 |
http://docs.astropy.org/en/latest/development/testguide.html#running-tests |
| 37 |
""" |
| 38 |
|
| 39 |
if 'test' in sys.argv: |
| 40 |
print(TEST_HELP) |
| 41 |
sys.exit(1) |
| 42 |
|
| 43 |
DOCS_HELP = """ |
| 44 |
Note: building the documentation is no longer done using |
| 45 |
'python setup.py build_docs'. Instead you will need to run: |
| 46 |
|
| 47 |
tox -e build_docs |
| 48 |
|
| 49 |
If you don't already have tox installed, you can install it with: |
| 50 |
|
| 51 |
pip install tox |
| 52 |
|
| 53 |
You can also build the documentation with Sphinx directly using:: |
| 54 |
|
| 55 |
pip install -e .[docs] |
| 56 |
cd docs |
| 57 |
make html |
| 58 |
|
| 59 |
For more information, see: |
| 60 |
|
| 61 |
http://docs.astropy.org/en/latest/install.html#builddocs |
| 62 |
""" |
| 63 |
|
| 64 |
if 'build_docs' in sys.argv or 'build_sphinx' in sys.argv: |
| 65 |
print(DOCS_HELP) |
| 66 |
sys.exit(1) |
| 67 |
|
| 68 |
VERSION_TEMPLATE = """ |
| 69 |
# Note that we need to fall back to the hard-coded version if either |
| 70 |
# setuptools_scm can't be imported or setuptools_scm can't determine the |
| 71 |
# version, so we catch the generic 'Exception'. |
| 72 |
try: |
| 73 |
from setuptools_scm import get_version |
| 74 |
version = get_version(root='..', relative_to=__file__) |
| 75 |
except Exception: |
| 76 |
version = '{version}' |
| 77 |
""".lstrip() |
| 78 |
|
| 79 |
setup(use_scm_version={'write_to': os.path.join('astropy_healpix', 'version.py'), |
| 80 |
'write_to_template': VERSION_TEMPLATE}, |
| 81 |
ext_modules=get_extensions()) |