summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/unicodeit/default.nix
blob: 31fce854c35f41135a3c1e6d3563fd258ebbae0d (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  pytestCheckHook,
  runCommand,

  setuptools,
  unicodeit,
}:
buildPythonPackage rec {
  pname = "unicodeit";
  version = "0.7.5";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "svenkreiss";
    repo = "unicodeit";
    tag = "v${version}";
    hash = "sha256-NeR3fGDbOzwyq85Sep9KuUiARCvefN6l5xcb8D/ntHE=";
  };

  patches = [
    (fetchpatch {
      # Defines a CLI entry point, so `setuptools` generates an `unicodeit` executable
      url = "https://github.com/svenkreiss/unicodeit/pull/79/commits/9f4a4fee5cb62a101075adf3054832cdb1e6a5ad.patch";
      hash = "sha256-mAhmU17K0adEFFAIf7ZeJ/cNohrzrL+sol7gYfWbPGo=";
    })
  ];

  build-system = [ setuptools ];
  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [
    "unicodeit"
    "unicodeit.cli"
  ];

  passthru.tests.entrypoint =
    runCommand "python3-unicodeit-test-entrypoint"
      {
        nativeBuildInputs = [ unicodeit ];
        preferLocalBuild = true;
      }
      ''
        [[ "$(unicodeit "\BbbR")" = "ℝ" ]]
        touch $out
      '';

  meta = {
    description = "Converts LaTeX tags to unicode";
    mainProgram = "unicodeit";
    homepage = "https://github.com/svenkreiss/unicodeit";
    license = with lib.licenses; [
      lppl13c
      mit
    ];
    maintainers = with lib.maintainers; [ nicoo ];
  };
}