at 23.05-pre 4.6 kB view raw
1{ lib 2, buildPythonPackage 3, python 4, fetchFromGitHub 5, mkdocs 6, twine 7, arpeggio 8, click 9, future 10, setuptools 11, callPackage 12, gprof2dot 13, html5lib 14, jinja2 15, memory_profiler 16, psutil 17, pytestCheckHook 18}: 19 20let 21 textx = buildPythonPackage rec { 22 pname = "textx"; 23 version = "3.0.0"; 24 format = "setuptools"; 25 26 src = fetchFromGitHub { 27 owner = pname; 28 repo = pname; 29 rev = version; 30 sha256 = "sha256-uZlO82dKtWQQR5+Q7dWk3+ZoUzAjDJ8qzC4UMLCtnBk="; 31 }; 32 33 postPatch = '' 34 substituteInPlace setup.cfg --replace "click >=7.0, <8.0" "click >=7.0" 35 ''; 36 37 outputs = [ 38 "out" 39 "testout" 40 ]; 41 42 nativeBuildInputs = [ 43 mkdocs 44 twine 45 ]; 46 47 propagatedBuildInputs = [ 48 arpeggio 49 click 50 future 51 setuptools 52 ]; 53 54 postInstall = '' 55 # FileNotFoundError: [Errno 2] No such file or directory: '$out/lib/python3.10/site-packages/textx/textx.tx 56 cp "$src/textx/textx.tx" "$out/${python.sitePackages}/${pname}/" 57 58 # Install tests as the tests output. 59 mkdir $testout 60 cp -r tests $testout/tests 61 ''; 62 63 pythonImportsCheck = [ 64 "textx" 65 ]; 66 67 # Circular dependencies, do tests in passthru.tests instead. 68 doCheck = false; 69 70 passthru.tests = { 71 textxTests = callPackage ./tests.nix { 72 inherit 73 textx-data-dsl 74 textx-example-project 75 textx-flow-codegen 76 textx-flow-dsl 77 textx-types-dsl; 78 }; 79 }; 80 81 meta = with lib; { 82 description = "Domain-specific languages and parsers in Python"; 83 homepage = "https://github.com/textx/textx/"; 84 license = licenses.mit; 85 maintainers = with maintainers; [ yuu ]; 86 }; 87 }; 88 89 textx-data-dsl = buildPythonPackage rec { 90 pname = "textx-data-dsl"; 91 version = "1.0.0"; 92 inherit (textx) src; 93 # `format` isn't included in the output of `mk-python-derivation`. 94 # So can't inherit format: `error: attribute 'format' missing`. 95 format = "setuptools"; 96 pathToSourceRoot = "tests/functional/registration/projects/data_dsl"; 97 sourceRoot = "${src.name}/" + pathToSourceRoot; 98 propagatedBuildInputs = [ 99 textx 100 textx-types-dsl 101 ]; 102 meta = with lib; { 103 inherit (textx.meta) license maintainers; 104 description = "Sample textX language for testing"; 105 homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; 106 }; 107 }; 108 109 textx-flow-codegen = buildPythonPackage rec { 110 pname = "textx-flow-codegen"; 111 version = "1.0.0"; 112 inherit (textx) src; 113 format = "setuptools"; 114 pathToSourceRoot = "tests/functional/registration/projects/flow_codegen"; 115 sourceRoot = "${src.name}/" + pathToSourceRoot; 116 propagatedBuildInputs = [ 117 click 118 textx 119 ]; 120 meta = with lib; { 121 inherit (textx.meta) license maintainers; 122 description = "Sample textX language for testing"; 123 homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; 124 }; 125 }; 126 127 textx-flow-dsl = buildPythonPackage rec { 128 pname = "textx-flow-dsl"; 129 version = "1.0.0"; 130 inherit (textx) src; 131 format = "setuptools"; 132 pathToSourceRoot = "tests/functional/registration/projects/flow_dsl"; 133 sourceRoot = "${src.name}/" + pathToSourceRoot; 134 propagatedBuildInputs = [ 135 textx 136 ]; 137 meta = with lib; { 138 inherit (textx.meta) license maintainers; 139 description = "Sample textX language for testing"; 140 homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; 141 }; 142 }; 143 144 textx-types-dsl = buildPythonPackage rec { 145 pname = "textx-types-dsl"; 146 version = "1.0.0"; 147 inherit (textx) src; 148 format = "setuptools"; 149 pathToSourceRoot = "tests/functional/registration/projects/types_dsl"; 150 sourceRoot = "${src.name}/" + pathToSourceRoot; 151 propagatedBuildInputs = [ 152 textx 153 ]; 154 meta = with lib; { 155 inherit (textx.meta) license maintainers; 156 description = "Sample textX language for testing"; 157 homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; 158 }; 159 }; 160 161 textx-example-project = buildPythonPackage rec { 162 pname = "textx-example-project"; 163 version = "1.0.0"; 164 inherit (textx) src; 165 format = "setuptools"; 166 pathToSourceRoot = "tests/functional/subcommands/example_project"; 167 sourceRoot = "${src.name}/" + pathToSourceRoot; 168 propagatedBuildInputs = [ 169 textx 170 ]; 171 meta = with lib; { 172 inherit (textx.meta) license maintainers; 173 description = "Sample textX sub-command for testing"; 174 homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot; 175 }; 176 }; 177in 178 textx