nixpkgs/pkgs/servers/home-assistant/build-custom-component/manifest-requirements-check-hook.sh
Graham Bennett 31e60c2fbb
buildHomeAssistantComponent: init
Builder to package up custom components for Home Assistant.

These packages use `buildPythonPackage` with `format = "other"` and
rely on a custom install phase, that expects a standardized path,
and a custom check phase, that for now verifies python dependencies have
been satisified.

Co-Authored-By: Martin Weinelt <hexa@darmstadt.ccc.de>
Co-Authored-By: Sandro Jäckel <sandro.jaeckel@gmail.com>
2023-11-10 22:00:35 +01:00

26 lines
733 B
Bash

# Setup hook to check HA manifest requirements
echo "Sourcing manifest-requirements-check-hook"
function manifestCheckPhase() {
echo "Executing manifestCheckPhase"
runHook preCheck
manifests=$(shopt -s nullglob; echo $out/custom_components/*/manifest.json)
if [ ! -z "$manifests" ]; then
echo Checking manifests $manifests
@pythonCheckInterpreter@ @checkManifest@ $manifests
else
echo "No custom component manifests found in $out" >&2
exit 1
fi
runHook postCheck
echo "Finished executing manifestCheckPhase"
}
if [ -z "${dontCheckManifest-}" ] && [ -z "${installCheckPhase-}" ]; then
echo "Using manifestCheckPhase"
preDistPhases+=" manifestCheckPhase"
fi