printrun: switch to pyproject and clean up build

This commit is contained in:
BlockListed
2025-09-24 20:39:20 +02:00
parent d1d8aedb45
commit 1f1123878f
+26 -31
View File
@@ -1,5 +1,6 @@
{
lib,
stdenv,
python3Packages,
fetchFromGitHub,
glib,
@@ -9,7 +10,7 @@
python3Packages.buildPythonApplication rec {
pname = "printrun";
version = "2.2.0";
format = "setuptools";
pyproject = true;
src = fetchFromGitHub {
owner = "kliment";
@@ -18,47 +19,41 @@ python3Packages.buildPythonApplication rec {
hash = "sha256-INJNGAmghoPIiivQp6AV1XmhyIu8SjfKqL8PTpi/tkY=";
};
postPatch = ''
sed -i -r "s|/usr(/local)?/share/|$out/share/|g" printrun/utils.py
'';
pythonRelaxDeps = [
"pyglet"
"cairosvg"
];
nativeBuildInputs = [
glib
wrapGAppsHook3
];
propagatedBuildInputs = with python3Packages; [
appdirs
platformdirs
build-system = with python3Packages; [
setuptools
cython
dbus-python
numpy
six
wxpython
psutil
pyglet
pyopengl
pyserial
cffi
cairosvg
lxml
puremagic
];
dependencies =
with python3Packages;
[
pyserial
wxpython
numpy
pyglet
psutil
lxml
platformdirs
puremagic
]
++ lib.optional stdenv.hostPlatform.isLinux dbus-python
++ lib.optional stdenv.hostPlatform.isDarwin pyobjc-framework-Cocoa;
pythonRelaxDeps = [ "pyglet" ];
# pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"
doCheck = false;
setupPyBuildFlags = [ "-i" ];
postInstall = ''
for f in $out/share/applications/*.desktop; do
sed -i -e "s|/usr/|$out/|g" "$f"
done
substituteInPlace $out/share/applications/*.desktop \
--replace-fail /usr/bin/ ""
substituteInPlace $out/share/applications/pronterface.desktop \
--replace-fail "Path=/usr/share/pronterface/" ""
'';
dontWrapGApps = true;
@@ -71,6 +66,6 @@ python3Packages.buildPythonApplication rec {
description = "Pronterface, Pronsole, and Printcore - Pure Python 3d printing host software";
homepage = "https://github.com/kliment/Printrun";
license = licenses.gpl3Plus;
platforms = platforms.linux;
changelog = "https://github.com/kliment/Printrun/releases/tag/${src.tag}";
};
}