Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- python_version_full := $(wordlist 2,4,$(subst ., ,$(shell python --version 2>&1)))
- python_version_major := $(word 1,${python_version_full})
- python_version_minor := $(word 2,${python_version_full})
- python_version_patch := $(word 3,${python_version_full})
- my_cmd.python.2 := python2 some_script.py2
- my_cmd.python.3 := python3 some_script.py3
- my_cmd := ${my_cmd.python.${python_version_major}}
- all :
- @echo ${python_version_full}
- @echo ${python_version_major}
- @echo ${python_version_minor}
- @echo ${python_version_patch}
- @echo ${my_cmd}
- .PHONY : all
- PYV=$(shell python -c "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)");
- ifeq ($(OS),Windows_NT)
- PYDIR=c:/python36
- PATH:=$(PYDIR)/scripts:$(PYDIR):$(PATH)
- PYTHON=python
- else
- PYTHON=python3.6
- endif
- ifeq (, $(shell which $(PYTHON) ))
- $(error "PYTHON=$(PYTHON) not found in $(PATH)")
- endif
- PYTHON_VERSION=$(shell $(PYTHON) -c "import sys;
- t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));
- sys.stdout.write(t)")
- PYTHON_VERSION_MIN=3.5
- PYTHON_VERSION_MIN_OK := $(shell echo '$(PYTHON_VERSION) >= $(PYTHON_VERSION_MIN)' | bc)
- ifeq ($(PYTHON_VERSION_MIN_OK),0)
- $(error "Need python $(PYTHON_VERSION) >= $(PYTHON_VERSION_MIN)")
- endif
- # ========================================================
- help:: ; grep -Pih -- "^wS+:" Makefile | sort | uniq
- web::
- $(PYTHON) manage.py runserver
- test::
- $(PYTHON) manage.py test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement