Skip to content

Kindle Comic Converter (kcc) : 5.5.1 -> 7.3.3#323382

Merged
teto merged 2 commits intoNixOS:masterfrom
adfaure:update-kcc
Jun 10, 2025
Merged

Kindle Comic Converter (kcc) : 5.5.1 -> 7.3.3#323382
teto merged 2 commits intoNixOS:masterfrom
adfaure:update-kcc

Conversation

@adfaure
Copy link
Contributor

@adfaure adfaure commented Jun 29, 2024

Description of changes

Fixes #219115
Fixes #396679

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: python Python is a high-level, general-purpose programming language. 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` labels Jun 29, 2024
@NixOSInfra NixOSInfra added the 12.first-time contribution This PR is the author's first one; please be gentle! label Jun 29, 2024
@ofborg ofborg bot added the 8.has: package (new) This PR adds a new package label Jun 29, 2024
@ofborg ofborg bot requested a review from dawidsowa June 29, 2024 14:33
@ofborg ofborg bot added 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jun 29, 2024
Copy link
Member

@FliegendeWurst FliegendeWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating kcc. See below for some suggestions to improve the package definition.

diff --git a/pkgs/applications/graphics/kcc/default.nix b/pkgs/applications/graphics/kcc/default.nix
index abbb9a5500c3..2103a2a1e146 100644
--- a/pkgs/applications/graphics/kcc/default.nix
+++ b/pkgs/applications/graphics/kcc/default.nix
@@ -1,33 +1,31 @@
 { lib
-, mkDerivationWith
-, python3
+, stdenv
 , python3Packages
-, fetchPypi
 , fetchFromGitHub
 , p7zip
 , archiveSupport ? true
-, cmake
 , mozjpeg
+, qt6
 }:
-mkDerivationWith python3Packages.buildPythonApplication rec {
+python3Packages.buildPythonApplication rec {
   pname = "kcc";
-  version = "6.1.0";
+  version = "6.2.0";
 
   src = fetchFromGitHub {
     owner = "ciromattia";
     repo = "${pname}";
     rev = "v${version}";
-    hash = "sha256-CU068e7fLPn0hW+yfm1qRp8bX8/jvAYz2g715CIHa/Q=";
+    hash = "sha256-61P4rsPRUJVrqv0xegxohRu7Yr8goSk7ElFV37GAYe8=";
   };
 
   nativeBuildInputs = with python3Packages; [
-    pip
+    qt6.wrapQtAppsHook
   ];
 
-  propagatedBuildInputs = with python3Packages ; [
-    p7zip
+  buildInputs = lib.optional stdenv.hostPlatform.isLinux qt6.qtwayland;
+
+  propagatedBuildInputs = with python3Packages; [
     pillow
-    pyqt5
     psutil
     python-slugify
     raven
@@ -36,12 +34,11 @@ mkDerivationWith python3Packages.buildPythonApplication rec {
     mozjpeg_lossless_optimization
     distro
     pyside6
+    packaging
   ];
 
-  qtWrapperArgs = lib.optionals archiveSupport [ "--prefix" "PATH" ":" "${ lib.makeBinPath [ p7zip ] }" ];
-
-  postFixup = ''
-    wrapProgram $out/bin/kcc "''${qtWrapperArgs[@]}"
+  preFixup = lib.optionalString archiveSupport ''
+    qtWrapperArgs+=(--prefix PATH : "${ lib.makeBinPath [ p7zip ] }")
   '';
 
   meta = with lib; {
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 181ac0979518..5af125c3d7a5 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -17804,7 +17804,7 @@ with pkgs;
 
   kcat = callPackage ../development/tools/kcat { };
 
-  kcc = libsForQt5.callPackage ../applications/graphics/kcc { };
+  kcc = callPackage ../applications/graphics/kcc { };
 
   kcgi = callPackage ../development/web/kcgi { };

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "6.1.0";
version = "6.2.0";

@nix-owners nix-owners bot requested a review from natsukium October 22, 2024 10:19
@adfaure adfaure force-pushed the update-kcc branch 2 times, most recently from 10e2167 to d37a166 Compare October 22, 2024 10:42
@FliegendeWurst
Copy link
Member

Also please squash your commits where it makes sense to do so.

@adfaure
Copy link
Contributor Author

adfaure commented Nov 7, 2024

Also please squash your commits where it makes sense to do so.

Thx for the review, squashed.

@adfaure adfaure changed the title Kindle Comic Converter (kcc) : 5.5.1 -> 6.1.0 Kindle Comic Converter (kcc) : 5.5.1 -> 6.2.2 Nov 7, 2024
@adfaure adfaure force-pushed the update-kcc branch 5 times, most recently from 503c3a3 to 203553a Compare November 8, 2024 11:16
@FliegendeWurst FliegendeWurst added the 12.approvals: 1 This PR was reviewed and approved by one person. label Nov 9, 2024
Copy link
Contributor

@jwillikers jwillikers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! I just wanted to play around with kcc and saw it was in sore need of an update. Much appreciated!

I don't think anything in my review is a blocker, just some improvements.

It would be nice to add auto-update passthru sections for both packages and a passthru version test for kcc, which would look like this for kcc.

  passthru = {
    tests.version = testers.testVersion {
      package = kcc;
    };
    updateScript = nix-update-script { };
  };

Comment on lines 40 to 52
meta = with lib; {
description = "Python library to optimize JPEGs losslessly using MozJPEG";
homepage = "https://github.com/wanadev/mozjpeg-lossless-optimization";
license = licenses.bsd3;
maintainers = with maintainers; [ adfaure ];
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove with lib here. Not a blocker. See #208242.

Suggested change
meta = with lib; {
description = "Python library to optimize JPEGs losslessly using MozJPEG";
homepage = "https://github.com/wanadev/mozjpeg-lossless-optimization";
license = licenses.bsd3;
maintainers = with maintainers; [ adfaure ];
};
meta = {
description = "Python library to optimize JPEGs losslessly using MozJPEG";
homepage = "https://github.com/wanadev/mozjpeg-lossless-optimization";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ adfaure ];
};

};

propagatedBuildInputs = with python3Packages ; [
nativeBuildInputs = [ qt6.wrapQtAppsHook ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can update the call to libsForQt5.callPackage to just be callPAckage for kcc in all-packages.nix now that you've added this.

You could just drop that line in all-packages.nix and move the package to pkgs/by-name/kc/kcc/package.nix, which is something that should probably be done eventually anyways.

}:

mkDerivationWith python3Packages.buildPythonApplication rec {
{ stdenv, lib, qt6, python3Packages, fetchFromGitHub, p7zip
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have this file formatted.

@mksafavi
Copy link
Member

mksafavi commented Apr 5, 2025

Hi.
Is there anything needed for this to get merged?

The current version (5.5.1) doesn't run.
Although it works by adding the missing dependency on a shell: nix-shell -p kcc python3Packages.distutils

5.5.1 crash log:
Traceback (most recent call last):
  File "/nix/store/5kzl31yvagrbljvqxbqy1ywbqcs8a9f5-kcc-5.5.1/bin/.kcc-wrapped", line 6, in <module>
    from kindlecomicconverter.startup import start
  File "/nix/store/5kzl31yvagrbljvqxbqy1ywbqcs8a9f5-kcc-5.5.1/lib/python3.12/site-packages/kindlecomicconverter/startup.py", line 24, in <module>
    from .shared import dependencyCheck
  File "/nix/store/5kzl31yvagrbljvqxbqy1ywbqcs8a9f5-kcc-5.5.1/lib/python3.12/site-packages/kindlecomicconverter/shared.py", line 24, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

@FliegendeWurst
Copy link
Member

The merge conflict needs to be resolved (#395247), and the commits squashed. That's all I think

@adfaure
Copy link
Contributor Author

adfaure commented Apr 6, 2025

Hi, I am resolving the conflicts now.

But now I have the following error. I am trying to fix it, but we can expect a bit of delay.

❯ nix-build . -A kcc                                                                                                                                                                                                                                                              nix-shell
error:
       … while evaluating the attribute 'drvPath'
         at /home/adfaure/Code/nixpkgs/lib/customisation.nix:418:7:
          417|     // {
          418|       drvPath =
             |       ^
          419|         assert condition;

       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:34:12:
           33|
           34|   strict = derivationStrict drvAttrs;
             |            ^
           35|

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: do not use python3Packages when building Python packages, specify each used package as a separate argument

@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Apr 6, 2025
@ghost ghost mentioned this pull request Apr 6, 2025
3 tasks
@adfaure adfaure force-pushed the update-kcc branch 2 times, most recently from 4a02104 to f490aae Compare April 14, 2025 07:45
adfaure and others added 2 commits May 16, 2025 10:05
@github-actions github-actions bot removed the 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` label May 16, 2025
@adfaure
Copy link
Contributor Author

