Skip to content

Commit

Permalink
add code to error if variables are not defined
Browse files Browse the repository at this point in the history
Signed-off-by: kksat <[email protected]>
  • Loading branch information
kksat committed Aug 26, 2024
1 parent 9935bf6 commit c1c9ee3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ ifneq (,$(wildcard ./.env))
export
endif

defined = $(strip $(filter-out undefined,$(flavor $1)))

required-environment-variables = \
$(eval .required-environment-variables :=) \
$(foreach V,$(sort $1), \
$(if $(call defined,$V),,$(eval .required-environment-variables += $V)) \
) \
$(if $(strip ${.required-environment-variables}), \
$(foreach V,${.required-environment-variables}, \
$(info Variable is not defined but required: $$$V) \
) \
$(error Not all required variables are defined) \
)

PYTHON?=python3.10
export PYTHON
TOX?=tox
Expand Down

0 comments on commit c1c9ee3

Please sign in to comment.