Skip to content
Snippets Groups Projects
Commit f60c0097 authored by Jan Mach's avatar Jan Mach
Browse files

Added new master makefile target for local installation of Python dependencies.

For better integration with our build server it was necessary to implement simple makefile target, that will make sure that all necessary Python library dependencies are installed on current system. Another part of the commit is a small facelift of the make output: it is now colored for better readability (especially help) and some of the output for suppressed for more clarity. (Redmine issue: #3387)
parent ae16929b
No related branches found
No related tags found
No related merge requests found
...@@ -12,29 +12,54 @@ DIR_LIB = lib ...@@ -12,29 +12,54 @@ DIR_LIB = lib
BIN_FILES := $(wildcard bin/mentat-*.py) BIN_FILES := $(wildcard bin/mentat-*.py)
#
# 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
NC=\033[0m
#-------------------------------------------------------------------------------
all: help all: help
check: pyflakes pylint test check: pyflakes pylint test
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
help: help:
$(info List of possible make targets:) #@echo -e "\033[0;32m [OK] \033[0m \033[0;33m Compiling:\033[0m" $<
$(info )
$(info * all: alias for help, you have to pick a target [default]) @echo ""
$(info * help: print this help and exit) @echo "${RED}LIST OF MAKE TARGETS:${NC}"
$(info * docs: generate all local project documentation) @echo ""
$(info = docs-sync) @echo " * ${GREEN}all${NC}: alias for help, you have to pick a target [default]"
$(info = docs-sphinx) @echo " * ${GREEN}help${NC}: print this help and exit"
$(info * check: perform extensive code checking) @echo " * ${GREEN}deps${NC}: install various dependencies"
$(info = pyflakes: check source code with pyflakes) @echo " = ${ORANGE}deps-python${NC}: install Python dependencies with pip3"
$(info - pyflakes-bin) @echo " * ${GREEN}docs${NC}: generate local project documentation"
$(info = pylint: check source code with pylint) @echo " = ${ORANGE}docs-sync${NC}: synchronize documentation from submodules"
$(info - pylint-bin) @echo " = ${ORANGE}docs-sphinx${NC}: generate local project documentation "
$(info = test: run unit tests with nosetest) @echo " * ${GREEN}check${NC}: perform extensive code checking"
$(info ) @echo " = ${ORANGE}pyflakes${NC}: check source code with pyflakes"
@echo " - pyflakes-bin"
@echo " = ${ORANGE}pylint${NC}: check source code with pylint"
@echo " - pylint-bin"
@echo " = ${ORANGE}test${NC}: run unit tests with nosetest"
@echo ""
#-------------------------------------------------------------------------------
deps: deps-python
deps-python: FORCE
@echo "\n${GREEN}*** Installing Python dependencies ***${NC}\n"
@pip3 install -r conf/requirements.pip --upgrade
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
...@@ -43,17 +68,17 @@ help: ...@@ -43,17 +68,17 @@ help:
docs: docs-sync docs-sphinx docs: docs-sync docs-sphinx
docs-sync: FORCE docs-sync: FORCE
echo "*** Synchronizing documentation source code from submodules ***" @echo "\n${GREEN}*** Synchronizing documentation source code from submodules ***${NC}\n"
rsync -r --progress --archive --update --delete --force ./submodules/pyzenkit/doc/_doclib/api_*.rst ./doc/sphinx/_doclib/ @rsync -r --progress --archive --update --delete --force ./submodules/pyzenkit/doc/_doclib/api_*.rst ./doc/sphinx/_doclib/
rsync -r --progress --archive --update --delete --force ./submodules/pyzenkit/doc/_doclib/_inc*.rst ./doc/sphinx/_doclib/ @rsync -r --progress --archive --update --delete --force ./submodules/pyzenkit/doc/_doclib/_inc*.rst ./doc/sphinx/_doclib/
rsync -r --progress --archive --update --delete --force ./submodules/pynspect/doc/_doclib/api_*.rst ./doc/sphinx/_doclib/ @rsync -r --progress --archive --update --delete --force ./submodules/pynspect/doc/_doclib/api_*.rst ./doc/sphinx/_doclib/
#find ./ -type f -name *.pyc -exec rm -f {} \; @#find ./ -type f -name *.pyc -exec rm -f {} \;
docs-sphinx: FORCE docs-sphinx: FORCE
echo "*** Generating project documentation ***" @echo "\n${GREEN}*** Generating project documentation ***${NC}\n"
#cd $(DIR_DOC)/sphinx && make clean @#cd $(DIR_DOC)/sphinx && make clean
#cd $(DIR_DOC)/sphinx && make apidoc @#cd $(DIR_DOC)/sphinx && make apidoc
cd $(DIR_DOC)/sphinx && make html @cd $(DIR_DOC)/sphinx && make html
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
...@@ -62,18 +87,18 @@ docs-sphinx: FORCE ...@@ -62,18 +87,18 @@ docs-sphinx: FORCE
pyflakes: pyflakes-bin pyflakes: pyflakes-bin
pyflakes-bin: $(DIR_BIN)/mentat-*.py pyflakes-bin: $(DIR_BIN)/mentat-*.py
echo "*** Checking code with pyflakes ***" @echo "\n${GREEN}*** Checking code with pyflakes ***${NC}\n"
PYTHONPATH=$(DIR_LIB) python3 -m pyflakes $(DIR_BIN)/mentat-*.py PYTHONPATH=$(DIR_LIB) python3 -m pyflakes $(DIR_BIN)/mentat-*.py
pylint: pylint-bin pylint: pylint-bin
pylint-bin: $(DIR_BIN)/mentat-*.py pylint-bin: $(DIR_BIN)/mentat-*.py
echo "*** Checking code with pylint ***" @echo "\n${GREEN}*** Checking code with pylint ***${NC}\n"
PYTHONPATH=$(DIR_LIB) python3 -m pylint --rcfile .pylintrc-bin $(DIR_BIN) PYTHONPATH=$(DIR_LIB) python3 -m pylint --rcfile .pylintrc-bin $(DIR_BIN)
test: test:
echo "*** Checking code with nosetests ***" @echo "\n${GREEN}*** Checking code with nosetests ***${NC}\n"
nosetests $(DIR_LIB) nosetests $(DIR_LIB)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment