[packages/pldnotify] Move distro constant, specific to anitya checker

glen glen at pld-linux.org
Wed Feb 24 10:17:28 CET 2021


commit 3b6972910d4e97bb8e42b5578d3795676bb13e08
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Wed Feb 24 11:16:48 2021 +0200

    Move distro constant, specific to anitya checker

 pldnotify.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/pldnotify.py b/pldnotify.py
index f1af11a..3e5c15b 100755
--- a/pldnotify.py
+++ b/pldnotify.py
@@ -68,18 +68,20 @@ class AbstractChecker:
 
 
 class CheckReleaseMonitoring(AbstractChecker):
+    distro = 'pld-linux'
+
     """
         Check for update from release-monitoring.org (Anitya).
         Raise ValueError or version from anitya project.
     """
 
-    def find_latest(self, distro, spec):
-        url = "https://release-monitoring.org/api/project/%s/%s" % (distro, spec.name)
+    def find_latest(self, spec):
+        url = "https://release-monitoring.org/api/project/%s/%s" % (self.distro, spec.name)
         response = requests.get(url)
         data = response.json()
         if 'error' in data:
             error = data['error']
-            if error == 'No package "%s" found in distro "%s"' % (spec.name, distro):
+            if error == 'No package "%s" found in distro "%s"' % (spec.name, self.distro):
                 res = self.find_alternatives(spec)
                 if res is not None:
                     error = error + "\n" + res
@@ -121,7 +123,6 @@ i.e Anitya (release-monitoring.org), NPM (nodejs), etc ...
 
 
 class Checker:
-    distro = 'pld-linux'
     checkers = [
         CheckReleaseMonitoring,
     ]
@@ -137,7 +138,7 @@ class Checker:
         for name in self.checkers:
             checker = name(self.stable)
             try:
-                v = checker.find_latest(self.distro, spec)
+                v = checker.find_latest(spec)
             except ValueError as e:
                 print("WARNING: skipping %s: %s" % (name, e))
                 continue
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/pldnotify.git/commitdiff/3b6972910d4e97bb8e42b5578d3795676bb13e08



More information about the pld-cvs-commit mailing list