httpie-cli/Makefile

153 lines
3.7 KiB
Makefile
Raw Normal View History

###############################################################################
# See ./CONTRIBUTING.rst
###############################################################################
VERSION=$(shell grep __version__ httpie/__init__.py)
REQUIREMENTS="requirements-dev.txt"
TAG="\n\n\033[0;32m\#\#\# "
END=" \#\#\# \033[0m\n"
2016-01-02 18:28:46 +01:00
2019-09-10 13:10:29 +02:00
all: uninstall-httpie install test
2016-01-02 18:28:46 +01:00
2019-09-10 13:10:29 +02:00
install:
@echo $(TAG)Installing dev requirements$(END)
pip install --upgrade -r $(REQUIREMENTS)
2016-01-02 18:33:48 +01:00
@echo $(TAG)Installing HTTPie$(END)
pip install --upgrade --editable .
2016-01-02 18:33:48 +01:00
@echo
clean:
@echo $(TAG)Cleaning up$(END)
rm -rf .tox *.egg dist build .coverage .cache .pytest_cache httpie.egg-info
find . -name '__pycache__' -delete -print -o -name '*.pyc' -delete -print
@echo
###############################################################################
# Testing
###############################################################################
2016-01-02 18:33:48 +01:00
2019-09-10 13:10:29 +02:00
test:
@echo $(TAG)Running tests on the current Python interpreter with coverage $(END)
py.test --cov ./httpie --cov ./tests --doctest-modules --verbose ./httpie ./tests
@echo
2016-01-02 18:33:48 +01:00
# test-all is meant to test everything — even this Makefile
2019-09-10 13:10:29 +02:00
test-all: uninstall-all clean install test test-tox test-dist pycodestyle
@echo
2016-01-02 18:33:48 +01:00
test-dist: test-sdist test-bdist-wheel
@echo
2016-01-02 18:33:48 +01:00
2019-09-10 13:10:29 +02:00
test-tox: uninstall-httpie install
@echo $(TAG)Running tests on all Pythons via Tox$(END)
tox
@echo
test-sdist: clean uninstall-httpie
@echo $(TAG)Testing sdist build an installation$(END)
python setup.py sdist
pip install --force-reinstall --upgrade dist/*.gz
which http
@echo
2016-01-02 18:33:48 +01:00
test-bdist-wheel: clean uninstall-httpie
@echo $(TAG)Testing wheel build an installation$(END)
python setup.py bdist_wheel
pip install --force-reinstall --upgrade dist/*.whl
which http
@echo
2016-01-02 18:33:48 +01:00
pycodestyle:
which pycodestyle || pip install pycodestyle
pycodestyle
@echo
coveralls:
which coveralls || pip install python-coveralls
coveralls
@echo
###############################################################################
# Publishing to PyPi
###############################################################################
2016-01-02 18:33:48 +01:00
2016-08-13 22:51:42 +02:00
publish: test-all publish-no-test
2016-08-13 22:51:42 +02:00
publish-no-test:
@echo $(TAG)Testing wheel build an installation$(END)
@echo "$(VERSION)"
2016-08-13 22:51:42 +02:00
@echo "$(VERSION)" | grep -q "dev" && echo '!!!Not publishing dev version!!!' && exit 1 || echo ok
2019-08-26 12:42:34 +02:00
python setup.py sdist bdist_wheel
twine upload dist/*
@echo
2016-01-02 18:33:48 +01:00
###############################################################################
# Uninstalling
###############################################################################
2016-01-02 18:33:48 +01:00
uninstall-httpie:
@echo $(TAG)Uninstalling httpie$(END)
- pip uninstall --yes httpie &2>/dev/null
@echo "Verifying…"
cd .. && ! python -m httpie --version &2>/dev/null
@echo "Done"
@echo
uninstall-all: uninstall-httpie
@echo $(TAG)Uninstalling httpie requirements$(END)
- pip uninstall --yes pygments requests
@echo $(TAG)Uninstalling development requirements$(END)
- pip uninstall --yes -r $(REQUIREMENTS)
2016-08-13 22:51:42 +02:00
2018-11-14 13:06:10 +01:00
###############################################################################
# Docs
###############################################################################
pdf:
# NOTE: rst2pdf needs to be installed manually and against a Python 2
@echo "Converting README.rst to PDF…"
rst2pdf \
--strip-elements-with-class=no-pdf \
README.rst \
-o README.pdf
@echo "Done"
@echo
###############################################################################
2019-02-03 15:08:29 +01:00
# Homebrew
###############################################################################
2019-02-03 15:08:29 +01:00
brew-deps:
extras/brew-deps.py
2019-02-03 14:58:23 +01:00
brew-test:
- brew uninstall httpie
brew install --build-from-source ./extras/httpie.rb
brew test httpie
brew audit --strict httpie