klippy: 2022-03-14 -> 2022-06-18; drop python2

This commit is contained in:
cab 2022-06-27 15:54:03 +04:00
parent 8cb1790803
commit 387c727f8d
No known key found for this signature in database
GPG key ID: 08AA9711F8CD40CF

View file

@ -1,32 +1,38 @@
{ stdenv { stdenv
, lib , lib
, fetchFromGitHub , fetchFromGitHub
, python2 , python3
, unstableGitUpdater , unstableGitUpdater
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "klipper"; pname = "klipper";
version = "unstable-2022-03-14"; version = "unstable-2022-06-18";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "KevinOConnor"; owner = "KevinOConnor";
repo = "klipper"; repo = "klipper";
rev = "30098db22a43274ceb87e078e603889f403a35c4"; rev = "d3c4ba4839dd7a4339ae024752e6c6424884c185";
sha256 = "sha256-ORpXBFGPY6A/HEYX9Hhwb3wP2KcAE+z3pTxf6j7CwGg="; sha256 = "sha256-2Fq56JIk5qcKpWffz1k/EJ+xYAnUpuxvCryq88l//8E=";
}; };
sourceRoot = "source/klippy"; 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 # 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. # 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, # 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 # because it uses relative paths to find necessary modules. We could wrap but
@ -50,7 +56,7 @@ stdenv.mkDerivation rec {
meta = with lib; { meta = with lib; {
description = "The Klipper 3D printer firmware"; description = "The Klipper 3D printer firmware";
homepage = "https://github.com/KevinOConnor/klipper"; homepage = "https://github.com/KevinOConnor/klipper";
maintainers = with maintainers; [ lovesegfault zhaofengli ]; maintainers = with maintainers; [ lovesegfault zhaofengli cab404 ];
platforms = platforms.linux; platforms = platforms.linux;
license = licenses.gpl3Only; license = licenses.gpl3Only;
}; };