Description: Avoid repeated download from BATS repository, using local repository if available
Author: Josenilson Ferreira da Silva <nilsonfsilva@hotmail.com>
Forwarded: not-needed
Last-Update: 2024-12-10

Index: pyenv/Makefile
===================================================================
--- pyenv.orig/Makefile
+++ pyenv/Makefile
@@ -6,12 +6,20 @@ unexport PYTHON_CONFIGURE_OPTS
 
 test: test-unit test-plugin
 
-test-unit: bats
-	PATH="./bats/bin:$$PATH" test/run
-	
-test-plugin: bats
-	cd plugins/python-build && $(PWD)/bats/bin/bats $${CI:+--tap} test
+test-unit:
+	@which $(BATS_PATH)/bats > /dev/null
+	PATH="$(BATS_PATH):$$PATH" $(TEST_UNIT_DIR)/run
 
+
+test-plugin:
+	@which $(BATS_PATH)/bats > /dev/null
+	PATH="$(BATS_PATH):$$PATH" $(BATS_PATH)/bats $${CI:+--tap} $(TEST_PLUGIN_DIR)
+
+
+BATS_PATH ?= /usr/bin
+BATS_LIB_PATH ?= /usr/lib/bats-core
+TEST_UNIT_DIR ?= test
+TEST_PLUGIN_DIR ?= plugins/python-build/test
 PYTHON_BUILD_ROOT := $(CURDIR)/plugins/python-build
 PYTHON_BUILD_OPTS ?= --verbose
 PYTHON_BUILD_VERSION ?= 3.8-dev
@@ -26,4 +34,4 @@ test-build:
 	$(PYTHON_BUILD_TEST_PREFIX)/bin/pip -V
 
 bats:
-	git clone --depth 1 --branch v1.2.0 https://github.com/bats-core/bats-core.git bats
+	@echo "Using existing bats installation in $(BATS_PATH)"
