GNU bug report logs - #56433
[PATCH] import: pypi: Add special treatment for Tryton package names,

Previous Next

Package: guix-patches;

Reported by: Hartmut Goebel <h.goebel <at> crazy-compilers.com>

Date: Thu, 7 Jul 2022 09:48:01 UTC

Severity: normal

Tags: patch

Done: Hartmut Goebel <h.goebel <at> crazy-compilers.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 56433 in the body.
You can then email your comments to 56433 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#56433; Package guix-patches. (Thu, 07 Jul 2022 09:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hartmut Goebel <h.goebel <at> crazy-compilers.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 07 Jul 2022 09:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] import: pypi: Add special treatment for Tryton package names, 
Date: Thu,  7 Jul 2022 11:47:10 +0200
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)))))
 
 (define (guix-package->pypi-name package)
   "Given a Python PACKAGE built from pypi.org, return the name of the

base-commit: 2b883504288fc48ed1ae80620e664fe5216766c7
-- 
2.30.4





Information forwarded to guix-patches <at> gnu.org:
bug#56433; Package guix-patches. (Fri, 08 Jul 2022 10:37:02 GMT) Full text and rfc822 format available.

Message #8 received at 56433 <at> debbugs.gnu.org (full text, mbox):

From: Munyoki Kilyungi <me <at> bonfacemunyoki.com>
To: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
Cc: 56433 <at> debbugs.gnu.org
Subject: Re: [bug#56433] [PATCH] import: pypi: Add special treatment for
 Tryton package names,
Date: Fri, 08 Jul 2022 13:36:20 +0300
[Message part 1 (text/plain, inline)]
Hartmut Goebel <h.goebel <at> 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))
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#56433; Package guix-patches. (Fri, 08 Jul 2022 11:31:01 GMT) Full text and rfc822 format available.

Message #11 received at 56433 <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: Munyoki Kilyungi <me <at> bonfacemunyoki.com>
Cc: 56433 <at> debbugs.gnu.org
Subject: Re: [bug#56433] [PATCH] import: pypi: Add special treatment for
 Tryton package names,
Date: Fri, 8 Jul 2022 13:30:07 +0200
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.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel <at> crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





Information forwarded to guix-patches <at> gnu.org:
bug#56433; Package guix-patches. (Fri, 08 Jul 2022 21:37:02 GMT) Full text and rfc822 format available.

Message #14 received at 56433 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
Cc: Munyoki Kilyungi <me <at> bonfacemunyoki.com>, 56433 <at> debbugs.gnu.org
Subject: Re: bug#56433: [PATCH] import: pypi: Add special treatment for
 Tryton package names, 
Date: Fri, 08 Jul 2022 23:36:12 +0200
Hi Hartmut,

Hartmut Goebel <h.goebel <at> 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’.




Information forwarded to guix-patches <at> gnu.org:
bug#56433; Package guix-patches. (Fri, 08 Jul 2022 21:39:02 GMT) Full text and rfc822 format available.

Message #17 received at 56433 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
Cc: 56433 <at> debbugs.gnu.org
Subject: Re: bug#56433: [PATCH] import: pypi: Add special treatment for
 Tryton package names, 
Date: Fri, 08 Jul 2022 23:37:53 +0200
Hartmut Goebel <h.goebel <at> 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’.




Information forwarded to guix-patches <at> gnu.org:
bug#56433; Package guix-patches. (Mon, 11 Jul 2022 13:50:01 GMT) Full text and rfc822 format available.

Message #20 received at 56433 <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 56433 <at> debbugs.gnu.org
Subject: Re: bug#56433: [PATCH] import: pypi: Add special treatment for Tryton
 package names,
Date: Mon, 11 Jul 2022 15:49:43 +0200
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“.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel <at> crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





Information forwarded to guix-patches <at> gnu.org:
bug#56433; Package guix-patches. (Mon, 11 Jul 2022 19:55:01 GMT) Full text and rfc822 format available.

Message #23 received at 56433 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
Cc: 56433 <at> debbugs.gnu.org
Subject: Re: bug#56433: [PATCH] import: pypi: Add special treatment for
 Tryton package names,
Date: Mon, 11 Jul 2022 21:54:08 +0200
Hi,

Hartmut Goebel <h.goebel <at> 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’.




Reply sent to Hartmut Goebel <h.goebel <at> crazy-compilers.com>:
You have taken responsibility. (Fri, 15 Jul 2022 19:17:02 GMT) Full text and rfc822 format available.

Notification sent to Hartmut Goebel <h.goebel <at> crazy-compilers.com>:
bug acknowledged by developer. (Fri, 15 Jul 2022 19:17:02 GMT) Full text and rfc822 format available.

Message #28 received at 56433-close <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 56433-close <at> debbugs.gnu.org
Subject: Re: bug#56433: [PATCH] import: pypi: Add special treatment for Tryton
 package names,
Date: Fri, 15 Jul 2022 21:16:15 +0200
Thanks for the review. As you suggested, I added an example and pushed 
as 2e0b7867fe89fcfb0523a85635ecc3e1f9484fcd

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel <at> crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 13 Aug 2022 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 313 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.