From 387c727f8d78dca84f7c550452bc4678e8bf2cf2 Mon Sep 17 00:00:00 2001 From: cab Date: Mon, 27 Jun 2022 15:54:03 +0400 Subject: [PATCH] klippy: 2022-03-14 -> 2022-06-18; drop python2 --- pkgs/servers/klipper/default.nix | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/pkgs/servers/klipper/default.nix b/pkgs/servers/klipper/default.nix index b882bc589c6..c3f97ce779f 100644 --- a/pkgs/servers/klipper/default.nix +++ b/pkgs/servers/klipper/default.nix @@ -1,32 +1,38 @@ { stdenv , lib , fetchFromGitHub -, python2 +, python3 , unstableGitUpdater }: stdenv.mkDerivation rec { pname = "klipper"; - version = "unstable-2022-03-14"; + version = "unstable-2022-06-18"; src = fetchFromGitHub { owner = "KevinOConnor"; repo = "klipper"; - rev = "30098db22a43274ceb87e078e603889f403a35c4"; - sha256 = "sha256-ORpXBFGPY6A/HEYX9Hhwb3wP2KcAE+z3pTxf6j7CwGg="; + rev = "d3c4ba4839dd7a4339ae024752e6c6424884c185"; + sha256 = "sha256-2Fq56JIk5qcKpWffz1k/EJ+xYAnUpuxvCryq88l//8E="; }; sourceRoot = "source/klippy"; - # there is currently an attempt at moving it to Python 3, but it will remain - # Python 2 for the foreseeable future. - # c.f. https://github.com/KevinOConnor/klipper/pull/3278 # NB: This is needed for the postBuild step - nativeBuildInputs = [ (python2.withPackages ( p: with p; [ cffi ] )) ]; + nativeBuildInputs = [ (python3.withPackages ( p: with p; [ cffi ] )) ]; - buildInputs = [ (python2.withPackages (p: with p; [ cffi pyserial greenlet jinja2 numpy ])) ]; + buildInputs = [ (python3.withPackages (p: with p; [ cffi pyserial greenlet jinja2 markupsafe ])) ]; # we need to run this to prebuild the chelper. - postBuild = "python2 ./chelper/__init__.py"; + postBuild = "python ./chelper/__init__.py"; + + # 2022-06-28: Python 3 is already supported in klipper, alas shebangs remained + # the same - we replace them in patchPhase. + patchPhase = '' + for F in klippy.py console.py parsedump.py; do + substituteInPlace $F \ + --replace '/usr/bin/env python2' '/usr/bin/env python' + done + ''; # 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 @@ -50,7 +56,7 @@ stdenv.mkDerivation rec { meta = with lib; { description = "The Klipper 3D printer firmware"; homepage = "https://github.com/KevinOConnor/klipper"; - maintainers = with maintainers; [ lovesegfault zhaofengli ]; + maintainers = with maintainers; [ lovesegfault zhaofengli cab404 ]; platforms = platforms.linux; license = licenses.gpl3Only; };