Unverified Commit 2fc48ba8 authored by Fabian Affolter's avatar Fabian Affolter Committed by GitHub
Browse files

Merge pull request #300909 from fabaff/witnessme

witnessme: init at 0-unstable-2023-12-06
parents d9b45d7e 43ad1dc6
Loading
Loading
Loading
Loading
+83 −0
Original line number Diff line number Diff line
{ lib
, fetchFromGitHub
, fetchpatch
, python3
}:

python3.pkgs.buildPythonApplication rec {
  pname = "witnessme";
  version = "0-unstable-2023-12-06";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "byt3bl33d3r";
    repo = "WitnessMe";
    # https://github.com/byt3bl33d3r/WitnessMe/issues/47
    rev = "16d4a377eba653315e827b0af686b948681be301";
    hash = "sha256-CMbeGLwXqpeB31x1j8qU8Bbi3EHEmLokDtqbQER1gEA=";
  };

  patches = [
    # Switch to poetry-core, https://github.com/byt3bl33d3r/WitnessMe/pull/48
    (fetchpatch {
      name = "switch-poetry-core.patch";
      url = "https://github.com/byt3bl33d3r/WitnessMe/commit/147ce9fc7c9ac84712aa1ba2f7073bc2f29c8afe.patch";
      hash = "sha256-ZcIt/ueLgVlZePgxYljRFtvF5t2zlB80HsNyjheCnxI=";
    })
  ];

  pythonRelaxDeps = true;

  nativeBuildInputs = with python3.pkgs; [
    pythonRelaxDepsHook
  ];

  build-system = with python3.pkgs; [
    poetry-core
  ];

  dependencies = with python3.pkgs; [
    aiodns
    aiofiles
    aiosqlite
    fastapi
    imgcat
    jinja2
    lxml
    prompt-toolkit
    pydantic
    pyppeteer
    python-multipart
    pyyaml
    terminaltables
    uvicorn
    xmltodict
  ];

  nativeCheckInputs = with python3.pkgs; [
    httpx
    pytest-asyncio
    pytestCheckHook
    setuptools
  ];

  pythonImportsCheck = [
    "witnessme"
  ];

  disabledTestPaths = [
    # Tests require network access
    "tests/test_api.py"
    "tests/test_grab.py"
    "tests/test_scan.py"
    "tests/test_target_parsing.py"
  ];

  meta = with lib; {
    description = "Web Inventory tool";
    homepage = "https://github.com/byt3bl33d3r/WitnessMe";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ fab ];
    mainProgram = "witnessme";
  };
}
+59 −0
Original line number Diff line number Diff line
{ lib
, buildPythonPackage
, fetchFromGitHub
, matplotlib
, numpy
, pillow
, pytestCheckHook
, pythonOlder
, setuptools
, tensorflow
, torch
, torchvision
}:

buildPythonPackage rec {
  pname = "imgcat";
  version = "0.5.0";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "wookayin";
    repo = "python-imgcat";
    rev = "refs/tags/v${version}";
    hash = "sha256-LFXfCMWMdOjFYhXba9PCCIYnqR7gTRG63NAoC/nD2wk=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail "'pytest-runner<5.0'" ""
  '';

  build-system = [
    setuptools
  ];

  nativeCheckInputs = [
    matplotlib
    numpy
    pillow
    pytestCheckHook
    tensorflow
    torch
    torchvision
  ];

  pythonImportsCheck = [
    "imgcat"
  ];

  meta = with lib; {
    description = "Imgcat in Python";
    homepage = "https://github.com/wookayin/python-imgcat";
    changelog = "https://github.com/wookayin/python-imgcat/releases/tag/v${version}";
    license = licenses.mit;
    maintainers = with maintainers; [ fab ];
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -5645,6 +5645,8 @@ self: super: with self; {
  img2pdf = callPackage ../development/python-modules/img2pdf { };
  imgcat = callPackage ../development/python-modules/imgcat { };
  imgdiff = callPackage ../development/python-modules/imgdiff { };
  imgsize = callPackage ../development/python-modules/imgsize { };