install: treat xiaohe-agent/packages/mytoolkit as the working tree.
Refuse only GHA _work installs; drop the standalone myBin checkout as the install target.
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
ROOT_DIR := $(shell pwd)
|
||||
# Prefer an explicit PYTHON=; else the interpreter behind `mytoolkit` on PATH;
|
||||
# else python3. Never silently install into a different Python than the CLI.
|
||||
|
||||
# Prefer PYTHON= override. Else shebang of `mytoolkit` on PATH. Else python3.
|
||||
ifndef PYTHON
|
||||
CLI_BIN := $(shell command -v mytoolkit 2>/dev/null)
|
||||
CLI_PY := $(if $(CLI_BIN),$(shell head -1 "$(CLI_BIN)" 2>/dev/null | sed 's|^#!||'),)
|
||||
PYTHON ?= $(if $(CLI_PY),$(CLI_PY),python3)
|
||||
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
|
||||
|
||||
@@ -11,18 +17,19 @@ help:
|
||||
@echo "Usage: make [target]"
|
||||
@echo ""
|
||||
@echo " install Editable install into CLI Python + sync skill"
|
||||
@echo " (refuse runner/_work trees; PYTHON=$(PYTHON))"
|
||||
@echo " (refuse GHA runner/_work trees; PYTHON=$(PYTHON))"
|
||||
@echo " sync-skill Copy the bundled agent skill to ~/.agents/skills/mytoolkit/"
|
||||
@echo " test Run the pytest suite"
|
||||
@echo " uninstall Uninstall mytoolkit and remove shell completions"
|
||||
|
||||
# Canonical checkout: ~/Documents/myBin/mytoolkit (apaam/mytoolkit).
|
||||
# Do NOT `pip install -e` from GHA _work or xiaohe packages/ submodule.
|
||||
# Truth source for day-to-day work: xiaohe-agent/packages/mytoolkit (submodule).
|
||||
# Refuse ephemeral GHA runner checkouts so PATH CLI cannot silently point at _work.
|
||||
install:
|
||||
@case "$(ROOT_DIR)" in \
|
||||
*/_work/*|*/actions-runner/*|*/.xiaohe/actions-runner/*) \
|
||||
echo "ERROR: refuse install from runner/worktree: $(ROOT_DIR)" >&2; \
|
||||
echo "Use: cd ~/Documents/myBin/mytoolkit && make install" >&2; \
|
||||
*/_work/*|*/.xiaohe/actions-runner/*) \
|
||||
echo "ERROR: refuse install from GHA runner worktree: $(ROOT_DIR)" >&2; \
|
||||
echo "Use: cd <xiaohe-agent>/packages/mytoolkit && make install" >&2; \
|
||||
echo " or: cd <xiaohe-agent> && make update / ./setup.sh" >&2; \
|
||||
exit 1 ;; \
|
||||
esac
|
||||
@echo "Installing editable mytoolkit"
|
||||
@@ -36,7 +43,7 @@ install:
|
||||
@$(PYTHON) -m pip show mytoolkit | awk '/^(Name|Version|Location|Editable project location):/'
|
||||
@ed="$$($(PYTHON) -m pip show mytoolkit | awk -F': ' '/Editable project location:/ {print $$2}')"; \
|
||||
case "$$ed" in \
|
||||
*/_work/*|*/actions-runner/*) \
|
||||
*/_work/*|*/.xiaohe/actions-runner/*) \
|
||||
echo "ERROR: Editable still points at runner tree: $$ed" >&2; exit 1 ;; \
|
||||
esac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user