adfaure commented May 16, 2025

Hi @FliegendeWurst, I lost track of what the next step is.
Are there still any requested changes on your side?

@FliegendeWurst
Copy link
Member

I think the PR is in good shape. You can un-draft it, if you believe it is ready.

@adfaure adfaure marked this pull request as ready for review May 16, 2025 09:58
@FliegendeWurst
Copy link
Member

Yeah it is a bit weird that the button to mark it as ready is somewhere completely different than the 'mark draft' button

@wegank wegank added the 12.approvals: 2 This PR was reviewed and approved by two persons. label May 16, 2025
@teto
Copy link
Member

teto commented Jun 10, 2025

a bit sad this wont work on wayland but it has been a year, let's keep the contributor sane and merge.

➜ kcc
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb, vnc, vkkhrdisplay, minimalegl, linuxfb, minimal, eglfs, offscreen.

Aborted (core dumped)

@teto teto merged commit 99c220e into NixOS:master Jun 10, 2025
31 of 32 checks passed
@adfaure
Copy link
Contributor Author

adfaure commented Jun 10, 2025

a bit sad this wont work on wayland but it has been a year, let's keep the contributor sane and merge.

➜ kcc
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb, vnc, vkkhrdisplay, minimalegl, linuxfb, minimal, eglfs, offscreen.

