EAPI=8 PYTHON_COMPAT=( python3_{13..14} ) inherit meson python-single-r1 DESCRIPTION="Optional local read-only MCP bridge for SrcUX Wayfire components" HOMEPAGE="https://www.hedronfire.com/" SRC_URI="https://www.hedronfire.com/distfiles/wayfire-mcp-0.1.2-r2.tar.gz https://www.hedronfire.com/distfiles/wayfire-mcp-wheels-0.1.2.tar.gz" S="${WORKDIR}/wayfire-mcp-0.1.2-r2" LICENSE="MIT Apache-2.0 BSD-2 BSD ISC MPL-2.0 PSF-2" SLOT="0" KEYWORDS="~amd64" # The bundled wheels keep their recorded hashes, so their native modules are not stripped. RESTRICT="mirror strip test" QA_PREBUILT="usr/libexec/wayfire-mcp/python/*.so usr/libexec/wayfire-mcp/python/*/*.so usr/libexec/wayfire-mcp/python/*/*/*/*.so" REQUIRED_USE="${PYTHON_REQUIRED_USE}" RDEPEND="${PYTHON_DEPS} >=gui-apps/pyr-ctl-0.1.4 >=gui-apps/pyr-session-0.1.10" BDEPEND="${PYTHON_DEPS} dev-python/uv" src_install() { meson_src_install local bundle="${ED}/usr/libexec/wayfire-mcp/python" # The lock leaves out SDK extras the stdio bridge never imports. uv pip install --python "${PYTHON}" --target "${bundle}" \ --offline --no-index --find-links "${WORKDIR}/wheels" --require-hashes --no-deps \ --no-compile-bytecode -r data/requirements.lock || die "offline SDK bundle failed" rm -f "${bundle}/.lock" || die rm -rf "${bundle}/bin" || die # Bundled Python distributions retain dist-info licences and provenance. find "${bundle}" -type d -name __pycache__ -prune -exec rm -rf {} + || die # Byte-compile here so the package owns the bytecode; the launcher runs with -B. python_optimize "${ED}/usr/libexec/wayfire-mcp" # The build installs its documents to /usr/share/doc/${PN}; keep them under ${PF}. mkdir -p "${ED}/usr/share/doc/${PF}" || die mv "${ED}/usr/share/doc/${PN}"/* "${ED}/usr/share/doc/${PF}/" || die rmdir "${ED}/usr/share/doc/${PN}" || die } pkg_postinst() { elog "search_files is now opt-in: start the bridge with WAYFIRE_MCP_FILE_SEARCH=1 in its" elog "environment to enable filename search (at most 100 searches per bridge)." }