Skip to content

Commit

Permalink
Fix Python version detection in Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Burmak committed Sep 8, 2023
1 parent cfc8dea commit e7dccd2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ifndef NO_VENV
PATH:=venv/bin:${PATH}
endif

PYTHON_VERSION=$(shell python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
PYTHON_VERSION=$(shell ${PYTHON} -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
SESSION_FILE=.session_conf.sav
INSTALL_DIR=$(DESTDIR)/opt/yandex/ch-backup

Expand Down Expand Up @@ -163,7 +163,16 @@ ch_backup/version.txt:


.PHONY: install-deps
install-deps: .install-deps
install-deps: check-environment .install-deps

.PHONY: check-environment
check-environment:
@if ! command -v ${PYTHON} > /dev/null; then \
echo 'Python interpreter "${PYTHON}" ($$PYTHON) not found' >&2; exit 1; \
fi
@if [ -z "${PYTHON_VERSION}" ]; then \
echo 'Failed to determine version of Python interpreter "${PYTHON}" ($$PYTHON)' >&2; exit 1; \
fi

.install-deps: requirements.txt requirements-dev.txt
if [ -z "${NO_VENV}" ]; then ${PYTHON} -m venv venv; fi
Expand Down

0 comments on commit e7dccd2

Please sign in to comment.