-
Notifications
You must be signed in to change notification settings - Fork 2
/
default.mk
66 lines (54 loc) · 1.42 KB
/
default.mk
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# This file is part of the Provider API Example.
#
# Copyright (C) 2023 Serghei Iakovlev <[email protected]>
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.
# Run “make test” by default
.DEFAULT_GOAL = test
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
PKG_NAME = provider
PYLINT_FLAGS ?=
FLAKE8_FLAGS ?= --show-source --statistics
ifneq ($(TERM),)
GREEN := $(shell tput setaf 2)
RESET := $(shell tput sgr0)
CS = "${GREEN}~~~ "
CE = " ~~~${RESET}"
PYTEST_FLAGS ?= --color=yes
else
CS = "~~~ "
CE = " ~~~"
PYTEST_FLAGS ?= --color=no
endif
COV =
REQUIREMENTS = requirements/requirements.txt requirements/requirements-dev.txt
ifneq ($(VIRTUAL_ENV),)
VENV_ROOT = $(VIRTUAL_ENV)
else
VENV_ROOT = .venv
endif
# PYTHON will used to create venv
ifeq ($(OS),Windows_NT)
PYTHON ?= python.exe
VIRTUALENV ?= virtualenv.exe
VENV_BIN = $(VENV_ROOT)/Scripts
else
PYTHON ?= python3
VIRTUALENV ?= $(PYTHON) -m venv
VENV_BIN = $(VENV_ROOT)/bin
endif
VENV_PYTHON = $(VENV_BIN)/python
VENV_PIP = $(VENV_PYTHON) -m pip
export PATH := $(VENV_BIN):$(PATH)
# Program availability
ifndef PYTHON
$(error "Python is not available please install Python")
else
ifneq ($(OS),Windows_NT)
HAVE_PYTHON := $(shell sh -c "command -v $(PYTHON)")
ifndef HAVE_PYTHON
$(error "Python is not available. Please install Python.")
endif
endif
endif