From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id iMY4CmsOdWTfMQAASxT56A (envelope-from ) for ; Mon, 29 May 2023 22:43:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id yBlgCWsOdWQmHAEAG6o9tA (envelope-from ) for ; Mon, 29 May 2023 22:43:23 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9F8053AA3A for ; Mon, 29 May 2023 22:43:22 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3jhv-00071A-IS; Mon, 29 May 2023 16:43:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3jhn-0006wy-Ex for guix-patches@gnu.org; Mon, 29 May 2023 16:43:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q3jhm-0002aR-Vp for guix-patches@gnu.org; Mon, 29 May 2023 16:43:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q3jhm-0007wc-Rs for guix-patches@gnu.org; Mon, 29 May 2023 16:43:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56729] [RFC PATCH v3 31/32] gnu: Add python-sagemath-standard. Resent-From: vicvbcun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 29 May 2023 20:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56729 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56729@debbugs.gnu.org Cc: Andreas Enge Received: via spool by 56729-submit@debbugs.gnu.org id=B56729.168539297130489 (code B ref 56729); Mon, 29 May 2023 20:43:02 +0000 Received: (at 56729) by debbugs.gnu.org; 29 May 2023 20:42:51 +0000 Received: from localhost ([127.0.0.1]:59324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3jha-0007va-ML for submit@debbugs.gnu.org; Mon, 29 May 2023 16:42:51 -0400 Received: from mo4-p05-ob.smtp.rzone.de ([85.215.255.134]:40417) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3jhT-0007vG-Ld for 56729@debbugs.gnu.org; Mon, 29 May 2023 16:42:44 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1685392778; cv=none; d=strato.com; s=strato-dkim-0002; b=o8W+0w7xKDvvvggrISY0IsMpFDq2yQtFpMi3RaBXf1eCni5zhP3gqKKSJep1eOEyZH sc+yfOLOlRYblTjI4ya5akOWJEMhfHJV8gnA8xk/QHIMbAq5VsXM3HG1D/NeFKRGB/Zb c4TCCnakZQffVBBWUDQyeU+2ljJLdnmekO6WNiqdjArA791x14wHV139b8H2lFUB4g5G uDBLtFyrQuZH30UAtlhmOSjNy1Zz9rg1HO7LsPtEnrdTF1NVpopRJLG59oiTwjiFGfY+ iS/CkpX1NXjrkcBGAUOg0Y0Ma5Wud7I71LBMHhEYCMeAfH/ldFPialysKvJ1Ai/pahXm /fxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1685392778; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=boeNIWoCQsvQYuxUjTBbuwP1EONVLFD209FtlWBPfNM=; b=FvNtjmKAjHY4FmhJaMH+r+jpMfLYQfQ4k0aOUJAVGG4cLMsD/ZHUfJ9R5VHv3T+BDL 3YRlsxAwRvnX+bOBhCUdrRjq4EDaC3IaBxPX/oaX7icQE+SW0AnLyxZ8apUbKaKCgC5j wBGmOFU9S+KKveww/+OKTuMtP2qMWnfEExp3pU7J2UheZ/r0BjleUJ3hsqMzmVMZ0ySi 66fDN9fjgbxfpz8VHVGy0p2PSVfyZKzTmSv6qAX9GW5QXszOztQbYRT6gAmE3UQyzNos fdovz9i7Bzp6mNNUaqlWN0UUMI2+UAjfpmmTQ6owCPLwbm9W7zjjI5XwpwyAC0iXMxGT lnfA== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1685392778; s=strato-dkim-0002; d=ikherbers.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=boeNIWoCQsvQYuxUjTBbuwP1EONVLFD209FtlWBPfNM=; b=dpB6gT8g/iGyYuDB1NVaIHb0m9H1g1rFxGhp/I0RhUo6oQ4jqxh/rbk8fsuqA/wlBk W31zJKvdtfmtiEYJuPaaeEMEIetu98rXWRb31xFcBgTJgH3i8ncUn2ICKGsIlses5QG1 UlBW3Tf5FL9GezarkjVEa3LI4CDetIFl3PGO/Ss78/2yJHhwjZqoP1WVHYuHldseqo4z 40rZX4Jzr/zlTg4IctEp6l7b7tHO/wWx/p/e6WvYOZd//OGOV2SPGhAaKNt1u0ggGVsM OSlPbZTp89I08jF60m8nz8A8xeCET/AtbQefl/JKYxBR+1AIBgd4zrXl8EiWPNboZ1q6 wclw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1685392778; s=strato-dkim-0003; d=ikherbers.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=boeNIWoCQsvQYuxUjTBbuwP1EONVLFD209FtlWBPfNM=; b=SRjSmfTvrN3u8TU95AsrphT0il26lYJMIWflyGkcPzPvbQrJnX5379OcmKRiP6SZrl CTFvCkXqbZm/SpSx3XDQ== X-RZG-AUTH: ":IUwNfkitaf3qOWm2b/jA5tveVwUUcwH3PkiYp6DPxTDDEo4xO9KsAGjusLvi119VyBPc" X-RZG-CLASS-ID: mo05 Received: from lambda.localdomain by smtp.strato.de (RZmta 49.4.0 DYNA|AUTH) with ESMTPSA id z055e6z4TKdcn7e (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 29 May 2023 22:39:38 +0200 (CEST) From: vicvbcun Date: Mon, 29 May 2023 22:38:40 +0200 Message-Id: <3cad701f74519f5e7562e45d7a938cf2d7d52ae9.1685391448.git.guix@ikherbers.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=2; s=key1; d=yhetil.org; t=1685393002; a=rsa-sha256; cv=fail; b=qQtyKAK3HokI+TDn4axR/W3zBnJYCRV0aKTlor4UVzbOnSxnIs3cRUgw3gjOcAWWFW2TCi JoGHun494Enx1PWZDk9Izvdi8ocaCTmKw2Gv0SeLAv3epgvXnqTjAt0QI0FDxGhzi4w0+R +q3u4habW+SDuK+uIC8FRcaCzgS568OCBjeSk8V7jxewt9hiNq22kvE/hpiJ80L1Ny2Esn 9TWXxcQ4GDTsMgxc0CElEUpBg6yrWabfEUGdy9kI8we3BzAkRp/Vsg7dTO6iJSCLAROVMv lELdO7vWbiJiod6DfCWqi8/trLpnH+wMUyrpty1vW13oPYAoi/KoV81TcEZ7aA== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=ikherbers.com header.s=strato-dkim-0002 header.b=dpB6gT8g; dkim=fail ("headers eddsa verify failed") header.d=ikherbers.com header.s=strato-dkim-0003 header.b=SRjSmfTv; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; arc=reject ("signature check failed: fail, {[1] = sig:strato.com:reject}") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1685393002; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=boeNIWoCQsvQYuxUjTBbuwP1EONVLFD209FtlWBPfNM=; b=gOj7nRYYXYZfyScuT94n7nxlhwFhuVsmiVsnHAkELnng3GUER+CdgTzQs8tg1MQxzBUYiv rVTF3oNkOXbNzWKW8ToVjn8T2EVUIA+0+1Ez+38DOiIrsKxBOB4YyHhHZF6+lzr0J7Z/w6 zIOnt/S4QmOItfjhuCYu9n7YClr3byJjqAMaSoFcvGWQc7cmgD6rKTBec5PXQymkMjfQH0 cSe9J4TqmRZgzHcMEo63mKSCNYSSN57crPyxZK1zEg81fFQudI1M4UPVE3S7BaLJuPfSx9 zihVsUe9F06pSiBEq2Nd/PbA02IkZxpB/T2ZdRmzcRv64XT0GjNzK8qoOVbnbw== X-Migadu-Spam-Score: 0.89 X-Spam-Score: 0.89 X-Migadu-Queue-Id: 9F8053AA3A X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=ikherbers.com header.s=strato-dkim-0002 header.b=dpB6gT8g; dkim=fail ("headers eddsa verify failed") header.d=ikherbers.com header.s=strato-dkim-0003 header.b=SRjSmfTv; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; arc=reject ("signature check failed: fail, {[1] = sig:strato.com:reject}") X-TUID: ubYFk1Gws5mv * gnu/packages/sagemath.scm (python-sagemath-standard): New variable. --- Notes: sage currently uses python's `sys.prefix' as `SAGE_VENV' (i.e. `/gnu/store/…-python-…' instead of `/gnu/store/…-sagemath-…'), causing a warning to be printed when running as notebook. `sage' unsets the `SAGE_VENV' environment variable and later tests if it is set and if this predictably is not the case uses `sage-venv-config' to determine `SAGE_VENV'. `sage-venv-config' itself uses `sys.prefix' unconditionally as `SAGE_VENV'. Therefore, wrapping `sage' with a the appropriate value for `SAGE_VENV' does not work and would need patching. gnu/packages/sagemath.scm | 199 +++++++++++++++++++++++++++++++++++++- 1 file changed, 198 insertions(+), 1 deletion(-) diff --git a/gnu/packages/sagemath.scm b/gnu/packages/sagemath.scm index dfe5874ed3..4f23a7b7a0 100644 --- a/gnu/packages/sagemath.scm +++ b/gnu/packages/sagemath.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice ;;; Copyright © 2020 Jakub Kądziołka ;;; Copyright © 2021 Efraim Flashner +;;; Copyright © 2023 vicvbcun ;;; ;;; This file is part of GNU Guix. ;;; @@ -25,6 +26,7 @@ (define-module (gnu packages sagemath) #:use-module (guix build-system copy) #:use-module (guix build-system gnu) #:use-module (guix build-system python) + #:use-module (guix build-system pyproject) #:use-module (guix build-system trivial) #:use-module (guix download) #:use-module (guix gexp) @@ -38,13 +40,22 @@ (define-module (gnu packages sagemath) #:use-module (gnu packages bdw-gc) #:use-module (gnu packages boost) #:use-module (gnu packages compression) + #:use-module (gnu packages freedesktop) + #:use-module (gnu packages gd) + #:use-module (gnu packages graph) + #:use-module (gnu packages graphics) + #:use-module (gnu packages guile) #:use-module (gnu packages image) #:use-module (gnu packages lisp) + #:use-module (gnu packages m4) + #:use-module (gnu packages maths) #:use-module (gnu packages multiprecision) #:use-module (gnu packages pkg-config) #:use-module (gnu packages popt) #:use-module (gnu packages python) - #:use-module (gnu packages python-xyz)) + #:use-module (gnu packages python-science) + #:use-module (gnu packages python-xyz) + #:use-module (gnu packages sqlite)) (define-public python-cypari2 @@ -493,3 +504,189 @@ (define-public sagemath-data-polytopes-db (synopsis "Lists of 2- and 3-dimensional reflexive polytopes") (description synopsis) (license #f))) + +(define-public python-sagemath-standard + (package + (name "python-sagemath-standard") + (version "10.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/sagemath/sage") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "01nfpp3zh43kil7pqyrdvxyawmny0sc656kbg833c2l1y6iwppyc")))) + (build-system pyproject-build-system) + (arguments + (list #:tests? #f ; tests are run in the `sagemath' package + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'prepare-build + (lambda _ + (setenv "SAGE_NUM_THREADS" + (number->string (parallel-job-count))) + (setenv "SAGE_VENV" #$output) + + (setenv "PYTHONPATH" (string-append (getcwd) "/pkgs/sage-setup")) + + ;; broken symlink we don't need + (delete-file "pkgs/sage-conf/bin/sage-env-config") + (delete-file "pkgs/sage-conf_pypi/sage_root/configure") + + ;; Run this before 'ensure-no-mtimes-pre-1980 so that there + ;; are no broken symlinks + (with-directory-excursion "build/pkgs/sagelib" + (let + ((original-path (getenv "PATH"))) + (setenv "PATH" (string-append original-path ":../../bin")) + (invoke "sh" "./bootstrap") + (setenv "PATH" original-path))))) + (add-before 'build 'cd-to-src + (lambda _ + (chdir "pkgs/sagemath-standard"))) + ;; `setuptools' replaces shebangs that match `#!.*python.*' by + ;; the intepreter running it. Unfortunately this also matches + ;; `sage-python'. But using `sage-python' prevents a weird bug + ;; where python's `multiprocessing.resource_tracker' would + ;; execute `sage-runtests' instead of `python'. + (add-after 'install 'fix-shebangs + (lambda _ + (let* + ((bin (string-append #$output "/bin")) + (sage-python (string-append bin "/sage-python"))) + (substitute* (find-files bin + ;; don't touch these to prevent cycles + ;; sage-num-threads.py -> sage-env -> sage + ;; sage-venv-config -> sage-python -> sage + (negate + (file-name-predicate (string-join '("^sage-coverage$" + "^sage-num-threads\\.py$" + "^sage-venv-config$") + "|")))) + ;; be careful that we don't substitute the newline + ;; character + (("^#!.*python-toolchain[^\n]*") (string-append "#!" sage-python)))))) + (add-after 'install 'remove-unnecessary-scripts + (lambda _ + (for-each + delete-file + (find-files (string-append #$output "/bin") "^sage-rebase")))) + (replace 'wrap + (lambda* (#:key inputs #:allow-other-keys) + (let* + ((python-path (search-path-as-string->list (getenv "GUIX_PYTHONPATH"))) + (python (dirname (search-input-file inputs "/bin/python3"))) + (coreutils (dirname (search-input-file inputs "/bin/readlink"))) + (sed (dirname (search-input-file inputs "/bin/sed"))) + (xdg-open (dirname (search-input-file inputs "/bin/xdg-open"))) + (maxima-version #$(package-version (this-package-input "maxima"))) + (maxima-fas (search-input-file inputs + (string-append "/lib/maxima/" + maxima-version + "/binary-ecl/maxima.fas"))) + (combinatorial-design (search-input-directory inputs "/share/combinatorial_designs")) + (conway-polynomials (search-input-directory inputs "/share/conway_polynomials")) + (ellcurve (search-input-directory inputs "/share/ellcurves")) + (cremona-mini (search-input-directory inputs "/share/cremona")) + (graphs (search-input-directory inputs "/share/graphs")) + (polytope (search-input-directory inputs "/share/reflexive_polytopes")) + (gap-lib (search-input-directory inputs "/lib/gap")) + (gap-share (search-input-directory inputs "/share/gap"))) + ;; wrap everything possible, all things with shebang + ;; #!*/sage-* are still covered, as sage-* itself will be + ;; wrapped + (for-each + (lambda (file) + (false-if-exception + (wrap-script file + `("GUIX_PYTHONPATH" = ,python-path) + `("PATH" prefix (,(string-append #$output "/bin") ,coreutils ,python ,sed ,xdg-open)) + `("MAXIMA_FAS" = (,maxima-fas)) + `("COMBINATORIAL_DESIGN_DATA_DIR" = (,combinatorial-design)) + `("CONWAY_POLYNOMIALS_DATA_DIR" = (,conway-polynomials)) + `("ELLCURVE_DATA_DIR" = (,ellcurve)) + `("CREMONA_MINI_DATA_DIR" = (,cremona-mini)) + `("GRAPHS_DATA_DIR" = (,graphs)) + `("POLYTOPE_DATA_DIR" = (,polytope)) + `("GAP_LIB_DIR" = (,gap-lib)) + `("GAP_SHARE_DIR" = (,gap-share))))) + (find-files (string-append #$output "/bin"))))))))) + (inputs (list arb + boost + brial + cliquer + coreutils + edge-addition-planarity-suite + gd + givaro + glpk + gmp + guile-3.0 ; for wrap-script + iml + libbraiding + libhomfly + linbox + m4ri + m4rie + mpc + mpfi + python-cypari2 + python-gmpy2 + python-jinja2 + python-jupyter-core + python-memory-allocator + python-numpy + python-pplpy + rw + sagemath-data-combinatorial-designs + sagemath-data-conway-polynomials + sagemath-data-elliptic-curves + sagemath-data-graphs + sagemath-data-polytopes-db + sed + symmetrica + xdg-utils + zlib)) + (native-inputs (list m4 pkg-config python-cython)) + (propagated-inputs (list cddlib + ecl ; also buildtime + eclib ; also buildtime + flint ; also buildtime + gap ; also buildtime + gfan + giac ; also buildtime + gmp-ecm ; also buildtime + gsl ; also buildtime + lcalc ; also buildtime + maxima + mpfr + nauty + ntl ; also buildtime + openblas ; also buildtime + palp + pari-gp ; also buildtime + pkg-config ; also buildtime (native) + python-fpylll + python-ipython + python-ipywidgets + python-lrcalc + python-networkx + python-pkgconfig + python-primecountpy + python-scipy + python-sympy + singular ; also buildtime + sqlite + sympow + tachyon)) + (home-page "https://www.sagemath.org") + (synopsis "Python-based computer algebra system") + (description + "SageMath is a free open-source mathematics software system licensed +under the GPL. It builds on top of many existing open-source packages: NumPy, +SciPy, matplotlib, Sympy, Maxima, GAP, FLINT, R and many more. Access their +combined power through a common, Python-based language or directly via +interfaces or wrappers.") + (license license:gpl3))) -- 2.40.1