unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#56433] [PATCH] import: pypi: Add special treatment for Tryton package names,
@ 2022-07-07  9:47 Hartmut Goebel
  2022-07-08 10:36 ` Munyoki Kilyungi
  2022-07-08 21:37 ` Ludovic Courtès
  0 siblings, 2 replies; 8+ messages in thread
From: Hartmut Goebel @ 2022-07-07  9:47 UTC (permalink / raw)
  To: 56433

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





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#56433] [PATCH] import: pypi: Add special treatment for Tryton package names,
  2022-07-07  9:47 [bug#56433] [PATCH] import: pypi: Add special treatment for Tryton package names, Hartmut Goebel
@ 2022-07-08 10:36 ` Munyoki Kilyungi
  2022-07-08 11:30   ` Hartmut Goebel
  2022-07-08 21:37 ` Ludovic Courtès
  1 sibling, 1 reply; 8+ messages in thread
From: Munyoki Kilyungi @ 2022-07-08 10:36 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 56433

[-- Attachment #1: Type: text/plain, Size: 1953 bytes --]


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))

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 865 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#56433] [PATCH] import: pypi: Add special treatment for Tryton package names,
  2022-07-08 10:36 ` Munyoki Kilyungi
@ 2022-07-08 11:30   ` Hartmut Goebel
  2022-07-08 21:36     ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Hartmut Goebel @ 2022-07-08 11:30 UTC (permalink / raw)
  To: Munyoki Kilyungi; +Cc: 56433

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@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#56433] [PATCH] import: pypi: Add special treatment for Tryton package names,
  2022-07-08 11:30   ` Hartmut Goebel
@ 2022-07-08 21:36     ` Ludovic Courtès
  0 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2022-07-08 21:36 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: Munyoki Kilyungi, 56433

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’.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#56433] [PATCH] import: pypi: Add special treatment for Tryton package names,
  2022-07-07  9:47 [bug#56433] [PATCH] import: pypi: Add special treatment for Tryton package names, Hartmut Goebel
  2022-07-08 10:36 ` Munyoki Kilyungi
@ 2022-07-08 21:37 ` Ludovic Courtès
  2022-07-11 13:49   ` Hartmut Goebel
  1 sibling, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2022-07-08 21:37 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 56433

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’.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#56433] [PATCH] import: pypi: Add special treatment for Tryton package names,
  2022-07-08 21:37 ` Ludovic Courtès
@ 2022-07-11 13:49   ` Hartmut Goebel
  2022-07-11 19:54     ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Hartmut Goebel @ 2022-07-11 13:49 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 56433

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@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#56433] [PATCH] import: pypi: Add special treatment for Tryton package names,
  2022-07-11 13:49   ` Hartmut Goebel
@ 2022-07-11 19:54     ` Ludovic Courtès
  2022-07-15 19:16       ` bug#56433: " Hartmut Goebel
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2022-07-11 19:54 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: 56433

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’.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#56433: [PATCH] import: pypi: Add special treatment for Tryton package names,
  2022-07-11 19:54     ` Ludovic Courtès
@ 2022-07-15 19:16       ` Hartmut Goebel
  0 siblings, 0 replies; 8+ messages in thread
From: Hartmut Goebel @ 2022-07-15 19:16 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 56433-close

Thanks for the review. As you suggested, I added an example and pushed 
as 2e0b7867fe89fcfb0523a85635ecc3e1f9484fcd

-- 
Regards
Hartmut Goebel

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-07-15 19:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07  9:47 [bug#56433] [PATCH] import: pypi: Add special treatment for Tryton package names, Hartmut Goebel
2022-07-08 10:36 ` Munyoki Kilyungi
2022-07-08 11:30   ` Hartmut Goebel
2022-07-08 21:36     ` Ludovic Courtès
2022-07-08 21:37 ` Ludovic Courtès
2022-07-11 13:49   ` Hartmut Goebel
2022-07-11 19:54     ` Ludovic Courtès
2022-07-15 19:16       ` bug#56433: " Hartmut Goebel

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).