gnu: Add python-telingo.

* gnu/packages/patches/python-telingo-fix-comparison.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/maths.scm (python-telingo): New variable.
This commit is contained in:
Liliana Marie Prikler 2022-12-08 09:49:07 +01:00
parent 1339623a42
commit 4f94156452
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87
3 changed files with 43 additions and 0 deletions

View file

@ -1643,6 +1643,7 @@ dist_patch_DATA = \
%D%/packages/patches/python-louvain-fix-test.patch \
%D%/packages/patches/python-random2-getrandbits-test.patch \
%D%/packages/patches/python-poppler-qt5-fix-build.patch \
%D%/packages/patches/python-telingo-fix-comparison.patch \
%D%/packages/patches/python-w3lib-fix-test-failure.patch \
%D%/packages/patches/sdcc-disable-non-free-code.patch \
%D%/packages/patches/sdl-pango-api_additions.patch \

View file

@ -93,6 +93,7 @@ (define-module (gnu packages maths)
#:use-module (guix build-system ocaml)
#:use-module (guix build-system perl)
#:use-module (guix build-system python)
#:use-module (guix build-system pyproject)
#:use-module (guix build-system ruby)
#:use-module (gnu packages algebra)
#:use-module (gnu packages audio)
@ -2718,6 +2719,28 @@ (define-public python-clingo
making it so that you can write @acronym{ASPs, Answer Set Programs} through
Python code.")))
(define-public python-telingo
(package
(name "python-telingo")
(version "2.1.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/potassco/telingo")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(patches (search-patches "python-telingo-fix-comparison.patch"))
(sha256
(base32
"0g3khxfdzc2hc7dkiyyqhb399h6h21m5wkp6wy8w71n0m32fiy53"))))
(build-system pyproject-build-system)
(propagated-inputs (list python-clingo))
(home-page "https://potassco.org/")
(synopsis "Solve dynamic temporal logic programs")
(description "This package provides a system to solve dynamic temporal
logic programs based on clingo.")
(license license:expat)))
(define-public ceres
(package
(name "ceres-solver")

View file

@ -0,0 +1,19 @@
Index: source/telingo/transformers/head.py
===================================================================
--- source.orig/telingo/transformers/head.py
+++ source/telingo/transformers/head.py
@@ -564,10 +564,12 @@ class HeadTransformer:
cond = []
diff = _ast.BinaryOperation(loc, _ast.BinaryOperator.Minus, param, shift)
if lhs.ast_type != _ast.ASTType.SymbolicTerm or lhs.symbol.type != _clingo.SymbolType.Number or lhs.symbol.number > 0:
- cond.append(_ast.Literal(loc, _ast.Sign.NoSign, _ast.Comparison(_ast.ComparisonOperator.LessEqual, lhs, diff)))
+ cond.append(_ast.Literal(loc, _ast.Sign.NoSign,
+ _ast.Comparison(lhs, [_ast.Guard(_ast.ComparisonOperator.LessEqual, diff)])))
if rhs.ast_type != _ast.ASTType.SymbolicTerm or rhs.symbol.type != _clingo.SymbolType.Supremum:
- cond.append(_ast.Literal(loc, _ast.Sign.NoSign, _ast.Comparison(_ast.ComparisonOperator.LessEqual, diff, rhs)))
+ cond.append(_ast.Literal(loc, _ast.Sign.NoSign,
+ _ast.Comparison(diff, [_ast.Guard(_ast.ComparisonOperator.LessEqual, rhs)])))
elems.extend([_ast.ConditionalLiteral(loc, _ast.Literal(loc, _ast.Sign.NoSign, head), cond) for head in heads])