diff --git a/pkgs/development/python-modules/js2py/default.nix b/pkgs/development/python-modules/js2py/default.nix new file mode 100644 index 000000000000..c47e6aee0bbd --- /dev/null +++ b/pkgs/development/python-modules/js2py/default.nix @@ -0,0 +1,37 @@ +{ lib +, fetchFromGitHub +, buildPythonPackage +, tzlocal +, six +, pyjsparser +}: + +buildPythonPackage rec { + pname = "js2py"; + version = "0.71"; + + src = fetchFromGitHub { + owner = "PiotrDabkowski"; + repo = "Js2Py"; + rev = "5f665f60083a9796ec33861240ce31d6d2b844b6"; + sha256 = "sha256-1omTV7zkYSQfxhkNgI4gtXTenWt9J1r3VARRHoRsSfc="; + }; + + propagatedBuildInputs = [ + pyjsparser + six + tzlocal + ]; + + # Test require network connection + doCheck = false; + + pythonImportsCheck = [ "js2py" ]; + + meta = with lib; { + description = "JavaScript to Python Translator & JavaScript interpreter written in 100% pure Python"; + homepage = "https://github.com/PiotrDabkowski/Js2Py"; + license = licenses.mit; + maintainers = with maintainers; [ onny ]; + }; +} diff --git a/pkgs/development/python-modules/lark/default.nix b/pkgs/development/python-modules/lark/default.nix index 8fc32539d69d..62123032a5d4 100644 --- a/pkgs/development/python-modules/lark/default.nix +++ b/pkgs/development/python-modules/lark/default.nix @@ -4,6 +4,7 @@ , python , regex , pytestCheckHook +, js2py }: buildPythonPackage rec { @@ -27,10 +28,9 @@ buildPythonPackage rec { "lark.grammars" ]; - checkInputs = [ pytestCheckHook ]; - - disabledTestPaths = [ - "tests/test_nearley/test_nearley.py" # requires unpackaged Js2Py library + checkInputs = [ + js2py + pytestCheckHook ]; meta = with lib; { diff --git a/pkgs/development/python-modules/pyjsparser/default.nix b/pkgs/development/python-modules/pyjsparser/default.nix new file mode 100644 index 000000000000..0f2ddf62f1a8 --- /dev/null +++ b/pkgs/development/python-modules/pyjsparser/default.nix @@ -0,0 +1,36 @@ +{ lib +, fetchFromGitHub +, buildPythonPackage +, pytestCheckHook +, js2py +}: + +let pyjsparser = buildPythonPackage rec { + pname = "pyjsparser"; + version = "2.7.1"; + + src = fetchFromGitHub { + owner = "PiotrDabkowski"; + repo = pname; + rev = "5465d037b30e334cb0997f2315ec1e451b8ad4c1"; + sha256 = "sha256-Hqay9/qsjUfe62U7Q79l0Yy01L2Bnj5xNs6427k3Br8="; + }; + + checkInputs = [ pytestCheckHook js2py ]; + + # escape infinite recursion with js2py + doCheck = false; + + passthru.tests = { + check = pyjsparser.overridePythonAttrs (_: { doCheck = true; }); + }; + + pythonImportsCheck = [ "pyjsparser" ]; + + meta = with lib; { + description = "Fast javascript parser (based on esprima.js)"; + homepage = "https://github.com/PiotrDabkowski/pyjsparser"; + license = licenses.mit; + maintainers = with maintainers; [ onny ]; + }; +}; in pyjsparser diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 057fadf1ccad..966b39df278a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4681,6 +4681,8 @@ in { inherit (pkgs) jq; }; + js2py = callPackage ../development/python-modules/js2py { }; + jsbeautifier = callPackage ../development/python-modules/jsbeautifier { }; jschema-to-python = callPackage ../development/python-modules/jschema-to-python { }; @@ -7740,6 +7742,8 @@ in { pyjson5 = callPackage ../development/python-modules/pyjson5 { }; + pyjsparser = callPackage ../development/python-modules/pyjsparser { }; + pyjwkest = callPackage ../development/python-modules/pyjwkest { }; pyjwt = callPackage ../development/python-modules/pyjwt { };