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