From 13d30bd179101382d144dfef77dcc0ed579e6f7b Mon Sep 17 00:00:00 2001 From: Owen W. Taylor Date: Mar 31 2021 20:26:09 +0000 Subject: update.py: For apps, add links to flathub and github Add a field that includes links to, e.g.: https://flathub.org/apps/details/com.spotify.Client https://github.com/flathub/com.spotify.Client Letting people working on reviewing apps not have to make these URLs themselves. We can't easily generate these links for extensions, so stick to apps for now. --- diff --git a/update.py b/update.py index a0980f8..6a6c158 100755 --- a/update.py +++ b/update.py @@ -67,6 +67,7 @@ class Component: "comments": "Comments", "summary": "Summary", "homepage": "Homepage", + "links": "Links", "license": "License", "runtime": "Runtime", "downloads": "Downloads (new last month)", @@ -91,6 +92,21 @@ class Component: self.sort_key = tuple(x.lower() for x in self.id.split("/")) @property + def links(self) -> Optional[str]: + # It's hard to form reliable links for extensions and runtimes, + # because, e.g., + # org.freedesktop.Platform.GL.nvidia-460-56/1.4 + # needs to link to + # https://github.com/flathub/org.freedesktop.Platform.GL.nvidia + # we could consider making Links: a user-editable field in + # other.txt and wildcard.txt. + if "/" in self.id: + return None + else: + return (f"https://flathub.org/apps/details/{self.id} " + f"https://github.com/flathub/{self.id}") + + @property def downloads(self) -> str: return f"{self.download_count} (rank: {self.download_rank})"