unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Sharlatan Hellseher <sharlatanus@gmail.com>
To: 68650@debbugs.gnu.org
Cc: Sharlatan Hellseher <sharlatanus@gmail.com>,
	Lars-Dominik Braun <lars@6xq.net>, Marius Bakke <marius@gnu.org>,
	Munyoki Kilyungi <me@bonfacemunyoki.com>,
	Sharlatan Hellseher <sharlatanus@gmail.com>,
	jgart <jgart@dismail.de>
Subject: [bug#68650] [PATCH v2 2/2] gnu: python-pyamg: Regenerate bundled files.
Date: Tue, 23 Jan 2024 10:31:37 +0000	[thread overview]
Message-ID: <45dea5104e4c21d970f4ca6366376062e2d95a0d.1706005796.git.sharlatanus@gmail.com> (raw)
In-Reply-To: <9894a20af993d2e79aabba9e05bc0d47d333c3c4.1706005796.git.sharlatanus@gmail.com>

* gnu/packages/python-science.scm (python-pyamg)[source]: Delete
auto-generated files.
[arguments]<#:phases>: Add 'amg-core-bind-them phase to
re-generate *_bind.cpp files deleted in snippet.
[native-inputs]: Add python-cppheaderparser and python-pyyaml.
[description]: Improve style, omit implementation details.

Change-Id: I6f68914cd912e6f4592e51c21b129847e73be847
---
 gnu/packages/python-science.scm | 50 +++++++++++++++++++++++++++------
 1 file changed, 41 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index c1be6cde23..4183bd2ea2 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -465,32 +465,64 @@ (define-public python-pyamg
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pyamg" version))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Delete autogenerated files, regenerate in a phase.
+               #~(begin
+                   (for-each
+                    (lambda (file)
+                      (delete-file (string-append "pyamg/amg_core/" file)))
+                    '("air_bind.cpp"
+                      "evolution_strength_bind.cpp"
+                      "graph_bind.cpp"
+                      "krylov_bind.cpp"
+                      "linalg_bind.cpp"
+                      "relaxation_bind.cpp"
+                      "ruge_stuben_bind.cpp"
+                      "smoothed_aggregation_bind.cpp"
+                      "tests/bind_examples_bind.cpp"))))
               (sha256
                (base32
                 "0l3dliwynxyjvbgpmi2k8jqvkkw6fc00c8w69h6swhrkfh0ql12z"))))
-    (build-system pyproject-build-system)
     (arguments
      (list
       #:test-flags
       ;; Test installed package in order to find C++ modules.
-      #~(list "--pyargs" "pyamg.tests")))
-    (native-inputs (list pybind11 python-pytest python-setuptools-scm))
+      #~(list "--pyargs" "pyamg.tests")
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; Regenerate the autogenerated files.
+          (add-after 'unpack 'amg-core-bind-them
+            (lambda _
+              ;; bindthem.py heavily depends on location to produce *_bind.cpp
+              ;; file, make it available in tests as well.
+              (copy-file "pyamg/amg_core/bindthem.py"
+                         "pyamg/amg_core/tests/bindthem.py")
+              (with-directory-excursion "pyamg/amg_core"
+                (substitute* "bindthem.py"
+                  (("/usr/bin/env python3") (which "python3")))
+                (invoke "sh" "generate.sh"))
+              (with-directory-excursion "pyamg/amg_core/tests"
+                (invoke "python" "bindthem.py" "bind_examples.h")))))))
+    (build-system pyproject-build-system)
+    (native-inputs
+     (list pybind11
+           python-cppheaderparser
+           python-pytest
+           python-pyyaml
+           python-setuptools-scm))
     (propagated-inputs (list python-numpy python-scipy))
     (home-page "https://github.com/pyamg/pyamg")
     (synopsis "Algebraic Multigrid Solvers in Python")
     (description "PyAMG is a Python library of Algebraic Multigrid
-(AMG) solvers.
-
-PyAMG features implementations of:
+(AMG) solvers. It features implementations of:
 @itemize
 @item Ruge-Stuben (RS) or Classical AMG
 @item AMG based on Smoothed Aggregation (SA)
 @item Adaptive Smoothed Aggregation (αSA)
 @item Compatible Relaxation (CR)
 @item Krylov methods such as CG, GMRES, FGMRES, BiCGStab, MINRES, etc.
-@end itemize
-PyAMG is primarily written in Python with supporting C++ code for
-performance critical operations.")
+@end itemize")
     (license license:expat)))
 
 (define-public python-tspex
-- 
2.41.0





  reply	other threads:[~2024-01-23 10:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-21 22:36 [bug#68650] [PATCH 0/2] gnu: python-pyamg: Regenerate bundled files Sharlatan Hellseher
2024-01-21 22:40 ` [bug#68650] [PATCH 1/2] gnu: Add python-cppheaderparser Sharlatan Hellseher
2024-01-21 22:40 ` [bug#68650] [PATCH 2/2] gnu: python-pyamg: Regenerate bundled files Sharlatan Hellseher
2024-01-23 10:31 ` [bug#68650] [PATCH v2 1/2] gnu: Add python-cppheaderparser Sharlatan Hellseher
2024-01-23 10:31   ` Sharlatan Hellseher [this message]
2024-01-28 23:11 ` bug#68650: [PATCH 0/2] gnu: python-pyamg: Regenerate bundled files Sharlatan Hellseher

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=45dea5104e4c21d970f4ca6366376062e2d95a0d.1706005796.git.sharlatanus@gmail.com \
    --to=sharlatanus@gmail.com \
    --cc=68650@debbugs.gnu.org \
    --cc=jgart@dismail.de \
    --cc=lars@6xq.net \
    --cc=marius@gnu.org \
    --cc=me@bonfacemunyoki.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).