summaryrefslogtreecommitdiffstats
path: root/pkgs/development/python-modules/binaryornot/default.nix
blob: 496ffc5747033cb041b04e11b740809cb51e1bd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
  lib,
  buildPythonPackage,
  fetchPypi,
  setuptools,
  chardet,
  hypothesis,
}:

buildPythonPackage (finalAttrs: {
  pname = "binaryornot";
  version = "0.4.4";
  pyproject = true;

  __structuredAttrs = true;

  src = fetchPypi {
    inherit (finalAttrs) pname version;
    hash = "sha256-NZUB38nUBjLtyfrIkOGVQtsaKHu8+lgXW2Zlg5IBgGE=";
  };

  build-system = [ setuptools ];

  prePatch = ''
    # TypeError: binary() got an unexpected keyword argument 'average_size'
    substituteInPlace tests/test_check.py \
      --replace-fail "average_size=512" ""
  '';

  dependencies = [ chardet ];

  nativeCheckInputs = [ hypothesis ];

  pythonImportsCheck = [ "binaryornot" ];

  meta = {
    homepage = "https://github.com/audreyr/binaryornot";
    description = "Ultra-lightweight pure Python package to check if a file is binary or text";
    license = lib.licenses.bsd3;
  };
})