diff --git a/pkgs/by-name/sh/sherlock/fix-sherlock-bin-test.patch b/pkgs/by-name/sh/sherlock/fix-sherlock-bin-test.patch new file mode 100644 index 000000000000..29bd66bc4d2c --- /dev/null +++ b/pkgs/by-name/sh/sherlock/fix-sherlock-bin-test.patch @@ -0,0 +1,19 @@ +commit 34d1da31d87d90beae1dacd303ab166cecbd2baa +Author: Lein Matsumaru +Date: Tue May 21 12:22:12 2024 +0000 + + b + +diff --git a/tests/sherlock_interactives.py b/tests/sherlock_interactives.py +index d0424af..59c7bd2 100644 +--- a/tests/sherlock_interactives.py ++++ b/tests/sherlock_interactives.py +@@ -10,7 +10,7 @@ class Interactives: + if platform.system == "Windows": + command:str = f"py -m sherlock {args}" + else: +- command:str = f"sherlock {args}" ++ command:str = f"@sherlockBin@ {args}" + + proc_out:str = "" + try: diff --git a/pkgs/tools/security/sherlock/default.nix b/pkgs/by-name/sh/sherlock/package.nix similarity index 57% rename from pkgs/tools/security/sherlock/default.nix rename to pkgs/by-name/sh/sherlock/package.nix index 6ee08c3f3f58..cdf40eacedae 100644 --- a/pkgs/tools/security/sherlock/default.nix +++ b/pkgs/by-name/sh/sherlock/package.nix @@ -3,20 +3,31 @@ , makeWrapper , python3 , unstableGitUpdater +, poetry }: python3.pkgs.buildPythonApplication rec { pname = "sherlock"; - version = "0-unstable-2024-06-04"; - format = "other"; + version = "0-unstable-2024-06-09"; + format = "pyproject"; src = fetchFromGitHub { owner = "sherlock-project"; repo = "sherlock"; - rev = "ef124acf34e90626f4e59ab88bba1ed6141a4126"; - hash = "sha256-haxUKdZuuJrSI4TH8jA1fT+4fhr6tlxnrEgWTuBuIC4="; + rev = "d678908c00f16c7f6c44efc0357cef713fa96739"; + hash = "sha256-XAXDqbdHQta9OiupbPmmyp3TK1VLtDQ7CadsOei/6rs="; }; + patches = [ + # Avoid hardcoding sherlock + ./fix-sherlock-bin-test.patch + ]; + + postPatch = '' + substituteInPlace tests/sherlock_interactives.py \ + --replace @sherlockBin@ "$out/bin/sherlock" + ''; + nativeBuildInputs = [ makeWrapper ]; propagatedBuildInputs = with python3.pkgs; [ @@ -41,24 +52,29 @@ python3.pkgs.buildPythonApplication rec { postFixup = '' makeWrapper ${python3.interpreter} $out/bin/sherlock \ - --add-flags $out/share/sherlock/sherlock.py \ - --prefix PYTHONPATH : "$PYTHONPATH" + --add-flags "-m" \ + --add-flags "sherlock" \ + --prefix PYTHONPATH : "$PYTHONPATH:$out/share" ''; - checkInputs = with python3.pkgs; [ - exrex + nativeCheckInputs = with python3.pkgs; [ + pytestCheckHook + poetry + poetry-core + jsonschema + openpyxl + stem + pythonRelaxDepsHook ]; - checkPhase = '' - runHook preCheck + pythonRelaxDeps = [ + "stem" + ]; - cd $out/share/sherlock - for tests in all test_multiple_usernames; do - ${python3.interpreter} -m unittest tests.$tests --verbose - done - - runHook postCheck - ''; + pytestFlagsArray = [ + "-m" + "'not online'" + ]; passthru.updateScript = unstableGitUpdater { hardcodeZeroVersion = true; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6cfa6a4f74f3..87c4cf2733f8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -30649,8 +30649,6 @@ with pkgs; gjay = callPackage ../applications/audio/gjay { }; - sherlock = callPackage ../tools/security/sherlock { }; - stratovirt = callPackage ../applications/virtualization/stratovirt { }; rhythmbox = callPackage ../applications/audio/rhythmbox { };