1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 pytestCheckHook,
7 runCommand,
8
9 setuptools,
10 unicodeit,
11}:
12buildPythonPackage rec {
13 pname = "unicodeit";
14 version = "0.7.5";
15 pyproject = true;
16
17 src = fetchFromGitHub {
18 owner = "svenkreiss";
19 repo = "unicodeit";
20 tag = "v${version}";
21 hash = "sha256-NeR3fGDbOzwyq85Sep9KuUiARCvefN6l5xcb8D/ntHE=";
22 };
23
24 patches = [
25 (fetchpatch {
26 # Defines a CLI entry point, so `setuptools` generates an `unicodeit` executable
27 url = "https://github.com/svenkreiss/unicodeit/pull/79/commits/9f4a4fee5cb62a101075adf3054832cdb1e6a5ad.patch";
28 hash = "sha256-mAhmU17K0adEFFAIf7ZeJ/cNohrzrL+sol7gYfWbPGo=";
29 })
30 ];
31
32 build-system = [ setuptools ];
33 nativeCheckInputs = [ pytestCheckHook ];
34
35 pythonImportsCheck = [
36 "unicodeit"
37 "unicodeit.cli"
38 ];
39
40 passthru.tests.entrypoint =
41 runCommand "python3-unicodeit-test-entrypoint"
42 {
43 nativeBuildInputs = [ unicodeit ];
44 preferLocalBuild = true;
45 }
46 ''
47 [[ "$(unicodeit "\BbbR")" = "ℝ" ]]
48 touch $out
49 '';
50
51 meta = {
52 description = "Converts LaTeX tags to unicode";
53 mainProgram = "unicodeit";
54 homepage = "https://github.com/svenkreiss/unicodeit";
55 license = with lib.licenses; [
56 lppl13c
57 mit
58 ];
59 maintainers = with lib.maintainers; [ nicoo ];
60 };
61}