From a4630ce4757923f269287da91f98f2932a128628 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sun, 19 May 2024 09:42:06 -0400 Subject: [PATCH 1/3] icoextract: migrate to by-name icoextract is primarily a command-line tool. Also removes the no longer required pythonOlder check. --- .../ic}/icoextract/exe-thumbnailer.thumbnailer | 0 .../ic/icoextract/package.nix} | 14 ++++---------- pkgs/top-level/python-packages.nix | 4 +++- 3 files changed, 7 insertions(+), 11 deletions(-) rename pkgs/{development/python-modules => by-name/ic}/icoextract/exe-thumbnailer.thumbnailer (100%) rename pkgs/{development/python-modules/icoextract/default.nix => by-name/ic/icoextract/package.nix} (82%) diff --git a/pkgs/development/python-modules/icoextract/exe-thumbnailer.thumbnailer b/pkgs/by-name/ic/icoextract/exe-thumbnailer.thumbnailer similarity index 100% rename from pkgs/development/python-modules/icoextract/exe-thumbnailer.thumbnailer rename to pkgs/by-name/ic/icoextract/exe-thumbnailer.thumbnailer diff --git a/pkgs/development/python-modules/icoextract/default.nix b/pkgs/by-name/ic/icoextract/package.nix similarity index 82% rename from pkgs/development/python-modules/icoextract/default.nix rename to pkgs/by-name/ic/icoextract/package.nix index e9ef6393f22f4..d1f5853385451 100644 --- a/pkgs/development/python-modules/icoextract/default.nix +++ b/pkgs/by-name/ic/icoextract/package.nix @@ -1,29 +1,23 @@ { lib, - buildPythonPackage, + python3Packages, fetchPypi, - pefile, - pillow, - pythonOlder, - setuptools, }: -buildPythonPackage rec { +python3Packages.buildPythonApplication rec { pname = "icoextract"; version = "0.1.5"; pyproject = true; - disabled = pythonOlder "3.8"; - src = fetchPypi { inherit pname version; extension = "tar.gz"; hash = "sha256-/UxnWNyRNtwI4Rxx97i5QyjeMrUr5Sq+TfLTmU0xWyc="; }; - build-system = [ setuptools ]; + build-system = with python3Packages; [ setuptools ]; - dependencies = [ + dependencies = with python3Packages; [ pefile pillow ]; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 983d0d25bb970..b5545719af500 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5755,7 +5755,9 @@ self: super: with self; { idasen = callPackage ../development/python-modules/idasen { }; - icoextract = callPackage ../development/python-modules/icoextract { }; + icoextract = toPythonModule (pkgs.icoextract.override { + python3Packages = self; + }); icontract = callPackage ../development/python-modules/icontract { }; From 70123e0915b4d344ca5eee8b10da682602912d68 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sun, 19 May 2024 10:04:17 -0400 Subject: [PATCH 2/3] icoextract: use thumbnailer from upstream Fixes an issue where upstream updated the thumbnailer by fetching from GitHub instead of PyPI. --- .../ic/icoextract/exe-thumbnailer.thumbnailer | 3 --- pkgs/by-name/ic/icoextract/package.nix | 17 ++++++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 pkgs/by-name/ic/icoextract/exe-thumbnailer.thumbnailer diff --git a/pkgs/by-name/ic/icoextract/exe-thumbnailer.thumbnailer b/pkgs/by-name/ic/icoextract/exe-thumbnailer.thumbnailer deleted file mode 100644 index c275ac919b6ba..0000000000000 --- a/pkgs/by-name/ic/icoextract/exe-thumbnailer.thumbnailer +++ /dev/null @@ -1,3 +0,0 @@ -[Thumbnailer Entry] -Exec=@out@/bin/exe-thumbnailer -v -s %s %i %o -MimeType=application/x-ms-dos-executable;application/x-dosexec;application/x-msdownload diff --git a/pkgs/by-name/ic/icoextract/package.nix b/pkgs/by-name/ic/icoextract/package.nix index d1f5853385451..99bb229db8985 100644 --- a/pkgs/by-name/ic/icoextract/package.nix +++ b/pkgs/by-name/ic/icoextract/package.nix @@ -1,7 +1,7 @@ { lib, python3Packages, - fetchPypi, + fetchFromGitHub, }: python3Packages.buildPythonApplication rec { @@ -9,10 +9,11 @@ python3Packages.buildPythonApplication rec { version = "0.1.5"; pyproject = true; - src = fetchPypi { - inherit pname version; - extension = "tar.gz"; - hash = "sha256-/UxnWNyRNtwI4Rxx97i5QyjeMrUr5Sq+TfLTmU0xWyc="; + src = fetchFromGitHub { + owner = "jlu5"; + repo = "icoextract"; + rev = version; + hash = "sha256-McVG8966NCEpzc9biawLvUgbQUtterkIud/9GwOeltI="; }; build-system = with python3Packages; [ setuptools ]; @@ -28,8 +29,10 @@ python3Packages.buildPythonApplication rec { pythonImportsCheck = [ "icoextract" ]; postInstall = '' - mkdir -p $out/share/thumbnailers - substituteAll ${./exe-thumbnailer.thumbnailer} $out/share/thumbnailers/exe-thumbnailer.thumbnailer + substituteInPlace exe-thumbnailer.thumbnailer \ + --replace Exec=exe-thumbnailer Exec=$out/bin/exe-thumbnailer + + install -Dm644 exe-thumbnailer.thumbnailer $out/share/thumbnailers ''; meta = with lib; { From 0c5ebda70a44b001aa3caf08f1b51ab6ceddd872 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sun, 19 May 2024 10:15:41 -0400 Subject: [PATCH 3/3] icoextract: set meta.mainProgram --- pkgs/by-name/ic/icoextract/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/ic/icoextract/package.nix b/pkgs/by-name/ic/icoextract/package.nix index 99bb229db8985..2cb81016e56e0 100644 --- a/pkgs/by-name/ic/icoextract/package.nix +++ b/pkgs/by-name/ic/icoextract/package.nix @@ -44,5 +44,6 @@ python3Packages.buildPythonApplication rec { bryanasdev000 donovanglover ]; + mainProgram = "icoextract"; }; }