public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
Date: Tue, 19 Sep 2023 19:13:11 +0000 (UTC)	[thread overview]
Message-ID: <1695150782.5146d35eb97e2c1a8f7691e59c755ed14e858dd4.sam@gentoo> (raw)

commit:     5146d35eb97e2c1a8f7691e59c755ed14e858dd4
Author:     Siddhanth Rathod <xsiddhanthrathod <AT> gmail <DOT> com>
AuthorDate: Tue Sep 19 18:31:49 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Sep 19 19:13:02 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=5146d35e

equery meta: map the remote-id to the respective url

Bug: https://bugs.gentoo.org/877519
Signed-off-by: Siddhanth Rathod <xsiddhanthrathod <AT> gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/32
Signed-off-by: Sam James <sam <AT> gentoo.org>

 pym/gentoolkit/equery/meta.py | 51 ++++++++++++++++++++++++++++++++++---------
 1 file changed, 41 insertions(+), 10 deletions(-)

diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index 02b6f67..de5631b 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -10,19 +10,19 @@ __docformat__ = "epytext"
 # Imports
 # =======
 
-import re
 import os
+import re
 import sys
 import warnings
-from getopt import gnu_getopt, GetoptError
+from getopt import GetoptError, gnu_getopt
 
 import gentoolkit.pprinter as pp
 from gentoolkit import errors
+from gentoolkit.equery import CONFIG, format_options, mod_usage
+from gentoolkit.helpers import print_file, print_sequence
 from gentoolkit.keyword import Keyword
-from gentoolkit.equery import format_options, mod_usage, CONFIG
-from gentoolkit.helpers import print_sequence, print_file
-from gentoolkit.textwrap_ import TextWrapper
 from gentoolkit.query import Query
+from gentoolkit.textwrap_ import TextWrapper
 
 # =======
 # Globals
@@ -189,11 +189,42 @@ def format_upstream(upstream):
 
     def _format_upstream_ids(ids):
         result = []
-        for id_ in ids:
-            site = id_[0]
-            proj_id = id_[1]
-            idstr = f"{site} ID: {proj_id}"
-            result.append(idstr)
+        remote_ids = {
+            "github": "https://github.com/remote-id",
+            "gentoo": "https://gitweb.gentoo.org/remote-id.git/",
+            "bitbucket": "https://bitbucket.org/remote-id",
+            "codeberg": "https://codeberg.org/remote-id",
+            "cpan": "https://metacpan.org/dist/remote-id",
+            "cpan-module": "https://metacpan.org/pod/remote-id",
+            "cpe": "remote-id",
+            "cran": "https://cran.r-project.org/web/packages/remote-id/",
+            "ctan": "https://ctan.org/pkg/remote-id",
+            "freedesktop-gitlab": "https://gitlab.freedesktop.org/remote-id.git/",
+            "gitlab": "https://gitlab.com/remote-id",
+            "gnome-gitlab": "https://gitlab.gnome.org/remote-id.git/",
+            "google-code": "https://code.google.com/archive/p/remote-id/",
+            "hackage": "https://hackage.haskell.org/package/remote-id",
+            "heptapod": "https://foss.heptapod.net/remote-id",
+            "kde-invent": "https://invent.kde.org/remote-id",
+            "launchpad": "https://launchpad.net/remote-id",
+            "osdn": "https://osdn.net/projects/remote-id/",
+            "pear": "https://pear.php.net/package/remote-id",
+            "pecl": "https://pecl.php.net/package/remote-id",
+            "pypi": "https://pypi.org/project/remote-id/",
+            "rubygems": "https://rubygems.org/gems/remote-id/",
+            "savannah": "https://savannah.gnu.org/projects/remote-id",
+            "savannah-nongnu": "https://savannah.nongnu.org/projects/remote-id",
+            "sourceforge": "https://sourceforge.net/projects/remote-id/",
+            "sourcehut": "https://sr.ht/remote-id/",
+            "vim": "https://www.vim.org/scripts/script.php?script_id=remote-id",
+        }
+        for id in ids:
+            proj_id = id[1]
+            try:
+                site = remote_ids[proj_id].replace("remote-id", id[0])
+            except KeyError:
+                site = id[0]
+            result.append(f"{site} ({proj_id})")
         return result
 
     result = []


             reply	other threads:[~2023-09-19 19:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19 19:13 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-07 18:49 [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/ Sam James
2024-03-07 18:49 Sam James
2023-08-05  5:38 Sam James
2023-07-18 22:30 Sam James
2023-07-18 22:26 Sam James
2022-07-28 15:29 Brian Dolbec
2022-07-28 15:29 Brian Dolbec
2022-07-10 18:41 Brian Dolbec
2022-07-10 18:01 Brian Dolbec
2022-07-10 16:23 Brian Dolbec
2022-07-10 16:23 Brian Dolbec
2022-07-10  1:24 Brian Dolbec
2022-07-09  5:17 Sam James
2018-05-01 12:32 Mike Pagano
2017-09-05 15:32 Mike Gilbert
2016-06-30 23:36 Paul Varner
2016-06-30 20:44 Paul Varner
2016-06-06 19:29 Brian Dolbec
2015-11-09 20:52 Brian Dolbec
2015-11-09  2:42 Brian Dolbec
2015-11-08 17:37 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1695150782.5146d35eb97e2c1a8f7691e59c755ed14e858dd4.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox