forked from facebookarchive/fbtftp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (30 loc) · 1.13 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
PYTHON=python3
PYTHON3 := $(shell command -v python3)
PYTHON35 := $(shell command -v python3.5)
ifndef PYTHON3
ifdef PYTHON35
PYTHON=python3.5
endif
endif
PYTHON_MAJOR_AT_LEAST=3
PYTHON_MINOR_AT_LEAST=4
PYTHON_VERSION := $(shell $(PYTHON) -c 'from __future__ import print_function; import platform; print(platform.python_version())')
CHECK_PYTHON_VERSION=$(shell $(PYTHON) -c 'from __future__ import print_function; import sys; print(0) if sys.version_info[:2] < ($(PYTHON_MAJOR_AT_LEAST), $(PYTHON_MINOR_AT_LEAST)) else print(1)')
.PHONY: all install test clean
all: test install
install:
ifneq ($(CHECK_PYTHON_VERSION), 1)
@echo Invalid Python version, need at least $(PYTHON_MAJOR_AT_LEAST).$(PYTHON_MINOR_AT_LEAST), found "$(PYTHON_VERSION)"
@exit 1
endif
${PYTHON} setup.py install
test:
ifneq ($(CHECK_PYTHON_VERSION), 1)
@echo Invalid Python version, need at least $(PYTHON_MAJOR_AT_LEAST).$(PYTHON_MINOR_AT_LEAST), found "$(PYTHON_VERSION)"
@exit 1
endif
${PYTHON} setup.py test
${PYTHON} setup.py flake8
clean:
$(RM) -r build/ dist/ fbtftp.egg-info/ tests/fbtftp.egg-info .coverage \
.eggs/ fbtftp/__pycache__/ tests/__pycache__