-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (64 loc) · 1.65 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
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
67
68
69
70
71
72
73
74
75
76
77
78
79
TOP := $(dir $(firstword $(MAKEFILE_LIST)))
# backwards, but given the problem below, I cannot figure different
PACKAGES := strictyaml yamale ruamel.yaml # ruamel has its own dependencies, see targets
######
# check for missing executables
#
# I would rather do this in a loop, but I could not figure out how to make it work
# Hopefully the number of executables required will stay low
WHICH := type -P # as opposed to which
EXECMISSING := false
PIP := $(shell $(WHICH) pip)
PYTHON := $(shell $(WHICH) python)
YQ := $(shell $(WHICH) yq)
ifndef YQ
$(info Missing yq)
EXECMISSING := true
endif
ifndef PIP
$(info Missing pip)
EXECMISSING := true
endif
ifndef PYTHON
$(info Missing python)
EXECMISSING := true
endif
#
# end of check for missing executables - we check this in 'all'
######
#####
#
# start of targets
#
#####
all: yqcheck
ifeq ($(EXECMISSING),true)
$(error Missing executables )
endif
@$(TOP)/tests/runTests all
clean:
@rm -f $(TOP)/tests/*schema.yaml
@rm -rf $(TOP)/pipeline/*/__pycache__
yqcheck:
@$(TOP)/tests/yqCheck
check: checkBins checkPkgs
checkBins:
ifeq ($(EXECMISSING),true)
$(error Missing executables )
endif
@echo All binaries appear to be installed.
checkPkgs: checkBins
$(info Checking for required and recommended packages)
$(foreach package,$(PACKAGES), \
$(info $(if $(shell $(PIP) show $(package) 2> /dev/null), \
Package '$(package)' appears to be installed, \
You will need to run 'pip install $(package)' or 'make $(package)')) \
)
@echo Package checks complete
ruamel.yaml: setuptools
@$(PIP) install $(@)
@$(PIP) install $(@).cmd
setuptools:
@$(PIP) install -U setuptools wheel
strictyaml yamale:
@$(PIP) install $@