2018-07-12 21:16:16 +02:00
|
|
|
|
###############################################################################
|
2016-01-02 18:07:00 +01:00
|
|
|
|
# See ./CONTRIBUTING.rst
|
2018-07-12 21:16:16 +02:00
|
|
|
|
###############################################################################
|
2016-01-02 18:07:00 +01:00
|
|
|
|
|
2019-12-04 17:49:07 +01:00
|
|
|
|
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
2014-04-28 13:25:45 +02:00
|
|
|
|
VERSION=$(shell grep __version__ httpie/__init__.py)
|
2019-12-04 17:49:07 +01:00
|
|
|
|
REQUIREMENTS=requirements-dev.txt
|
|
|
|
|
H1="\n\n\033[0;32m\#\#\# "
|
|
|
|
|
H1END=" \#\#\# \033[0m\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Only used to create our venv.
|
|
|
|
|
SYSTEM_PYTHON=python3
|
|
|
|
|
|
|
|
|
|
VENV_ROOT=venv
|
|
|
|
|
VENV_BIN=$(VENV_ROOT)/bin
|
|
|
|
|
VENV_PIP=$(VENV_BIN)/pip3
|
|
|
|
|
VENV_PYTHON=$(VENV_BIN)/python3
|
2014-04-28 13:25:45 +02:00
|
|
|
|
|
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
|
|
|
|
|
2014-04-28 13:25:45 +02:00
|
|
|
|
|
2019-12-04 17:49:07 +01:00
|
|
|
|
install: venv
|
|
|
|
|
@echo $(H1)Installing dev requirements$(H1END)
|
|
|
|
|
$(VENV_PIP) install --upgrade -r $(REQUIREMENTS)
|
2016-01-02 18:33:48 +01:00
|
|
|
|
|
2019-12-04 17:49:07 +01:00
|
|
|
|
@echo $(H1)Installing HTTPie$(H1END)
|
|
|
|
|
$(VENV_PIP) install --upgrade --editable .
|
2016-01-02 18:33:48 +01:00
|
|
|
|
|
2014-04-28 13:25:45 +02:00
|
|
|
|
@echo
|
|
|
|
|
|
2018-07-12 21:16:16 +02:00
|
|
|
|
clean:
|
2019-12-04 17:49:07 +01:00
|
|
|
|
@echo $(H1)Cleaning up$(H1END)
|
|
|
|
|
rm -rf $(VENV_ROOT)
|
|
|
|
|
# Symlink for virtualenvwrapper, if we’ve created one.
|
|
|
|
|
[ -n "$(WORKON_HOME)" -a -L "$(WORKON_HOME)/httpie" -a -f "$(WORKON_HOME)/httpie" ] && rm $(WORKON_HOME)/httpie || true
|
2018-07-12 21:16:16 +02:00
|
|
|
|
rm -rf .tox *.egg dist build .coverage .cache .pytest_cache httpie.egg-info
|
2019-12-04 17:49:07 +01:00
|
|
|
|
find . -name '__pycache__' -delete -o -name '*.pyc' -delete
|
|
|
|
|
@echo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
venv:
|
|
|
|
|
@echo $(H1)Creating a Python environment $(VENV_ROOT) $(H1END)
|
|
|
|
|
|
|
|
|
|
$(SYSTEM_PYTHON) -m venv --prompt httpie $(VENV_ROOT)
|
|
|
|
|
|
|
|
|
|
@echo
|
|
|
|
|
@echo done.
|
2018-07-12 21:16:16 +02:00
|
|
|
|
@echo
|
2019-12-04 17:49:07 +01:00
|
|
|
|
@echo To active it manually, run:
|
|
|
|
|
@echo
|
|
|
|
|
@echo " source $(VENV_BIN)/activate"
|
|
|
|
|
@echo
|
|
|
|
|
@echo '(learn more: https://docs.python.org/3/library/venv.html)'
|
|
|
|
|
@echo
|
|
|
|
|
@if [ -n "$(WORKON_HOME)" ]; then \
|
|
|
|
|
echo $(ROOT_DIR) > $(VENV_ROOT)/.project; \
|
|
|
|
|
if [ ! -d $(WORKON_HOME)/httpie -a ! -L $(WORKON_HOME)/httpie ]; then \
|
|
|
|
|
ln -s $(ROOT_DIR)/$(VENV_ROOT) $(WORKON_HOME)/httpie ; \
|
|
|
|
|
echo ''; \
|
|
|
|
|
echo 'Since you use virtualenvwrapper, we created a symlink'; \
|
|
|
|
|
echo 'so you can also use "workon httpie" to activate the venv.'; \
|
|
|
|
|
echo ''; \
|
|
|
|
|
fi; \
|
|
|
|
|
fi
|
2018-07-12 21:16:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
# Testing
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
2016-01-02 18:33:48 +01:00
|
|
|
|
|
2019-09-10 13:10:29 +02:00
|
|
|
|
test:
|
2019-12-04 17:49:07 +01:00
|
|
|
|
@echo $(H1)Running tests on the current Python interpreter $(HEADER_EXTRA) $(H1END)
|
|
|
|
|
$(VENV_BIN)/py.test $(COV) ./httpie $(COV) ./tests --doctest-modules --verbose ./httpie ./tests
|
2014-04-28 13:25:45 +02:00
|
|
|
|
@echo
|
|
|
|
|
|
2016-01-02 18:33:48 +01:00
|
|
|
|
|
2019-12-04 17:49:07 +01:00
|
|
|
|
test-cover: COV=--cov
|
|
|
|
|
test-cover: HEADER_EXTRA='(with coverage)'
|
|
|
|
|
test-cover: test
|
|
|
|
|
|
|
|
|
|
|
2018-07-12 21:16:16 +02:00
|
|
|
|
# test-all is meant to test everything — even this Makefile
|
2019-12-04 17:49:07 +01:00
|
|
|
|
test-all: clean install test test-tox test-dist pycodestyle
|
2014-04-28 13:25:45 +02:00
|
|
|
|
@echo
|
|
|
|
|
|
2016-01-02 18:33:48 +01:00
|
|
|
|
|
2014-04-28 13:25:45 +02: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
|
2019-12-04 17:49:07 +01:00
|
|
|
|
@echo $(H1)Running tests on all Pythons via Tox$(H1END)
|
2019-12-04 18:09:51 +01:00
|
|
|
|
$(VENV_BIN)/tox
|
2018-07-12 21:16:16 +02:00
|
|
|
|
@echo
|
|
|
|
|
|
|
|
|
|
|
2014-04-28 13:25:45 +02:00
|
|
|
|
test-sdist: clean uninstall-httpie
|
2019-12-04 17:49:07 +01:00
|
|
|
|
@echo $(H1)Testing sdist build an installation$(H1END)
|
|
|
|
|
$(VENV_PYTHON) setup.py sdist
|
|
|
|
|
$(VENV_PIP) install --force-reinstall --upgrade dist/*.gz
|
|
|
|
|
$(VENV_BIN)/http --version
|
2014-04-28 13:25:45 +02:00
|
|
|
|
@echo
|
|
|
|
|
|
2016-01-02 18:33:48 +01:00
|
|
|
|
|
2014-04-28 13:25:45 +02:00
|
|
|
|
test-bdist-wheel: clean uninstall-httpie
|
2019-12-04 17:49:07 +01:00
|
|
|
|
@echo $(H1)Testing wheel build an installation$(H1END)
|
|
|
|
|
$(VENV_PYTHON) setup.py bdist_wheel
|
|
|
|
|
$(VENV_PIP) install --force-reinstall --upgrade dist/*.whl
|
|
|
|
|
$(VENV_BIN)/http --version
|
2014-04-28 13:25:45 +02:00
|
|
|
|
@echo
|
|
|
|
|
|
2016-01-02 18:33:48 +01:00
|
|
|
|
|
2018-07-12 21:16:16 +02:00
|
|
|
|
pycodestyle:
|
2019-12-04 17:49:07 +01:00
|
|
|
|
@echo $(H1)Running pycodestyle$(H1END)
|
|
|
|
|
@[ -f $(VENV_BIN)/pycodestyle ] || $(VENV_PIP) install pycodestyle
|
|
|
|
|
$(VENV_BIN)/pycodestyle httpie/ tests/ extras/ *.py
|
2018-07-12 21:16:16 +02:00
|
|
|
|
@echo
|
|
|
|
|
|
|
|
|
|
|
2019-12-04 17:49:07 +01:00
|
|
|
|
codecov-upload:
|
|
|
|
|
@echo $(H1)Running codecov$(H1END)
|
|
|
|
|
@[ -f $(VENV_BIN)/codecov ] || $(VENV_PIP) install codecov
|
|
|
|
|
$(VENV_BIN)/codecov --required
|
2018-07-12 21:16:16 +02:00
|
|
|
|
@echo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
# Publishing to PyPi
|
|
|
|
|
###############################################################################
|
2014-04-28 13:25:45 +02:00
|
|
|
|
|
2016-01-02 18:33:48 +01:00
|
|
|
|
|
2016-08-13 22:51:42 +02:00
|
|
|
|
publish: test-all publish-no-test
|
|
|
|
|
|
2018-07-12 21:16:16 +02:00
|
|
|
|
|
2016-08-13 22:51:42 +02:00
|
|
|
|
publish-no-test:
|
2019-12-04 17:49:07 +01:00
|
|
|
|
@echo $(H1)Testing wheel build an installation$(H1END)
|
2014-04-28 13:25:45 +02:00
|
|
|
|
@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-12-04 18:09:51 +01:00
|
|
|
|
$(VENV_PYTHON) setup.py sdist bdist_wheel
|
|
|
|
|
$(VENV_BIN)/twine upload dist/*
|
2014-04-28 13:25:45 +02:00
|
|
|
|
@echo
|
|
|
|
|
|
2016-01-02 18:33:48 +01:00
|
|
|
|
|
|
|
|
|
|
2018-07-12 21:16:16 +02:00
|
|
|
|
###############################################################################
|
|
|
|
|
# Uninstalling
|
|
|
|
|
###############################################################################
|
2016-01-02 18:33:48 +01:00
|
|
|
|
|
|
|
|
|
uninstall-httpie:
|
2019-12-04 17:49:07 +01:00
|
|
|
|
@echo $(H1)Uninstalling httpie$(H1END)
|
|
|
|
|
- $(VENV_PIP) uninstall --yes httpie &2>/dev/null
|
2016-01-02 18:33:48 +01:00
|
|
|
|
|
|
|
|
|
@echo "Verifying…"
|
2019-12-04 18:09:51 +01:00
|
|
|
|
cd .. && ! $(VENV_PYTHON) -m httpie --version &2>/dev/null
|
2016-01-02 18:33:48 +01:00
|
|
|
|
|
|
|
|
|
@echo "Done"
|
|
|
|
|
@echo
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
2018-07-12 21:16:16 +02:00
|
|
|
|
###############################################################################
|
2019-02-03 15:08:29 +01:00
|
|
|
|
# Homebrew
|
2018-07-12 21:16:16 +02:00
|
|
|
|
###############################################################################
|
|
|
|
|
|
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
|