2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
python,
|
|
|
|
fetchFromGitHub,
|
|
|
|
mkdocs,
|
|
|
|
twine,
|
|
|
|
arpeggio,
|
|
|
|
click,
|
|
|
|
future,
|
|
|
|
setuptools,
|
|
|
|
callPackage,
|
|
|
|
gprof2dot,
|
|
|
|
html5lib,
|
|
|
|
jinja2,
|
|
|
|
psutil,
|
2022-07-18 16:21:45 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
textx = buildPythonPackage rec {
|
|
|
|
pname = "textx";
|
|
|
|
version = "3.0.0";
|
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-uZlO82dKtWQQR5+Q7dWk3+ZoUzAjDJ8qzC4UMLCtnBk=";
|
2022-07-18 16:21:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.cfg --replace "click >=7.0, <8.0" "click >=7.0"
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"testout"
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
mkdocs
|
|
|
|
twine
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
arpeggio
|
|
|
|
click
|
|
|
|
future
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# FileNotFoundError: [Errno 2] No such file or directory: '$out/lib/python3.10/site-packages/textx/textx.tx
|
2022-08-12 12:06:08 +00:00
|
|
|
cp "$src/textx/textx.tx" "$out/${python.sitePackages}/${pname}/"
|
2022-07-18 16:21:45 +00:00
|
|
|
|
|
|
|
# Install tests as the tests output.
|
|
|
|
mkdir $testout
|
|
|
|
cp -r tests $testout/tests
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "textx" ];
|
2022-07-18 16:21:45 +00:00
|
|
|
|
|
|
|
# Circular dependencies, do tests in passthru.tests instead.
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
passthru.tests = {
|
|
|
|
textxTests = callPackage ./tests.nix {
|
|
|
|
inherit
|
|
|
|
textx-data-dsl
|
|
|
|
textx-example-project
|
|
|
|
textx-flow-codegen
|
|
|
|
textx-flow-dsl
|
2024-06-05 15:53:02 +00:00
|
|
|
textx-types-dsl
|
|
|
|
;
|
|
|
|
};
|
2022-07-18 16:21:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Domain-specific languages and parsers in Python";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "textx";
|
2022-07-18 16:21:45 +00:00
|
|
|
homepage = "https://github.com/textx/textx/";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ yuu ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
textx-data-dsl = buildPythonPackage rec {
|
|
|
|
pname = "textx-data-dsl";
|
|
|
|
version = "1.0.0";
|
|
|
|
inherit (textx) src;
|
|
|
|
# `format` isn't included in the output of `mk-python-derivation`.
|
|
|
|
# So can't inherit format: `error: attribute 'format' missing`.
|
|
|
|
format = "setuptools";
|
|
|
|
pathToSourceRoot = "tests/functional/registration/projects/data_dsl";
|
|
|
|
sourceRoot = "${src.name}/" + pathToSourceRoot;
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
textx
|
|
|
|
textx-types-dsl
|
|
|
|
];
|
|
|
|
meta = with lib; {
|
|
|
|
inherit (textx.meta) license maintainers;
|
|
|
|
description = "Sample textX language for testing";
|
|
|
|
homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
textx-flow-codegen = buildPythonPackage rec {
|
|
|
|
pname = "textx-flow-codegen";
|
|
|
|
version = "1.0.0";
|
|
|
|
inherit (textx) src;
|
|
|
|
format = "setuptools";
|
|
|
|
pathToSourceRoot = "tests/functional/registration/projects/flow_codegen";
|
|
|
|
sourceRoot = "${src.name}/" + pathToSourceRoot;
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
click
|
|
|
|
textx
|
|
|
|
];
|
|
|
|
meta = with lib; {
|
|
|
|
inherit (textx.meta) license maintainers;
|
|
|
|
description = "Sample textX language for testing";
|
|
|
|
homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
textx-flow-dsl = buildPythonPackage rec {
|
|
|
|
pname = "textx-flow-dsl";
|
|
|
|
version = "1.0.0";
|
|
|
|
inherit (textx) src;
|
|
|
|
format = "setuptools";
|
|
|
|
pathToSourceRoot = "tests/functional/registration/projects/flow_dsl";
|
|
|
|
sourceRoot = "${src.name}/" + pathToSourceRoot;
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [ textx ];
|
2022-07-18 16:21:45 +00:00
|
|
|
meta = with lib; {
|
|
|
|
inherit (textx.meta) license maintainers;
|
|
|
|
description = "Sample textX language for testing";
|
|
|
|
homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
textx-types-dsl = buildPythonPackage rec {
|
|
|
|
pname = "textx-types-dsl";
|
|
|
|
version = "1.0.0";
|
|
|
|
inherit (textx) src;
|
|
|
|
format = "setuptools";
|
|
|
|
pathToSourceRoot = "tests/functional/registration/projects/types_dsl";
|
|
|
|
sourceRoot = "${src.name}/" + pathToSourceRoot;
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [ textx ];
|
2022-07-18 16:21:45 +00:00
|
|
|
meta = with lib; {
|
|
|
|
inherit (textx.meta) license maintainers;
|
|
|
|
description = "Sample textX language for testing";
|
|
|
|
homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
textx-example-project = buildPythonPackage rec {
|
|
|
|
pname = "textx-example-project";
|
|
|
|
version = "1.0.0";
|
|
|
|
inherit (textx) src;
|
|
|
|
format = "setuptools";
|
|
|
|
pathToSourceRoot = "tests/functional/subcommands/example_project";
|
|
|
|
sourceRoot = "${src.name}/" + pathToSourceRoot;
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [ textx ];
|
2022-07-18 16:21:45 +00:00
|
|
|
meta = with lib; {
|
|
|
|
inherit (textx.meta) license maintainers;
|
|
|
|
description = "Sample textX sub-command for testing";
|
|
|
|
homepage = textx.homepage + "tree/${version}/" + pathToSourceRoot;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
2024-06-05 15:53:02 +00:00
|
|
|
textx
|