summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/dukpy/default.nix
blob: b3be6438855e85e1b8e6dc9c361d5b863cb9f003 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{
  lib,
  stdenv,
  fetchFromGitHub,
  buildPythonPackage,
  setuptools,
  mutf8,
  webassets,
  pytestCheckHook,
  mock,
}:

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

  src = fetchFromGitHub {
    owner = "amol-";
    repo = "dukpy";
    tag = version;
    hash = "sha256-5+SdGHYBron6EwpCf5ByaK8KuqQXhvN73wQUptvgPzc=";
  };

  postPatch = ''
    substituteInPlace tests/test_webassets_filter.py \
      --replace-fail "class PyTestTemp" "class _Temp" \
      --replace-fail "PyTestTemp" "Temp"
  '';

  build-system = [ setuptools ];

  dependencies = [ mutf8 ];

  optional-dependencies = {
    webassets = [ webassets ];
  };

  nativeCheckInputs = [
    pytestCheckHook
    mock
  ]
  ++ optional-dependencies.webassets;

  disabledTests = [ "test_installer" ];

  preCheck = ''
    rm -r dukpy
  '';

  pythonImportsCheck = [ "dukpy" ];

  meta = {
    description = "Simple JavaScript interpreter for Python";
    homepage = "https://github.com/amol-/dukpy";
    changelog = "https://github.com/amol-/dukpy/releases/tag/${src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ ruby0b ];
    mainProgram = "dukpy";
    # error: 'TARGET_OS_BRIDGE' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
    # https://github.com/amol-/dukpy/issues/82
    broken = stdenv.cc.isClang;
  };
}