Aborted (core dumped)

Indeed, I didn't notice since despite using wayland, kcc runs on my laptop.

❯ ./result/bin/kcc
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
QSystemTrayIcon::setVisible: No Icon set

It is maybe worth opening an issue.

And thank you for the merge :)

@teto
Copy link
Member

teto commented Jun 10, 2025

thanks for your patience and the bump. Thanks to you, I could use my remarkable on an especially long trip.
The wayland issue is a classical one, usually solved by adding qtwayland. Not a big issue.

@adfaure
Copy link
Contributor Author

adfaure commented Jun 10, 2025

thanks for your patience and the bump. Thanks to you, I could use my remarkable on an especially long trip. The wayland issue is a classical one, usually solved by adding qtwayland. Not a big issue.

Thank you, have a nice trip!

Okay, thank you for the tip. I will fix that when I have a bit of time.

@TomaSajt
Copy link
Contributor

I noticed that this PR forgot to remove the old kcc package, the one in pkgs/applications/graphics/kcc/default.nix.

I'll open a PR that removes it.

Also, for whatever reason, wrapQtAppsHook doesn't try to wrap executables that are not binaries.
See:

# Skip the file if it is not a binary (ELF or Mach-O)
isELF "$file" || isMachO "$file" || continue

So by taking out the explicit wrapping logic, wrapQtAppsHook no longer does anything (because the python scripts are just text)

(Maybe this is why the wayland problem was showing up)

And also because of this p7zip no longer gets added to the PATH.

I'll open a version bump PR in which I'll try to fix these things.

@TomaSajt
Copy link
Contributor

Opened #426382

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 12.approvals: 2 This PR was reviewed and approved by two persons. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kcc: kcc fails to launch kcc crashes on startup

9 participants