From 77e2055849eefd66545ee315a6da12ce09d0f5e0 Mon Sep 17 00:00:00 2001 From: Harinn Date: Sat, 6 Jun 2026 02:30:23 +0700 Subject: [PATCH 1/2] python3Packages.binaryornot: migrate to pyproject --- pkgs/development/python-modules/binaryornot/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/binaryornot/default.nix b/pkgs/development/python-modules/binaryornot/default.nix index 5cc150c6fa7f..be3650b7ccb4 100644 --- a/pkgs/development/python-modules/binaryornot/default.nix +++ b/pkgs/development/python-modules/binaryornot/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchPypi, + setuptools, chardet, hypothesis, }: @@ -9,20 +10,22 @@ buildPythonPackage rec { pname = "binaryornot"; version = "0.4.4"; - format = "setuptools"; + pyproject = true; src = fetchPypi { inherit pname version; sha256 = "359501dfc9d40632edc9fac890e19542db1a287bbcfa58175b66658392018061"; }; + build-system = [ setuptools ]; + prePatch = '' # TypeError: binary() got an unexpected keyword argument 'average_size' substituteInPlace tests/test_check.py \ --replace "average_size=512" "" ''; - propagatedBuildInputs = [ chardet ]; + dependencies = [ chardet ]; nativeCheckInputs = [ hypothesis ]; From 52991c2d160d8d12821bcf3b8418f11b73706064 Mon Sep 17 00:00:00 2001 From: Harinn Date: Sat, 6 Jun 2026 02:32:18 +0700 Subject: [PATCH 2/2] python3Packages.binaryornot: modernize --- .../python-modules/binaryornot/default.nix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/binaryornot/default.nix b/pkgs/development/python-modules/binaryornot/default.nix index be3650b7ccb4..496ffc574703 100644 --- a/pkgs/development/python-modules/binaryornot/default.nix +++ b/pkgs/development/python-modules/binaryornot/default.nix @@ -7,14 +7,16 @@ hypothesis, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "binaryornot"; version = "0.4.4"; pyproject = true; + __structuredAttrs = true; + src = fetchPypi { - inherit pname version; - sha256 = "359501dfc9d40632edc9fac890e19542db1a287bbcfa58175b66658392018061"; + inherit (finalAttrs) pname version; + hash = "sha256-NZUB38nUBjLtyfrIkOGVQtsaKHu8+lgXW2Zlg5IBgGE="; }; build-system = [ setuptools ]; @@ -22,16 +24,18 @@ buildPythonPackage rec { prePatch = '' # TypeError: binary() got an unexpected keyword argument 'average_size' substituteInPlace tests/test_check.py \ - --replace "average_size=512" "" + --replace-fail "average_size=512" "" ''; dependencies = [ chardet ]; nativeCheckInputs = [ hypothesis ]; + pythonImportsCheck = [ "binaryornot" ]; + meta = { homepage = "https://github.com/audreyr/binaryornot"; description = "Ultra-lightweight pure Python package to check if a file is binary or text"; license = lib.licenses.bsd3; }; -} +})