From patchwork Sat Mar 2 18:40:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Troy Figiel X-Patchwork-Id: 61298 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 98F8C27BBEA; Sat, 2 Mar 2024 18:49:52 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 928A427BBE2 for ; Sat, 2 Mar 2024 18:49:51 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rgUQU-0004lK-Fk; Sat, 02 Mar 2024 13:49:38 -0500 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 1rgUQQ-0004kq-7H for guix-patches@gnu.org; Sat, 02 Mar 2024 13:49:34 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rgUQP-0002ac-VD for guix-patches@gnu.org; Sat, 02 Mar 2024 13:49:33 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rgUQs-00075L-EQ for guix-patches@gnu.org; Sat, 02 Mar 2024 13:50:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68721] [PATCH 1/2] gnu: Add python-cramjam. References: <87le8dgjyu.fsf@troyfigiel.com> In-Reply-To: <87le8dgjyu.fsf@troyfigiel.com> Resent-From: Troy Figiel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 02 Mar 2024 18:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68721 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68721@debbugs.gnu.org Received: via spool by 68721-submit@debbugs.gnu.org id=B68721.170940536927168 (code B ref 68721); Sat, 02 Mar 2024 18:50:02 +0000 Received: (at 68721) by debbugs.gnu.org; 2 Mar 2024 18:49:29 +0000 Received: from localhost ([127.0.0.1]:39370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rgUQK-000747-Qi for submit@debbugs.gnu.org; Sat, 02 Mar 2024 13:49:29 -0500 Received: from mout-p-201.mailbox.org ([80.241.56.171]:36888) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rgUQI-00073F-Ab for 68721@debbugs.gnu.org; Sat, 02 Mar 2024 13:49:27 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4TnDVr2XF9z9t0C for <68721@debbugs.gnu.org>; Sat, 2 Mar 2024 19:48:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=troyfigiel.com; s=MBO0001; t=1709405300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hUQxsBgsz+E1FJjYZksxD97udWTTTKS64VJhz02Hru0=; b=ols+e5aZ7V/fPaGaOHPKKqoow5mWpeLvON45744N8FbXn3uNjU9H3zOpuzp6AiUUKlsyTr MQONFjXQL+i2BufpNDHYGHCycD7/mKUWW9SFUAosBJopoOWi4sHd3+ld7c+Ookoj7lDW9r kjWCcqJkD+C1Mzbt5mSi8jaGF/QokzrlyfHFV/Zs2mG4LPDIyTKqec14Khfk7MwIEKGXIY CtkQa6VmT7EBBuV9zb5h/LqJOmDmUHcPyDSzJgf5EYGsim5dI+6U5NUGnngs+Q8Vnj0auz dYGez1IuLdM+Zhd4cRLrFV52GQuJijt0la5gDZ5CZKp+7wnYr6pJ3tO+8LmVrA== From: Troy Figiel Date: Sat, 2 Mar 2024 19:40:21 +0100 Message-ID: <87zfvgpj0s.fsf@troyfigiel.com> MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/python-compression.scm (python-cramjam): New variable. --- gnu/packages/python-compression.scm | 80 ++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/gnu/packages/python-compression.scm b/gnu/packages/python-compression.scm index 6f249dd3af..691fbd3065 100644 --- a/gnu/packages/python-compression.scm +++ b/gnu/packages/python-compression.scm @@ -7,7 +7,7 @@ ;;; Copyright © 2020 Nicolas Goaziou ;;; Copyright © 2020, 2022, 2023 Marius Bakke ;;; Copyright © 2021 Brendan Tildesley -;;; Copyright © 2023 Troy Figiel +;;; Copyright © 2023, 2024 Troy Figiel ;;; ;;; This file is part of GNU Guix. ;;; @@ -30,12 +30,14 @@ (define-module (gnu packages python-compression) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix gexp) + #:use-module (guix build-system cargo) #:use-module (guix build-system gnu) #:use-module (guix build-system python) #:use-module (guix build-system pyproject) #:use-module (gnu packages) #:use-module (gnu packages libffi) #:use-module (gnu packages compression) + #:use-module (gnu packages crates-io) #:use-module (gnu packages check) #:use-module (gnu packages maths) #:use-module (gnu packages pkg-config) @@ -44,6 +46,7 @@ (define-module (gnu packages python-compression) #:use-module (gnu packages python-check) #:use-module (gnu packages python-crypto) #:use-module (gnu packages python-xyz) + #:use-module (gnu packages rust-apps) #:use-module (gnu packages sphinx)) (define-public python-multivolumefile @@ -73,6 +76,81 @@ (define-public python-multivolumefile were a single file.") (license license:lgpl2.1+))) +(define-public python-cramjam + (package + (name "python-cramjam") + (version "2.7.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "cramjam" version)) + (sha256 + (base32 "1b69qlr0q7q3spa7zy55xc1dr5pjgsdavxx8ijhv2j60xqjbg7sp")))) + (build-system cargo-build-system) + (arguments + (list + #:imported-modules `(,@%cargo-build-system-modules + ,@%pyproject-build-system-modules) + #:modules '((guix build cargo-build-system) + ((guix build pyproject-build-system) + #:prefix py:) + (guix build utils)) + #:phases #~(modify-phases %standard-phases + ;; We use Maturin to build the project. + (replace 'build + (assoc-ref py:%standard-phases + 'build)) + ;; Before being able to run Python tests, we need to + ;; install the module and add it to PYTHONPATH. + (delete 'install) + (add-after 'build 'install + (assoc-ref py:%standard-phases + 'install)) + (add-after 'install 'add-install-to-pythonpath + (assoc-ref py:%standard-phases + 'add-install-to-pythonpath)) + ;; Finally run the tests. Only Python tests are provided. + (replace 'check + (lambda* (#:key tests? inputs outputs #:allow-other-keys) + (when tests? + ;; Without the CI variable, tests are run in "local" + ;; mode, which sets a deadline for hypothesis. For a + ;; deterministic build, we need to set CI. + (setenv "CI" "1") + (invoke "pytest" "-vv" "tests"))))) + #:cargo-inputs `(("rust-brotli" ,rust-brotli-3) + ("rust-bzip2" ,rust-bzip2-0.4) + ("rust-flate2" ,rust-flate2-1) + ("rust-lz4" ,rust-lz4-1) + ("rust-pyo3" ,rust-pyo3-0.18) + ("rust-snap" ,rust-snap-1) + ("rust-zstd" ,rust-zstd-0.11)) + #:install-source? #f)) + (native-inputs (list maturin + python-pytest + python-pytest-xdist + python-numpy + python-hypothesis + python-wrapper)) + (home-page "https://github.com/milesgranger/cramjam") + (synopsis "Python bindings to compression algorithms in Rust") + (description + "This package provides thin Python bindings to compression and +decomporession algorithms implemented in Rust. This allows for using +algorithms such as Snappy without additional system dependencies. The +following algorithms are available: + +@itemize +@item Snappy +@item Brotli +@item Bzip2 +@item LZ4 +@item Gzip +@item Deflate +@item Zstd +@end itemize") + (license license:expat))) + (define-public python-pybcj (package (name "python-pybcj")