2023-02-14 15:59:54 +00:00
|
|
|
{ lib
|
2023-02-14 18:16:30 +00:00
|
|
|
, python3Packages
|
2023-02-14 15:59:54 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, godot-server
|
|
|
|
}:
|
2022-02-14 19:34:20 +00:00
|
|
|
|
2023-02-14 18:16:30 +00:00
|
|
|
let lark080 = python3Packages.lark.overrideAttrs (old: rec {
|
2022-02-14 19:34:20 +00:00
|
|
|
# gdtoolkit needs exactly this lark version
|
|
|
|
version = "0.8.0";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lark-parser";
|
|
|
|
repo = "lark";
|
|
|
|
rev = version;
|
2023-02-14 18:16:30 +00:00
|
|
|
hash = "sha256-KN9buVlH8hJ8t0ZP5yefeYM5vH5Gg7a7TEDGKJYpozs=";
|
|
|
|
fetchSubmodules = true;
|
2022-02-14 19:34:20 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
in
|
2023-02-14 18:16:30 +00:00
|
|
|
python3Packages.buildPythonApplication rec {
|
2022-02-14 19:34:20 +00:00
|
|
|
pname = "gdtoolkit";
|
|
|
|
version = "3.3.1";
|
|
|
|
|
|
|
|
# If we try to get using fetchPypi it requires GeoIP (but the package dont has that dep!?)
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Scony";
|
|
|
|
repo = "godot-gdscript-toolkit";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "13nnpwy550jf5qnm9ixpxl1bwfnhhbiys8vqfd25g3aim4bm3gnn";
|
|
|
|
};
|
|
|
|
|
2023-02-14 18:16:30 +00:00
|
|
|
disabled = python3Packages.pythonOlder "3.7";
|
2022-02-14 19:34:20 +00:00
|
|
|
|
2023-02-14 18:16:30 +00:00
|
|
|
propagatedBuildInputs = [ lark080
|
|
|
|
] ++ (with python3Packages; [
|
2023-02-14 15:59:54 +00:00
|
|
|
docopt
|
|
|
|
pyyaml
|
|
|
|
setuptools
|
2023-02-14 18:16:30 +00:00
|
|
|
]);
|
2023-02-14 15:59:54 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2023-02-14 18:16:30 +00:00
|
|
|
nativeCheckInputs = with python3Packages; [
|
2023-02-14 15:59:54 +00:00
|
|
|
pytestCheckHook
|
|
|
|
hypothesis
|
|
|
|
godot-server
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck =
|
|
|
|
let
|
|
|
|
godotServerMajorVersion = lib.versions.major godot-server.version;
|
|
|
|
gdtoolkitMajorVersion = lib.versions.major version;
|
|
|
|
msg = ''
|
|
|
|
gdtoolkit major version ${gdtoolkitMajorVersion} does not match godot-server major version ${godotServerMajorVersion}!
|
|
|
|
gdtoolkit needs a matching godot-server for its tests.
|
|
|
|
If you see this error, you can either:
|
|
|
|
- disable doCheck for gdtoolkit, or
|
|
|
|
- provide a compatible godot-server version to gdtoolkit"
|
|
|
|
'';
|
|
|
|
in lib.throwIf (godotServerMajorVersion != gdtoolkitMajorVersion) msg ''
|
|
|
|
# The tests want to run the installed executables
|
|
|
|
export PATH=$out/bin:$PATH
|
|
|
|
|
|
|
|
# gdtoolkit tries to write cache variables to $HOME/.cache
|
|
|
|
export HOME=$TMP
|
|
|
|
|
|
|
|
# Work around https://github.com/godotengine/godot/issues/20503
|
|
|
|
# Without this, Godot will complain about a missing project file
|
|
|
|
touch project.godot
|
|
|
|
|
|
|
|
# Remove broken test case
|
|
|
|
# (hard to skip via disabledTests since the test name contains an absolute path)
|
|
|
|
rm tests/potential-godot-bugs/multiline-subscription-expression.gd
|
|
|
|
'';
|
|
|
|
|
2022-02-14 19:34:20 +00:00
|
|
|
pythonImportsCheck = [ "gdtoolkit" "gdtoolkit.formatter" "gdtoolkit.linter" "gdtoolkit.parser" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Independent set of tools for working with Godot's GDScript - parser, linter and formatter";
|
|
|
|
homepage = "https://github.com/Scony/godot-gdscript-toolkit";
|
|
|
|
license = licenses.mit;
|
2023-02-14 16:00:20 +00:00
|
|
|
maintainers = with maintainers; [ shiryel tmarkus ];
|
2022-02-14 19:34:20 +00:00
|
|
|
};
|
|
|
|
}
|