From patchwork Thu Apr 25 15:59:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicolas Graves X-Patchwork-Id: 63364 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 866AC27BBE2; Thu, 25 Apr 2024 17:01:19 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable 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 9882527BBE9 for ; Thu, 25 Apr 2024 17:01:17 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s01Wk-0002E2-Tf; Thu, 25 Apr 2024 12:00:50 -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 1s01Wi-0002D2-Bl for guix-patches@gnu.org; Thu, 25 Apr 2024 12:00:48 -0400 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 1s01Wi-0003mL-2S for guix-patches@gnu.org; Thu, 25 Apr 2024 12:00:48 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s01Wz-0007ct-Mg for guix-patches@gnu.org; Thu, 25 Apr 2024 12:01:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70570] [PATCH 1/2] guix: import: pypi: Ignore pypi-ignored-inputs. References: <20240425155529.30747-1-ngraves@ngraves.fr> In-Reply-To: <20240425155529.30747-1-ngraves@ngraves.fr> Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 25 Apr 2024 16:01:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70570 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70570@debbugs.gnu.org Cc: ngraves@ngraves.fr Received: via spool by 70570-submit@debbugs.gnu.org id=B70570.171406084729094 (code B ref 70570); Thu, 25 Apr 2024 16:01:05 +0000 Received: (at 70570) by debbugs.gnu.org; 25 Apr 2024 16:00:47 +0000 Received: from localhost ([127.0.0.1]:33138 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s01Wb-0007Y9-HC for submit@debbugs.gnu.org; Thu, 25 Apr 2024 12:00:46 -0400 Received: from 5.mo560.mail-out.ovh.net ([87.98.181.248]:41125) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s01WV-0007WV-BU for 70570@debbugs.gnu.org; Thu, 25 Apr 2024 12:00:39 -0400 Received: from director5.ghost.mail-out.ovh.net (unknown [10.109.139.129]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id 4VQLCz06RDz1Zs5 for <70570@debbugs.gnu.org>; Thu, 25 Apr 2024 16:00:14 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-vpbkv (unknown [10.110.96.9]) by director5.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 90BBB1FE5E; Thu, 25 Apr 2024 16:00:14 +0000 (UTC) Received: from ngraves.fr ([37.59.142.109]) by ghost-submission-6684bf9d7b-vpbkv with ESMTPSA id SVMnHA5+KmYuIAEABnI3AA (envelope-from ); Thu, 25 Apr 2024 16:00:14 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-109S0037da76618-70fc-49d8-b0bc-befd460d2feb, AD8D7EE5F14CB41C4DCF674C83E011AE46681836) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 80.215.5.23 Date: Thu, 25 Apr 2024 17:59:45 +0200 Message-ID: <20240425160010.6243-1-ngraves@ngraves.fr> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Ovh-Tracer-Id: 9083197499245978338 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrudeljedgleeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffogggtgfesthekredtredtjeenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeegtdekudeuveeuteegueevffetieegtefgjedtudetgeeigfeuueeftdeiveetgfenucffohhmrghinhepphihphhirdhorhhgnecukfhppeduvdejrddtrddtrddupdektddrvdduhedrhedrvdefpdefjedrheelrddugedvrddutdelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopeejtdehjedtseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehiedtpdhmohguvgepshhmthhpohhuth 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: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches X-Patchwork-Original-From: Nicolas Graves via Guix-patches via From: Nicolas Graves 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 * guix/import/pypi.scm (pypi-ignored-inputs): New variable. (compute-inputs): Use it. * tests/pypi.scm (parse-requires.txt): Add ignored input to test the feature. * guix/lint.scm (check-inputs-should-be-native): Adapt list. (check-inputs-should-not-be-an-input-at-all): Use pypi-ignored-list. Change-Id: I774e526c5a090026e778ee44049637174a1dca95 --- guix/import/pypi.scm | 20 +++++++++++++++++--- guix/lint.scm | 11 ++++++----- tests/pypi.scm | 3 ++- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index 6719fde330..a43d4eca1d 100644 --- a/guix/import/pypi.scm +++ b/guix/import/pypi.scm @@ -14,6 +14,7 @@ ;;; Copyright © 2022 Vivien Kraus ;;; Copyright © 2021 Simon Tournier ;;; Copyright © 2022 Hartmut Goebel +;;; Copyright © 2024 Nicolas Graves ;;; ;;; This file is part of GNU Guix. ;;; @@ -61,6 +62,7 @@ (define-module (guix import pypi) #:use-module (guix upstream) #:use-module ((guix licenses) #:prefix license:) #:export (%pypi-base-url + pypi-ignored-inputs parse-requires.txt parse-wheel-metadata specification->requirement-name @@ -77,6 +79,17 @@ (define %pypi-base-url ;; Base URL of the PyPI API. (make-parameter "https://pypi.org/pypi/")) +(define pypi-ignored-inputs + ;; This list contains packages that are useful for development or quality + ;; testing, but that most of the time are not necessary to have as an input. + (list "argparse" ; native + "codecov" "coverage" ; coverage + "black" "isort" "pycodestyle" "pep8" ; style + "pyflakes" "flake8" "pylint" "mypy" ; style+lint + "coveralls" "twine" ; upload integration tools + "pytest-isort" "pytest-flake8" "pytest-cov" "pytest-black" + "pytest-pep8" "pytest-mypy" "pytest-pep8" "pre-commit")) ; variants + (define non-empty-string-or-false (match-lambda ("" #f) @@ -424,9 +437,10 @@ (define (compute-inputs source-url wheel-url archive) "Given the SOURCE-URL and WHEEL-URL of an already downloaded ARCHIVE, return the corresponding list of records." (define (requirements->upstream-inputs deps type) - (filter-map (match-lambda - ("argparse" #f) - (name (upstream-input + (filter-map (lambda (name) + (if (member name pypi-ignored-inputs) + #f + (upstream-input (name name) (downstream-name (python->package-name name)) (type type)))) diff --git a/guix/lint.scm b/guix/lint.scm index 68d532968d..9867b71cfd 100644 --- a/guix/lint.scm +++ b/guix/lint.scm @@ -71,6 +71,7 @@ (define-module (guix lint) hg-reference-url) #:autoload (guix bzr-download) (bzr-reference? bzr-reference-url) + #:use-module ((guix import pypi) #:select (pypi-ignored-inputs)) #:use-module (guix import stackage) #:use-module (ice-9 match) #:use-module (ice-9 regex) @@ -557,14 +558,12 @@ (define (check-inputs-should-be-native package) "m4" "qttools-5" "yasm" "nasm" "fasm" - "python-coverage" "python-cython" "python-docutils" "python-mock" "python-nose" "python-pbr" "python-pytest" - "python-pytest-cov" "python-setuptools-scm" "python-sphinx" "scdoc" @@ -586,9 +585,11 @@ (define (check-inputs-should-be-native package) (define (check-inputs-should-not-be-an-input-at-all package) ;; Emit a warning if some inputs of PACKAGE are likely to should not be ;; an input at all. - (let ((input-names '("python-setuptools" - "python-pip" - "python-pre-commit"))) + (let ((input-names (append + '("python-setuptools" + "python-pip" + "python-pre-commit") + pypi-ignored-inputs))) (map (lambda (input) (make-warning package diff --git a/tests/pypi.scm b/tests/pypi.scm index 42b39cde73..fe01ab3beb 100644 --- a/tests/pypi.scm +++ b/tests/pypi.scm @@ -97,6 +97,7 @@ (define test-requires.txt "\ [test] pytest (>=2.5.0) +pytest-cov # read but ignored ") ;; Beaker contains only optional dependencies. @@ -244,7 +245,7 @@ (define-syntax-rule (with-pypi responses body ...) (map specification->requirement-name test-specifications)) (test-equal "parse-requires.txt" - (list '("foo" "bar") '("pytest")) + (list '("foo" "bar") '("pytest" "pytest-cov")) (mock ((ice-9 ports) call-with-input-file call-with-input-string) (parse-requires.txt test-requires.txt)))