diff --git a/pkgs/development/python-modules/androguard/default.nix b/pkgs/development/python-modules/androguard/default.nix index cc1789963e61..c5a4300736ee 100644 --- a/pkgs/development/python-modules/androguard/default.nix +++ b/pkgs/development/python-modules/androguard/default.nix @@ -2,6 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, + setuptools, future, networkx, pygments, @@ -12,11 +13,9 @@ click, pydot, ipython, - packaging, pyqt5, pyperclip, - nose, - nose-timer, + pytestCheckHook, mock, python-magic, codecov, @@ -25,15 +24,16 @@ # This is usually used as a library, and it'd be a shame to force the GUI # libraries to the closure if GUI is not desired. withGui ? false, - # Tests take a very long time, and currently fail, but next release' tests - # shouldn't fail - doCheck ? false, + # Deprecated in 24.11. + doCheck ? true, }: +assert lib.warnIf (!doCheck) "python3Packages.androguard: doCheck is deprecated" true; + buildPythonPackage rec { pname = "androguard"; version = "3.4.0a1"; - format = "setuptools"; + pyproject = true; src = fetchFromGitHub { repo = pname; @@ -42,9 +42,16 @@ buildPythonPackage rec { sha256 = "1aparxiq11y0hbvkayp92w684nyxyyx7mi0n1x6x51g5z6c58vmy"; }; - nativeBuildInputs = [ packaging ] ++ lib.optionals withGui [ qt5.wrapQtAppsHook ]; + patches = [ + ./drop-removed-networkx-formats.patch + ./fix-tests.patch + ]; - propagatedBuildInputs = + build-system = [ setuptools ]; + + nativeBuildInputs = lib.optionals withGui [ qt5.wrapQtAppsHook ]; + + dependencies = [ asn1crypto click @@ -57,29 +64,25 @@ buildPythonPackage rec { pydot pygments ] + ++ networkx.optional-dependencies.default + ++ networkx.optional-dependencies.extra ++ lib.optionals withGui [ pyqt5 pyperclip ]; nativeCheckInputs = [ + pytestCheckHook codecov coverage mock - nose - nose-timer pyperclip pyqt5 python-magic ]; - inherit doCheck; # If it won't be verbose, you'll see nothing going on for a long time. - checkPhase = '' - runHook preCheck - nosetests --verbosity=3 - runHook postCheck - ''; + pytestFlagsArray = [ "--verbose" ]; preFixup = lib.optionalString withGui '' makeWrapperArgs+=("''${qtWrapperArgs[@]}") diff --git a/pkgs/development/python-modules/androguard/drop-removed-networkx-formats.patch b/pkgs/development/python-modules/androguard/drop-removed-networkx-formats.patch new file mode 100644 index 000000000000..214fbaa2dafd --- /dev/null +++ b/pkgs/development/python-modules/androguard/drop-removed-networkx-formats.patch @@ -0,0 +1,14 @@ +diff --git a/androguard/cli/main.py b/androguard/cli/main.py +index 13bc1d0ab7..a79b4fe5fa 100644 +--- a/androguard/cli/main.py ++++ b/androguard/cli/main.py +@@ -110,9 +110,7 @@ + + write_methods = dict(gml=_write_gml, + gexf=nx.write_gexf, +- gpickle=nx.write_gpickle, + graphml=nx.write_graphml, +- yaml=nx.write_yaml, + net=nx.write_pajek, + ) + diff --git a/pkgs/development/python-modules/androguard/fix-tests.patch b/pkgs/development/python-modules/androguard/fix-tests.patch new file mode 100644 index 000000000000..b971b46c6244 --- /dev/null +++ b/pkgs/development/python-modules/androguard/fix-tests.patch @@ -0,0 +1,13 @@ +diff --git a/tests/test_types.py b/tests/test_types.py +index 127dfc20eb..f1c89f0712 100644 +--- a/tests/test_types.py ++++ b/tests/test_types.py +@@ -182,7 +182,7 @@ + for i in filter(lambda x: 'const' in x.get_name(), method.get_instructions()): + i.show(0) + # ins should only have one literal +- self.assertEquals(len(i.get_literals()), 1) ++ self.assertEqual(len(i.get_literals()), 1) + + fmt, value = VALUES[method.full_name].pop(0) + converted = format_value(i.get_literals()[0], i, fmt) diff --git a/pkgs/development/python-modules/nose-timer/default.nix b/pkgs/development/python-modules/nose-timer/default.nix deleted file mode 100644 index a002e6bfb1da..000000000000 --- a/pkgs/development/python-modules/nose-timer/default.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - lib, - buildPythonPackage, - fetchFromGitHub, - nose, - mock, - parameterized, - termcolor, -}: - -buildPythonPackage rec { - pname = "nose-timer"; - version = "1.0.1"; - format = "setuptools"; - - src = fetchFromGitHub { - owner = "mahmoudimus"; - repo = pname; - rev = "v${version}"; - sha256 = "0xsai2l5i1av62y9y0q63wy2zk27klmf2jizgghhxg2y8nfa8x3x"; - }; - - propagatedBuildInputs = [ nose ]; - - nativeCheckInputs = [ - mock - nose - parameterized - termcolor - ]; - - checkPhase = '' - runHook preCheck - nosetests --verbosity 2 tests - runHook postCheck - ''; - - pythonImportsCheck = [ "nosetimer" ]; - - meta = with lib; { - description = "Timer plugin for nosetests"; - homepage = "https://github.com/mahmoudimus/nose-timer"; - license = licenses.mit; - maintainers = with maintainers; [ doronbehar ]; - }; -} diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index ce07a77d3750..3714fbf46677 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -336,6 +336,7 @@ mapAliases ({ nose-randomly = throw "nose-randomly has been removed, it was archived and unmaintained since 2019"; # added 2024-05-22 nose-pattern-exclude = throw "nose-pattern-exclude has been removed as it has been unmaintained since 2014"; # added 2024-07-27 nose_progressive = throw "nose_progressive has been removed, it was using setuptools 2to3 translation feature, which has been removed in setuptools 58"; #added 2023-02-21 + nose-timer = throw "nose-timer has been removed as it depends on the abandoned nose test framework"; # added 2024-07-27 nose-warnings-filters = throw "nose-warnings-filters has been removed as it has been unmaintained since 2016"; # added 2024-07-27 nose_warnings_filters = nose-warnings-filters; # added 2024-01-07 notifymuch = throw "notifymuch has been promoted to a top-level attribute name: `pkgs.notifymuch`"; # added 2022-10-02 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 3612350a139c..036efa9be5ec 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9120,8 +9120,6 @@ self: super: with self; { nose3 = callPackage ../development/python-modules/nose3 { }; - nose-timer = callPackage ../development/python-modules/nose-timer { }; - nose-xunitmp = callPackage ../development/python-modules/nose-xunitmp { }; notebook = callPackage ../development/python-modules/notebook { };