From 66d2e0dd1eb63d4e81935cbb2009dc9b7965bfe1 Mon Sep 17 00:00:00 2001 From: Jens Troeger Date: Thu, 17 Nov 2022 22:37:20 +1000 Subject: [PATCH] fix: just read the package version and fail in Python, not the Makefile --- Makefile | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index f29dc200..d05c6a51 100644 --- a/Makefile +++ b/Makefile @@ -3,16 +3,9 @@ # https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html SHELL := bash -# Set the package's name and version for use throughout the Makefile. If the -# version can not be determined then error out. +# Set the package's name and version for use throughout the Makefile. PACKAGE_NAME := package -ifneq ($(origin VIRTUAL_ENV),undefined) - PACKAGE_VERSION := $(shell python -c 'import $(PACKAGE_NAME); print($(PACKAGE_NAME).__version__)') -else ifneq ($(wildcard .venv/upgraded-on),) - PACKAGE_VERSION := $(shell .venv/bin/python -c 'import $(PACKAGE_NAME); print($(PACKAGE_NAME).__version__)') -else - $(error Unable to determine package version) -endif +PACKAGE_VERSION := $(shell python -c $$'try: import $(PACKAGE_NAME); print($(PACKAGE_NAME).__version__);\nexcept: print("unknown");') # This variable contains the first goal that matches any of the listed goals # here, else it contains an empty string. The net effect is to filter out