all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: 59896@debbugs.gnu.org
Subject: [bug#59896] [PATCH 5/5] gnu: Add python-telingo.
Date: Thu, 8 Dec 2022 09:49:07 +0100	[thread overview]
Message-ID: <1da46d86f9d5850afe7f8f14070a3c025dbae3f7.camel@gmail.com> (raw)
In-Reply-To: <dc4bd56c84e4656c5603fd66eeff80dbdf3de487.camel@gmail.com>

* 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.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/maths.scm                        | 23 +++++++++++++++++++
 .../python-telingo-fix-comparison.patch       | 19 +++++++++++++++
 3 files changed, 43 insertions(+)
 create mode 100644 gnu/packages/patches/python-telingo-fix-comparison.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 3329801fa6..0ada842407 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1644,6 +1644,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		\
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 4f057820f0..23c886dfdb 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -92,6 +92,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)
@@ -2717,6 +2718,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")
diff --git a/gnu/packages/patches/python-telingo-fix-comparison.patch b/gnu/packages/patches/python-telingo-fix-comparison.patch
new file mode 100644
index 0000000000..6d05048dcb
--- /dev/null
+++ b/gnu/packages/patches/python-telingo-fix-comparison.patch
@@ -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])
+ 
-- 
2.38.1





  parent reply	other threads:[~2022-12-08 10:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08  8:54 [bug#59896] [PATCH 0/5] Update clingo and add telingo Liliana Marie Prikler
2022-12-08  8:31 ` [bug#59896] [PATCH 1/5] gnu: Add catch2-3.1 Liliana Marie Prikler
2022-12-08  8:33 ` [bug#59896] [PATCH 2/5] gnu: clingo: Update to 5.6.2 Liliana Marie Prikler
2022-12-08  8:47 ` [bug#59896] [PATCH 3/5] gnu: clingo: Use G-Expressions Liliana Marie Prikler
2022-12-08  8:48 ` [bug#59896] [PATCH 4/5] gnu: Add python-clingo Liliana Marie Prikler
2022-12-08  8:49 ` Liliana Marie Prikler [this message]
2022-12-15 16:00   ` bug#59896: [PATCH 5/5] gnu: Add python-telingo Liliana Marie Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1da46d86f9d5850afe7f8f14070a3c025dbae3f7.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=59896@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.