diff --git a/pkgs/development/python-modules/jproperties/default.nix b/pkgs/development/python-modules/jproperties/default.nix new file mode 100644 index 000000000000..0089e153f4f3 --- /dev/null +++ b/pkgs/development/python-modules/jproperties/default.nix @@ -0,0 +1,59 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pytestCheckHook +, six +, pytest-datadir +, setuptools-scm +}: + +buildPythonPackage rec { + pname = "jproperties"; + version = "2.1.1"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "Tblue"; + repo = "python-jproperties"; + rev = "v${version}"; + sha256 = "sha256-O+ALeGHMNjW1dc9IRyLzO81k8DW2vbGjuZqXxgrhYjo="; + }; + + SETUPTOOLS_SCM_PRETEND_VERSION = version; + + nativeBuildInputs = [ + setuptools-scm + ]; + + propagatedBuildInputs = [ + six + ]; + + checkInputs = [ + pytest-datadir + pytestCheckHook + ]; + + postPatch = '' + substituteInPlace setup.py \ + --replace "setuptools_scm ~= 3.3" "setuptools_scm" + substituteInPlace pytest.ini \ + --replace "--cov=jproperties --cov-report=term --cov-report=html --cov-branch" "" + ''; + + disabledTestPaths = [ + # TypeError: 'PosixPath' object... + "tests/test_simple_utf8.py" + ]; + + pythonImportsCheck = [ + "jproperties" + ]; + + meta = with lib; { + description = "Java Property file parser and writer for Python"; + homepage = "https://github.com/Tblue/python-jproperties"; + license = with licenses; [ bsd3 ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/luhn/default.nix b/pkgs/development/python-modules/luhn/default.nix new file mode 100644 index 000000000000..09ab90a3b177 --- /dev/null +++ b/pkgs/development/python-modules/luhn/default.nix @@ -0,0 +1,36 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "luhn"; + version = "0.2.0"; + + src = fetchFromGitHub { + owner = "mmcloughlin"; + repo = pname; + rev = version; + sha256 = "sha256-ZifaCjOVhWdXuzi5n6V+6eVN5vrEHKgUdpSOXoMyR18="; + }; + + checkInputs = [ + pytestCheckHook + ]; + + pytestFlagsArray = [ + "test.py" + ]; + + pythonImportsCheck = [ + "luhn" + ]; + + meta = with lib; { + description = "Python module for generate and verify Luhn check digits"; + homepage = "https://github.com/mmcloughlin/luhn"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/tools/security/whispers/default.nix b/pkgs/tools/security/whispers/default.nix new file mode 100644 index 000000000000..07c1f1e707e4 --- /dev/null +++ b/pkgs/tools/security/whispers/default.nix @@ -0,0 +1,52 @@ +{ lib +, fetchFromGitHub +, python3 +}: + +python3.pkgs.buildPythonApplication rec { + pname = "whispers"; + version = "1.5.3"; + + src = fetchFromGitHub { + owner = "Skyscanner"; + repo = pname; + rev = version; + sha256 = "sha256-jruUGyoZCyMu015QKtlvfx5WRMfxo/eYUue9wUIWb6o="; + }; + + propagatedBuildInputs = with python3.pkgs; [ + astroid + beautifulsoup4 + jproperties + luhn + lxml + python-Levenshtein + pyyaml + ]; + + checkInputs = with python3.pkgs; [ + pytest-mock + pytestCheckHook + ]; + + postPatch = '' + substituteInPlace setup.py \ + --replace '"pytest-runner"' "" + ''; + + preCheck = '' + # Some tests need the binary available in PATH + export PATH=$out/bin:$PATH + ''; + + pythonImportsCheck = [ + "whispers" + ]; + + meta = with lib; { + description = "Tool to identify hardcoded secrets in static structured text"; + homepage = "https://github.com/Skyscanner/whispers"; + license = with licenses; [ asl20 ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d1d649aaf8c2..e6a7a952d3a0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -29161,6 +29161,8 @@ with pkgs; wafw00f = python3Packages.callPackage ../tools/security/wafw00f { }; + whispers = callPackage ../tools/security/whispers { }; + waon = callPackage ../applications/audio/waon { }; w3m = callPackage ../applications/networking/browsers/w3m { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 16587d9c8f36..d7c600001af8 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4059,6 +4059,8 @@ in { inherit (self) systemd pytest; }; + jproperties = callPackage ../development/python-modules/jproperties { }; + jpylyzer = callPackage ../development/python-modules/jpylyzer { }; JPype1 = callPackage ../development/python-modules/JPype1 { }; @@ -4619,6 +4621,8 @@ in { luftdaten = callPackage ../development/python-modules/luftdaten { }; + luhn = callPackage ../development/python-modules/luhn { }; + luxor = callPackage ../development/python-modules/luxor { }; luxtronik = callPackage ../development/python-modules/luxtronik { };