From e3305673ad9ce40b64a8374cbe2839d19b13ba5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Thu, 5 Sep 2024 14:30:12 -0700 Subject: [PATCH 1/2] python312Packages.quantities: modernize (cherry picked from commit f55d28642c8f7d2c0ee00bb677de3c205159dea0) --- .../python-modules/quantities/default.nix | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/quantities/default.nix b/pkgs/development/python-modules/quantities/default.nix index 74f28e526ff8..1c0a223c9c3a 100644 --- a/pkgs/development/python-modules/quantities/default.nix +++ b/pkgs/development/python-modules/quantities/default.nix @@ -1,7 +1,7 @@ { lib, buildPythonPackage, - fetchPypi, + fetchFromGitHub, numpy, pytestCheckHook, pythonOlder, @@ -12,21 +12,23 @@ buildPythonPackage rec { pname = "quantities"; version = "0.15.0"; - format = "setuptools"; + pyproject = true; disabled = pythonOlder "3.8"; - src = fetchPypi { - inherit pname version; - hash = "sha256-nqMeKg11F88k1UaxQUbe+SkmOZk6YWzKYbh173lrSys="; + src = fetchFromGitHub { + owner = "python-quantities"; + repo = "python-quantities"; + rev = "refs/tags/v${version}"; + hash = "sha256-N20xfzGtM0VnfkJtzMytNLySTkgVz2xf1nEJxlwBSCI="; }; - nativeBuildInputs = [ + build-system = [ setuptools setuptools-scm ]; - propagatedBuildInputs = [ numpy ]; + dependencies = [ numpy ]; nativeCheckInputs = [ pytestCheckHook ]; From 7e888742d200f38dfd3dbe2a2d320406fc567c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sat, 7 Sep 2024 16:23:11 -0700 Subject: [PATCH 2/2] python312Packages.quantities: prevent arbitrary code eval (cherry picked from commit 131d5e485846b2a10cd89f416a7ae87d9ff4a04d) --- pkgs/development/python-modules/quantities/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/python-modules/quantities/default.nix b/pkgs/development/python-modules/quantities/default.nix index 1c0a223c9c3a..8ed59a545f79 100644 --- a/pkgs/development/python-modules/quantities/default.nix +++ b/pkgs/development/python-modules/quantities/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + fetchpatch2, numpy, pytestCheckHook, pythonOlder, @@ -23,6 +24,14 @@ buildPythonPackage rec { hash = "sha256-N20xfzGtM0VnfkJtzMytNLySTkgVz2xf1nEJxlwBSCI="; }; + patches = [ + (fetchpatch2 { + name = "prevent-arbitrary-code-eval.patch"; + url = "https://github.com/python-quantities/python-quantities/pull/236.patch"; + hash = "sha256-H1tOfXqNMIKY01m6o2PsfZG0CvnWNxW2qIWA5ce1lRk="; + }) + ]; + build-system = [ setuptools setuptools-scm