Skip to content

Commit

Permalink
Avoid python version detection when not installed.
Browse files Browse the repository at this point in the history
When "python" is not installed, PYTHON is empty and then the (eager) evaluation of PY_XY_VER causes an error from the shell. This silences such error by not attempting to detect the version of "python" when it is not installed.

With "bash", the error is "bash: - : invalid option", but it is not immediately clear that in fact it is benign (when python is not needed).

On some systems, "python" is not installed (but python3 / PYTHON3 is).
  • Loading branch information
kalibera authored and mabrand committed Apr 11, 2024
1 parent 45087a5 commit d76955d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ OPENSSL := openssl
PATCH := $(shell gpatch --help >/dev/null 2>&1 && echo g)patch
PYTHON := $(shell PATH="$(ORIG_PATH)" which python)
PYTHON3 := $(shell PATH="$(ORIG_PATH)" which python3)
PY_XY_VER := $(shell $(PYTHON) -c "import sys; print('{0[0]}.{0[1]}'.format(sys.version_info))")
PY_XY_VER := $(if $(PYTHON),$(shell $(PYTHON) -c "import sys; print('{0[0]}.{0[1]}'.format(sys.version_info))"))
SED := $(shell gsed --help >/dev/null 2>&1 && echo g)sed
SORT := $(shell gsort --help >/dev/null 2>&1 && echo g)sort
TOUCH := $(shell gtouch --help >/dev/null 2>&1 && echo g)touch
Expand Down

0 comments on commit d76955d

Please sign in to comment.