Skip to content

Commit

Permalink
simplify setup.py warning messages
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed Sep 7, 2022
1 parent b72b7ed commit 64984a8
Showing 1 changed file with 6 additions and 67 deletions.
73 changes: 6 additions & 67 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,79 +7,18 @@
import sys
from setuptools import setup

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

API_HELP = """
Note: Generating api.rst files is no longer done using 'python setup.py api'. Instead
you will need to run:
desi_api_file
which is part of the desiutil package. If you don't already have desiutil installed, you can install it with:
pip install desiutil
"""

MODULE_HELP = """
Note: Generating Module files is no longer done using 'python setup.py api'. Instead
you will need to run:
desiInstall
or
desi_module_file
depending on your exact situation. desiInstall is preferred. Both commands are
part of the desiutil package. If you don't already have desiutil installed, you can install it with:
pip install desiutil
"""

VERSION_HELP = """
Note: Generating version strings is no longer done using 'python setup.py version'. Instead
you will need to run:
desi_set_version
which is part of the desiutil package. If you don't already have desiutil installed, you can install it with:
pip install desiutil
"""

TEST_HELP = """
Note: running tests is no longer done using 'python setup.py test'. Instead
you will need to run:
pytest
If you don't already have pytest installed, you can install it with:
pip install pytest
"""

DOCS_HELP = """
Note: building the documentation is no longer done using
'python setup.py {0}'. Instead you will need to run:
sphinx-build -W --keep-going -b html doc doc/_build/html
If you don't already have Sphinx installed, you can install it with:
pip install Sphinx
HELP = """This command is no longer supported.
See https://desiutil.readthedocs.io/en/module-script/helpers.html#replacing-setup-py
for replacements.
"""

message = {'api': API_HELP,
'module_file': MODULE_HELP,
'test': TEST_HELP,
'version': VERSION_HELP,
'build_docs': DOCS_HELP.format('build_docs'),
'build_sphinx': DOCS_HELP.format('build_sphinx'), }
message = ('api', 'build_docs', 'build_sphinx', 'module_file', 'test', 'version')

for m in message:
if m in sys.argv:
print(message[m])
print(HELP)
sys.exit(1)

setup()

0 comments on commit 64984a8

Please sign in to comment.