fix(Makefile): simplify PYTHON default for macOS make.

This commit is contained in:
Zhengshou Lai
2026-08-11 21:19:34 +08:00
parent 4b2ed13280
commit f6fa1aa93d
+5 -17
View File
@@ -1,35 +1,23 @@
ROOT_DIR := $(shell pwd) ROOT_DIR := $(shell pwd)
PYTHON ?= python3
# Prefer PYTHON= override. Else shebang of `mytoolkit` on PATH. Else python3.
ifndef PYTHON
CLI_BIN := $(shell command -v mytoolkit 2>/dev/null)
ifneq ($(CLI_BIN),)
PYTHON := $(shell head -1 "$(CLI_BIN)" 2>/dev/null | sed 's|^#!||')
endif
ifeq ($(strip $(PYTHON)),)
PYTHON := python3
endif
endif
.PHONY: help install uninstall sync-skill test .PHONY: help install uninstall sync-skill test
help: help:
@echo "Usage: make [target]" @echo "Usage: make [target]"
@echo "" @echo ""
@echo " install Editable install into CLI Python + sync skill" @echo " install Editable install + sync skill (PYTHON=$(PYTHON))"
@echo " (refuse GHA runner/_work trees; PYTHON=$(PYTHON))" @echo " sync-skill Copy bundled agent skill to ~/.agents/skills/mytoolkit/"
@echo " sync-skill Copy the bundled agent skill to ~/.agents/skills/mytoolkit/"
@echo " test Run the pytest suite" @echo " test Run the pytest suite"
@echo " uninstall Uninstall mytoolkit and remove shell completions" @echo " uninstall Uninstall mytoolkit and remove shell completions"
# Truth source for day-to-day work: xiaohe-agent/packages/mytoolkit (submodule). # Working tree: xiaohe-agent/packages/mytoolkit (submodule of apaam/mytoolkit).
# Refuse ephemeral GHA runner checkouts so PATH CLI cannot silently point at _work. # Refuse ephemeral GHA runner checkouts (_work) so PATH CLI cannot point there.
install: install:
@case "$(ROOT_DIR)" in \ @case "$(ROOT_DIR)" in \
*/_work/*|*/.xiaohe/actions-runner/*) \ */_work/*|*/.xiaohe/actions-runner/*) \
echo "ERROR: refuse install from GHA runner worktree: $(ROOT_DIR)" >&2; \ echo "ERROR: refuse install from GHA runner worktree: $(ROOT_DIR)" >&2; \
echo "Use: cd <xiaohe-agent>/packages/mytoolkit && make install" >&2; \ echo "Use: cd <xiaohe-agent>/packages/mytoolkit && make install" >&2; \
echo " or: cd <xiaohe-agent> && make update / ./setup.sh" >&2; \
exit 1 ;; \ exit 1 ;; \
esac esac
@echo "Installing editable mytoolkit" @echo "Installing editable mytoolkit"