diff --git a/pkgs/development/python-modules/samarium/crossandra-2-fix.patch b/pkgs/development/python-modules/samarium/crossandra-2-fix.patch new file mode 100644 index 000000000000..7861ce0611af --- /dev/null +++ b/pkgs/development/python-modules/samarium/crossandra-2-fix.patch @@ -0,0 +1,18 @@ +--- a/src/samarium/tokenizer.py 2024-06-07 13:07:38.731314161 +0200 ++++ b/src/samarium/tokenizer.py 2024-06-07 13:08:11.674488226 +0200 +@@ -26,12 +26,12 @@ + Token, + ignore_whitespace=True, + rules=[ +- Rule(r"==<.*>==", converter=False, flags=re.M | re.S), +- Rule(r"==[^\n]*", converter=False, flags=re.M | re.S), ++ Rule(r"==<.*>==", flags=re.M | re.S, ignore=True), ++ Rule(r"==[^\n]*", flags=re.M | re.S, ignore=True), + Rule( + common.DOUBLE_QUOTED_STRING.pattern, + lambda x: x.replace("\n", r"\n"), +- re.S, ++ flags=re.S, + ), + Rule(rf"{SM_BIT}+`?{SM_BIT}*|`{SM_BIT}*", to_number), + Rule(r"\w+"), diff --git a/pkgs/development/python-modules/samarium/default.nix b/pkgs/development/python-modules/samarium/default.nix new file mode 100644 index 000000000000..a2b637c620a5 --- /dev/null +++ b/pkgs/development/python-modules/samarium/default.nix @@ -0,0 +1,36 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + poetry-core, + crossandra, + dahlia, + pythonRelaxDepsHook +}: + +buildPythonPackage rec { + pname = "samarium"; + version = "0.5.3"; + pyproject = true; + + src = fetchFromGitHub { + owner = "samarium-lang"; + repo = "samarium"; + rev = "refs/tags/${version}"; + hash = "sha256-4WVkTLE6OboNJE/f+6zS3xT1jEHUwV4HSLjl/PBP0FU="; + }; + + build-system = [ poetry-core pythonRelaxDepsHook ]; + dependencies = [ crossandra dahlia ]; + + patches = [ ./crossandra-2-fix.patch ]; + pythonRelaxDeps = [ "crossandra" ]; + + meta = with lib; { + changelog = "https://github.com/samarium-lang/samarium/blob/${src.rev}/CHANGELOG.md"; + description = "The Samarium Programming Language"; + license = licenses.mit; + homepage = "https://samarium-lang.github.io/Samarium"; + maintainers = with maintainers; [ sigmanificient ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index caa6ff3d575e..ee8e71160c75 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13590,6 +13590,8 @@ self: super: with self; { saneyaml = callPackage ../development/python-modules/saneyaml { }; + samarium = callPackage ../development/python-modules/samarium { }; + sampledata = callPackage ../development/python-modules/sampledata { }; samplerate = callPackage ../development/python-modules/samplerate {