klipper: add calibrate_shaper script as a binary (#344956)
This commit is contained in:
commit
f10fe6a0a6
@ -4,6 +4,7 @@
|
||||
, python3
|
||||
, unstableGitUpdater
|
||||
, makeWrapper
|
||||
, writeShellScript
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@ -44,6 +45,18 @@ stdenv.mkDerivation rec {
|
||||
--replace 'GCC_CMD = "gcc"' 'GCC_CMD = "${stdenv.cc.targetPrefix}cc"'
|
||||
'';
|
||||
|
||||
pythonInterpreter =
|
||||
(python3.withPackages (
|
||||
p: with p; [
|
||||
numpy
|
||||
matplotlib
|
||||
]
|
||||
)).interpreter;
|
||||
|
||||
pythonScriptWrapper = writeShellScript pname ''
|
||||
${pythonInterpreter} "@out@/lib/scripts/@script@" "$@"
|
||||
'';
|
||||
|
||||
# NB: We don't move the main entry point into `/bin`, or even symlink it,
|
||||
# because it uses relative paths to find necessary modules. We could wrap but
|
||||
# this is used 99% of the time as a service, so it's not worth the effort.
|
||||
@ -56,6 +69,8 @@ stdenv.mkDerivation rec {
|
||||
# under `klipper_path`
|
||||
cp -r $src/docs $out/lib/docs
|
||||
cp -r $src/config $out/lib/config
|
||||
cp -r $src/scripts $out/lib/scripts
|
||||
cp -r $src/klippy $out/lib/klippy
|
||||
|
||||
# Add version information. For the normal procedure see https://www.klipper3d.org/Packaging.html#versioning
|
||||
# This is done like this because scripts/make_version.py is not available when sourceRoot is set to "${src.name}/klippy"
|
||||
@ -64,6 +79,12 @@ stdenv.mkDerivation rec {
|
||||
mkdir -p $out/bin
|
||||
chmod 755 $out/lib/klipper/klippy.py
|
||||
makeWrapper $out/lib/klipper/klippy.py $out/bin/klippy --chdir $out/lib/klipper
|
||||
|
||||
substitute "$pythonScriptWrapper" "$out/bin/klipper-calibrate-shaper" \
|
||||
--subst-var "out" \
|
||||
--subst-var-by "script" "calibrate_shaper.py"
|
||||
chmod 755 "$out/bin/klipper-calibrate-shaper"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user