Select Git revision
Rajmund Hruška authored
Makefile 3.66 KiB
DIR_LIB = pydgets
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = Pydgets-Python3ConsoleWidgetLibrary
SPHINXSOURCEDIR = .
SPHINXBUILDDIR = doc/_build
PYTHON = python
PIP = pip
NOSETESTS = nosetests
TWINE = twine
#
# Color code definitions for colored terminal output
# https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
#
RED = \033[0;31m
GREEN = \033[0;32m
ORANGE = \033[0;33m
BLUE = \033[0;34m
PURPLE = \033[0;35m
CYAN = \033[0;36m
NC = \033[0m
#-------------------------------------------------------------------------------
#
# Default make target, alias for 'help', you must explicitly choose the target.
#
default: docs-help
#
# Perform all reasonable tasks to do full build.
#
full: docs archive bdist deploy
#
# Perform local build.
#
build: archive bdist
#
# Perfom build from automated system.
#
buildbot: bdist
#
# Check the project code.
#
check: test
#-------------------------------------------------------------------------------
docs: docs-html
docs-help: FORCE
@$(SPHINXBUILD) -M help "$(SPHINXSOURCEDIR)" "$(SPHINXBUILDDIR)" $(SPHINXOPTS) $(O)
docs-html: FORCE
@echo "\n${GREEN}*** Generating project documentation ***${NC}\n"
@$(SPHINXBUILD) -M html "$(SPHINXSOURCEDIR)" "$(SPHINXBUILDDIR)" $(SPHINXOPTS) $(O)
#-------------------------------------------------------------------------------
show-version: FORCE
@PYTHONPATH=. $(PYTHON) -c "import pydgets; print(pydgets.__version__);"
#-------------------------------------------------------------------------------
deps: deps-python deps-python-dev
deps-python: FORCE
@echo "\n${GREEN}*** Installing Python dependencies ***${NC}\n"
-@$(PIP) install -r requirements.pip --upgrade
deps-python-dev: FORCE
@echo "\n${GREEN}*** Installing Python dependencies ***${NC}\n"
@$(PIP) install -r requirements-dev.pip --upgrade
#-------------------------------------------------------------------------------
pyflakes: pyflakes-lib pyflakes-test
pyflakes-lib: FORCE
@echo "\n${GREEN}*** Checking code with pyflakes ***${NC}\n"
@$(PYTHON) --version
@echo ""
-@$(PYTHON) -m pyflakes $(DIR_LIB)/*.py
pyflakes-test: FORCE
@echo "\n${GREEN}*** Checking test files with pyflakes ***${NC}\n"
@$(PYTHON) --version
@echo ""
-@$(PYTHON) -m pyflakes $(DIR_LIB)/tests/*.py
pylint: pylint-lib pylint-test
pylint-lib: FORCE
@echo "\n${GREEN}*** Checking code with pylint ***${NC}\n"
@$(PYTHON) --version
@echo ""
-@$(PYTHON) -m pylint $(DIR_LIB)/*.py --rcfile .pylintrc-lib
pylint-test: FORCE
@echo "\n${GREEN}*** Checking test files with pylint ***${NC}\n"
@$(PYTHON) --version
@echo ""
-@$(PYTHON) -m pylint $(DIR_LIB)/tests/*.py --rcfile .pylintrc-test
test: FORCE
@echo "\n${GREEN}*** Checking code with nosetests ***${NC}\n"
@$(PYTHON) -W always::DeprecationWarning -m nose2 --junit-xml
#-------------------------------------------------------------------------------
archive: FORCE
@if ! [ `ls dist/pydgets* | wc -l` = "0" ]; then\
echo "\n${GREEN}*** Moving old distribution files to archive ***${NC}\n";\
mv -f dist/pydgets* archive;\
fi
bdist: FORCE
@echo "\n${GREEN}*** Building Python packages ***${NC}\n"
@$(PYTHON) --version
@echo ""
@$(PYTHON) setup.py sdist bdist_wheel
install: FORCE
@echo "\n${GREEN}*** Performing local installation ***${NC}\n"
@$(PIP) install dist/pydgets*.whl --upgrade
deploy: FORCE
@echo "\n${GREEN}*** Deploying packages to PyPI ***${NC}\n"
@$(TWINE) upload dist/* --skip-existing
# Empty rule as dependency will force make to always perform target
# Source: https://www.gnu.org/software/make/manual/html_node/Force-Targets.html
FORCE: