Message ID | 026f292cc13e95239135786a8ad830a29d483e41.1657187223.git.h.goebel@crazy-compilers.com |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0511327BBEA; Thu, 7 Jul 2022 10:48:17 +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 AF7EE27BBE9 for <patchwork@mira.cbaines.net>; Thu, 7 Jul 2022 10:48:16 +0100 (BST) Received: from localhost ([::1]:52620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org>) id 1o9O7L-0007WU-R6 for patchwork@mira.cbaines.net; Thu, 07 Jul 2022 05:48:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1o9O78-0007Ur-MU for guix-patches@gnu.org; Thu, 07 Jul 2022 05:48:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33684) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1o9O78-0002qD-Bo for guix-patches@gnu.org; Thu, 07 Jul 2022 05:48:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1o9O78-0001LJ-6O for guix-patches@gnu.org; Thu, 07 Jul 2022 05:48:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56433] [PATCH] import: pypi: Add special treatment for Tryton package names, Resent-From: Hartmut Goebel <h.goebel@crazy-compilers.com> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 07 Jul 2022 09:48:01 +0000 Resent-Message-ID: <handler.56433.B.16571872414088@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56433 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56433@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16571872414088 (code B ref -1); Thu, 07 Jul 2022 09:48:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Jul 2022 09:47:21 +0000 Received: from localhost ([127.0.0.1]:55814 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1o9O6T-00013e-Ef for submit@debbugs.gnu.org; Thu, 07 Jul 2022 05:47:21 -0400 Received: from lists.gnu.org ([209.51.188.17]:49764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <h.goebel@crazy-compilers.com>) id 1o9O6R-000126-Cw for submit@debbugs.gnu.org; Thu, 07 Jul 2022 05:47:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53454) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <h.goebel@crazy-compilers.com>) id 1o9O6Q-000722-Ok for guix-patches@gnu.org; Thu, 07 Jul 2022 05:47:19 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:45621) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <h.goebel@crazy-compilers.com>) id 1o9O6O-0002l9-Pf for guix-patches@gnu.org; Thu, 07 Jul 2022 05:47:18 -0400 Received: from hermia.goebel-consult.de ([79.211.186.65]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MEmIl-1oOTzX3Inj-00GKUa for <guix-patches@gnu.org>; Thu, 07 Jul 2022 11:47:12 +0200 Received: from lenashee.fritz.box (lenashee.goebel-consult.de [192.168.110.2]) by hermia.goebel-consult.de (Postfix) with ESMTP id AE70D5F535; Thu, 7 Jul 2022 11:47:15 +0200 (CEST) From: Hartmut Goebel <h.goebel@crazy-compilers.com> Date: Thu, 7 Jul 2022 11:47:10 +0200 Message-Id: <026f292cc13e95239135786a8ad830a29d483e41.1657187223.git.h.goebel@crazy-compilers.com> X-Mailer: git-send-email 2.30.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:39D953KeVLq/g5cVP1GN0zYX4GhHsTFXNGfOEuub2JKBn6KXZot NkM950NWxkBRcGP6e2XgLr4bGTApL88Iq0jfeDOOmBYeWMd//N0zEuWwTZBOR5urFDQFwmY DIChFq9JKdCy+yZYJ12DOrCqeKbxMp8v1souv8gdbcyTRs+1ZMycj1U3GWt0ZHhf42Jzs68 wCrvC/hUQKluAV6dNJZng== X-UI-Out-Filterresults: notjunk:1;V03:K0:upkX5YRveGU=:Y5BHawLPk/8D6E+zEC+3W6 a8f2GXvs0FDqITJPX4BG+KRSaPAH8S7TYa1Yi8Xw8RHD8TrCnyuG/f1Q/sweu5RbkGUwG3ikG qfq/iDgX84htZnIiV0dIQxgUBm442hfkbBL287hdN4PSHygOaAc1ao7OzA4embS0j2jI5kuJj cTfks+ElvRjJPsPlp3cexoZsTKD/GvXUG2zJZSk22k8L9LBDeuoq6CuYjxVMzO3JQn9TsrMdQ 79RHUGF0TV9MmOAaX8qElarXYR/rcgPUUwYLdEZowIRYrQbqEjuoUfpPaDuOkrAXXm9mTbJVA Xin1McbTTCeCcTRbhFlA8KkUdxX27MHPq3F0myWycK32CLZWaqlsP+wCnnEB0CcLOz8Fc4frB ObuMjE6ajD5Shcz0WPZusRmwt4EShxl5is0SMi2rWcSM0v7pirFgpU/BgwqLYxoGRNGa8lsBV vZX33BNo/AJmc7XX5Q4AEDjnWFIsugV27fCwGX9DSRGH4z4EXskUYcZXD/+ZUIU1NA9K0k7b/ xmYmzBpxR2zlCBLGaP+ujhiO1NSwu2mE9hlDhN7bcO2hYwmJtnTQCMIPOgHdvgZhzfcZEKA2v 3TSS9fMdJX2masl6ceZtXi9Io4bi5ORM0a9hKdzgfMrIF7Cd4DBibGELNyAgz4l8X+/NJjy5U ebcJLjaPtfxqzqoKbCFSJ4mtKfBNvyV52xMqwG3684KwfOx3G7L5QHMc246YekTPdjbreA0Qz 5gVURSAVemIyjU6KUTwEPPSg1KnCJl1p1jwZsqiXYe0RswCcISAqR2qG/N8= Received-SPF: none client-ip=212.227.126.133; envelope-from=h.goebel@crazy-compilers.com; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_FILL_THIS_FORM_SHORT=0.01, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-getmail-retrieved-from-mailbox: Patches |
Series |
[bug#56433] import: pypi: Add special treatment for Tryton package names,
|
|
Commit Message
Hartmut Goebel
July 7, 2022, 9:47 a.m. UTC
While Trytond modules are Python package, they don't have the "python-" prefix (see also https://issues.guix.gnu.org/46057#1). This patch disables adding the prefix for Trytond modules when importing and updating, thus inhibiting irritating messages like „consider removing this propagated input: trytond-party, consider adding this propagated input: python-trytond-party“. Handling this a special case seems appropriate since (as of now) there are about 165 packages for Trytond and the number is growing. * guix/import/pypi.scm(python->package-name): Don't add "python-" prefix for trytond packages. --- guix/import/pypi.scm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) base-commit: 2b883504288fc48ed1ae80620e664fe5216766c7
Comments
Hartmut Goebel <h.goebel@crazy-compilers.com> anaandika: > While Trytond modules are Python package, they don't have the "python-" > prefix (see also https://issues.guix.gnu.org/46057#1). This patch disables > adding the prefix for Trytond modules when importing and updating, thus > inhibiting irritating messages like „consider removing this propagated input: > trytond-party, consider adding this propagated input: python-trytond-party“. > > Handling this a special case seems appropriate since (as of now) there are > about 165 packages for Trytond and the number is growing. > > * guix/import/pypi.scm(python->package-name): Don't add "python-" prefix for > trytond packages. > --- > guix/import/pypi.scm | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm > index 130ec769b3..ee74f6065c 100644 > --- a/guix/import/pypi.scm > +++ b/guix/import/pypi.scm > @@ -162,9 +162,11 @@ or #f if there isn't any." > (define (python->package-name name) > "Given the NAME of a package on PyPI, return a Guix-compliant name for the > package." > - (if (string-prefix? "python-" name) > - (snake-case name) > - (string-append "python-" (snake-case name)))) > + (cond > + ((string-prefix? "python-" name) (snake-case name)) > + ((or (string=? "trytond" name) > + (string-prefix? "trytond-" name)) (snake-case name)) > + (#t (string-append "python-" (snake-case name))))) > In this case shouldn't you use an "else" at the very end of this 'cond'? > (define (guix-package->pypi-name package) > "Given a Python PACKAGE built from pypi.org, return the name of the > > base-commit: 2b883504288fc48ed1ae80620e664fe5216766c7 -- (Life is like a pencil that will surely run out, but will leave the beautiful writing of life.) (D4F09EB110177E03C28E2FE1F5BBAE1E0392253F (hkp://keys.gnupg.net))
Am 08.07.22 um 12:36 schrieb Munyoki Kilyungi:
> In this case shouldn't you use an "else" at the very end of this 'cond'?
Of course.
I missed this when reading the documentation of „cond“
https://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/if-cond-case.html
and was wondering about it. Thanks for the nit-pick.
Hi Hartmut, Hartmut Goebel <h.goebel@crazy-compilers.com> skribis: > I missed this when reading the documentation of „cond“ > https://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/if-cond-case.html > and was wondering about it. Thanks for the nit-pick. This is the Guile 1.8 documentation (last 1.8 release was in 2010). Check out <https://gnu.org/s/guile/manual/html_node> for the current version, or just ‘info guile’ on your machine. Ludo’.
Hartmut Goebel <h.goebel@crazy-compilers.com> skribis: > While Trytond modules are Python package, they don't have the "python-" > prefix (see also https://issues.guix.gnu.org/46057#1). This patch disables > adding the prefix for Trytond modules when importing and updating, thus > inhibiting irritating messages like „consider removing this propagated input: > trytond-party, consider adding this propagated input: python-trytond-party“. Could you instead add an ‘upstream-name’ property to these packages? That’d be explicit and IMO clearer. Ludo’.
Am 08.07.22 um 23:37 schrieb Ludovic Courtès: > Could you instead add an ‘upstream-name’ property to these packages? > That’d be explicit and IMO clearer. AFAIU the „upstream-name“ property changes the name when requesting the upstream source or when updating. This fix works into the opposite direction: it fixes the „downstream“-name = the guix package name. Name at pypi: * „normal“ Python package: myCoolModule * Trytond package: trytond-cool_addon. Name at guix: * „normal“ Python package: python-mycoolmodule — “python-” prefix * Trytond package: trytond-cool-addon — no “python-” prefix Looks like this is not clear from the commit message. Does this changed message make it clear? Trytond modules are Python packages, and treated like this in guix. Anyhow, since they are add-ons for the “Trytond“ application, their guix package name do not get the "python-" prefix like other Python modules, (see also https://issues.guix.gnu.org/46057#1). This change disables adding the "python-" prefix to the guix packge name for Trytond modules when importing and updating, thus inhibiting irritating messages like „consider removing this propagated input: trytond-party, consider adding this propagated input: python-trytond-party“.
Hi, Hartmut Goebel <h.goebel@crazy-compilers.com> skribis: > AFAIU the „upstream-name“ property changes the name when requesting > the upstream source or when updating. The ‘upstream-name’ property establishes a mapping between the package at hand and its upstream name, overriding guesswork normally done by importers and updaters. > This fix works into the opposite direction: it fixes the > „downstream“-name = the guix package name. > > Name at pypi: > > * „normal“ Python package: myCoolModule > * Trytond package: trytond-cool_addon. > > Name at guix: > > * „normal“ Python package: python-mycoolmodule — “python-” prefix > * Trytond package: trytond-cool-addon — no “python-” prefix Ooh, got it. So yes, this patch makes sense to me. (I’m surprised we decided against the “python-” prefix back then, but that’s history.) > Looks like this is not clear from the commit message. Does this > changed message make it clear? I think the commit message is fine, but… > Trytond modules are Python packages, and treated like this in guix. > Anyhow, since they are add-ons for the “Trytond“ application, > their guix package name do not get the "python-" prefix like other > Python modules, (see also https://issues.guix.gnu.org/46057#1). This > change disables > adding the "python-" prefix to the guix packge name for Trytond modules > when importing and updating, thus > inhibiting irritating messages like „consider removing this propagated > input: > trytond-party, consider adding this propagated input: python-trytond-party“. … I’m not sure I fully understand this part: you’re talking about messages produced by ‘guix refresh’, right? Do you have the example of a command that triggers this? Perhaps you can include that example in the commit message to make things perfectly clear. Anyway, LGTM, thanks! Ludo’.
Thanks for the review. As you suggested, I added an example and pushed as 2e0b7867fe89fcfb0523a85635ecc3e1f9484fcd
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index 130ec769b3..ee74f6065c 100644 --- a/guix/import/pypi.scm +++ b/guix/import/pypi.scm @@ -162,9 +162,11 @@ or #f if there isn't any." (define (python->package-name name) "Given the NAME of a package on PyPI, return a Guix-compliant name for the package." - (if (string-prefix? "python-" name) - (snake-case name) - (string-append "python-" (snake-case name)))) + (cond + ((string-prefix? "python-" name) (snake-case name)) + ((or (string=? "trytond" name) + (string-prefix? "trytond-" name)) (snake-case name)) + (#t (string-append "python-" (snake-case name))))) (define (guix-package->pypi-name package) "Given a Python PACKAGE built from pypi.org, return the name of the