[Blends-commit] [SCM] website branch, master, updated. bb627ae68d3886b637c2499727ea13eeb89c0562

Ole Streicher olebole at debian.org
Sun Mar 20 13:20:36 UTC 2016


The following commit has been merged in the master branch:
commit e21de6a3ed85fea3679776e688abd5390345e9d0
Author: Ole Streicher <olebole at debian.org>
Date:   Sun Mar 20 14:16:34 2016 +0100

    Remove blends name and task name from DependantPackage

diff --git a/webtools/blendstasktools.py b/webtools/blendstasktools.py
index 0071727..4ce2415 100644
--- a/webtools/blendstasktools.py
+++ b/webtools/blendstasktools.py
@@ -717,10 +717,8 @@ PROPERTIES = (
 class DependantPackage:
     # Hold information about a package that is in dependency list
 
-    def __init__(self, blendname=None, taskname=None):
-        self.blendname      = blendname  # Blend that includes the package in dependency list
-        self.taskname       = taskname   # Task which includes the Dependency
-        self.pkg            = None  # Name of dependant package
+    def __init__(self, name):
+        self.pkg            = name  # Name of dependant package
         self.properties     = {}
         self.properties['license']     = 'unknown'
         self.properties['pkgstatus']     = 'unknown'
@@ -747,9 +745,7 @@ class DependantPackage:
         return cmp(self.pkg, other.pkg)
 
     def __str__(self):
-        ret = "Blend: " + self.blendname + ", " \
-              "Task:"   + self.taskname  + ", " \
-              "pkg:"    + self.pkg
+        ret = "pkg:"    + self.pkg
         if self.dep_strength:
             ret += ", Dep_strength: " + self.dep_strength
         if self.desc:
@@ -761,7 +757,7 @@ class DependantPackage:
         #    ret += ", desc['en']:"   + str(self.desc['en'])
         return ret
 
-    def SetPublications(self, row):
+    def SetPublications(self, taskname, row):
         for pub in ("year", "title", "authors", "doi", "pubmed", "url",
                     "journal", "volume", "number", "pages", "eprint"):
             if row[pub]:
@@ -810,8 +806,8 @@ class DependantPackage:
                     self.properties['published'] = {}
                 if pub in self.properties['published']:
                     if self.properties['published'][pub] == row[pub]:
-                        rmpub.write("%s: %s: Published-%s: %s" % (self.taskname, self.pkg, pub, row[pub]))
-                        logger.info("%s/%s: Publication-%s = %s can be removed"  % (self.taskname, self.pkg, pub, row[pub]))
+                        rmpub.write("%s: %s: Published-%s: %s" % (taskname, self.pkg, pub, row[pub]))
+                        logger.info("%s/%s: Publication-%s = %s can be removed"  % (taskname, self.pkg, pub, row[pub]))
                     else:
                         logger.info("%s conflicting fields Publication-%s in tasks file with value '%s' and in UDD with value '%s'" % (self.pkg, pub, self.properties['published'][pub], row[pub]))
                 self.properties['published'][pub] = row[pub]
@@ -1067,8 +1063,7 @@ class TaskDependencies:
 
     def SetMetapackageInfo(self, pkgname, ddtptranslations=None):
         # Gather information (specifically description translations if exists) about metapackage itself
-        self.metapkg             = DependantPackage(self.blendname, self.task)
-        self.metapkg.pkg         = pkgname
+        self.metapkg             = DependantPackage(pkgname)
         self.metapkg.source      = self.blendname
         if not ddtptranslations:
             return
@@ -1188,7 +1183,11 @@ class TaskDependencies:
                         # before initiating the next instance
                         if dep is not None:
                             tmp_dep_list.append(dep)
-                        dep = DependantPackage(self.blendname, self.task)
+                        if not dep_in_line.islower():
+                            logger.warning("Package names may not contain upper case letters, so %s is an invalid package name which is turned into %s"
+                                           % (dep_in_line, dep.pkg))
+                            dep_in_line = dep_in_line.lower()
+                        dep = DependantPackage(dep_in_line)
                         # Store the comments in case they might be usefull for later applications
                         if why:
                             dep.properties['why'] = why
@@ -1197,12 +1196,6 @@ class TaskDependencies:
                             dep.properties['maintainer'] = {'name':_name, 'email': _url}
 
                         dep.dep_strength   = key
-                        if dep_in_line.islower():
-                            dep.pkg            = dep_in_line
-                        else:
-                            dep.pkg            = dep_in_line.lower()
-                            logger.warning("Package names may not contain upper case letters, so %s is an invalid package name which is turned into %s"
-                                           % (dep_in_line, dep.pkg))
 
                     continue
 
@@ -1393,7 +1386,7 @@ class TaskDependencies:
                     dep.properties['remark'] = remark
                 if fields_obsolete != [] and dep.properties['pkgstatus'] != 'new':
                     logger.info("Package %s is an official package and has information in UDD. The following extra information can be removed from tasks file %s: %s"
-                                % (dep.pkg, dep.taskname, str(fields_obsolete)))
+                                % (dep.pkg, self.task, str(fields_obsolete)))
                 self._AppendDependency2List(dep, source)
 
         f.close()
@@ -1454,7 +1447,7 @@ class TaskDependencies:
                 if dep.desc['en'] and dep.desc['en']['short'] and 'debtags' not in dep.properties:
                     # prevent informing about packages which are just duplicated because of a broken query
                     logger.info("WNPP for package %s just closed - extra information can be removed from task file %s."
-                                % (dep.pkg, dep.taskname))
+                                % (dep.pkg, self.task))
 
                 dep.properties['license'] = license_in_component[dep.properties['component']]
                 for prop in PROPERTIES:
@@ -1556,7 +1549,7 @@ class TaskDependencies:
                     logger.info("Edam topics found for package %s: %s" % (dep.pkg, str(row['edam_topics'])))
 
                 # Publications
-                dep.SetPublications(row)
+                dep.SetPublications(self.task, row)
 
                 pkgs_in_pool.append(dep.pkg)
                 # DEBUG
@@ -1599,7 +1592,7 @@ class TaskDependencies:
                 dep.properties['pkg-url'] = 'http://ftp-master.debian.org/new/%s_%s.html' % (row['source'], row['version'])
                 # Warn about remaining information of prospective package
                 if (dep.desc['en'] and dep.desc['en']['short']) or dep.properties['homepage'] != HOMEPAGENONE:
-                    logger.info("The package %s is not yet in Debian but it is just in the new queue. (Task %s)" % (dep.pkg, dep.taskname))
+                    logger.info("The package %s is not yet in Debian but it is just in the new queue. (Task %s)" % (dep.pkg, self.task))
                 for prop in PROPERTIES:
                     dep.properties[prop] = row[prop]
                 dep.desc['en']['short'] = row['description_en']
@@ -1608,13 +1601,13 @@ class TaskDependencies:
                     (_name, _url) = email.utils.parseaddr(row['maintainer'])
                     dep.properties['maintainer'] = {'name': _name, 'email': _url}
 
-                dep.SetPublications(row)
+                dep.SetPublications(self.task, row)
                 if row['changed_by']:
                     try:
                         changed = row['changed_by']
                     except TypeError as err:
                         changed = None
-                        logger.warning("Encoding problem for uploader to ftpnew of package '%s' in task %s (%s)" % (dep.pkg, dep.taskname, err))
+                        logger.warning("Encoding problem for uploader to ftpnew of package '%s' in task %s (%s)" % (dep.pkg, self.task, err))
                     if changed:
                         (_name, _url) = email.utils.parseaddr(changed)
                         dep.properties['uploader'] = {'name': _name, 'email': _url}
@@ -1634,7 +1627,7 @@ class TaskDependencies:
                                 prs = pr.strip()
                                 if dep.pkg == prs:
                                     pkgs_virtual.append(prs)
-                                    logger.info("Virtual package %s is provided by package %s for task %s" % (dep.pkg, vp['package'], dep.taskname))
+                                    logger.info("Virtual package %s is provided by package %s for task %s" % (dep.pkg, vp['package'], self.task))
                                     found = True
                                     break
                             if found:
@@ -1677,7 +1670,7 @@ class TaskDependencies:
                                                   'version':row['version']})
                 # Warn about remaining information of prospective package
                 if (dep.desc['en'] and dep.desc['en']['short']) or dep.properties['homepage'] != HOMEPAGENONE:
-                    logger.info("The package %s is not yet in Debian but it is just in Blends %s Vcs. (Task %s)" % (dep.pkg, row['blend'], dep.taskname))
+                    logger.info("The package %s is not yet in Debian but it is just in Blends %s Vcs. (Task %s)" % (dep.pkg, row['blend'], self.task))
                 for prop in PROPERTIES:
                     dep.properties[prop] = row[prop]
                 dep.properties['license'] = row['license']
@@ -1687,7 +1680,7 @@ class TaskDependencies:
                         vcs[prop] = row['vcs-' + prop]
                 if int(row['wnpp']) > 0:
                     dep.properties['wnpp'] = row['wnpp']
-                dep.SetPublications(row)
+                dep.SetPublications(self.task, row)
                 dep.desc['en']['short'] = row['description_en']
                 dep.desc['en']['long'] = PrepareMarkdownInput(row['long_description_en'])
                 if row['maintainer']:
@@ -1699,7 +1692,7 @@ class TaskDependencies:
                         changed = row['changed_by']
                     except TypeError as err:
                         changed = None
-                        logger.warning("Encoding problem for changelog author in Vcs of package '%s' in task %s (%s)" % (dep.pkg, dep.taskname, err))
+                        logger.warning("Encoding problem for changelog author in Vcs of package '%s' in task %s (%s)" % (dep.pkg, self.task, err))
                     if changed:
                         (_name, _url) = email.utils.parseaddr(changed)
                         dep.properties['uploader'] = {'name': _name, 'email': _url}
@@ -1710,14 +1703,14 @@ class TaskDependencies:
                 if dep.pkg not in pkgs_in_pool and dep.pkg not in pkgs_in_new and dep.pkg not in pkgs_virtual and dep.properties['pkgstatus'] in ('unknown', 'pkgvcs'):
                     # If only Vcs fields are given than we currently do not know enough to print package information
                     if dep.properties['pkgstatus'] == 'pkgvcs' and (dep.properties['homepage'] == HOMEPAGENONE or dep.desc['en'] == {}):
-                        logger.error("Package %s in task %s has only Vcs information - please provide more information" % (dep.pkg, dep.taskname))
+                        logger.error("Package %s in task %s has only Vcs information - please provide more information" % (dep.pkg, self.task))
                         self.dependencies[status].remove(dep)
                         # dep.properties['pkgstatus'] == 'unknown'
                     if dep.properties['homepage'] == HOMEPAGENONE:
                         if dep.desc['en'] == {}:
-                            logger.error("Package %s in task %s neither in pool nor new and is lacking homepage and description - ignored" % (dep.pkg, dep.taskname))
+                            logger.error("Package %s in task %s neither in pool nor new and is lacking homepage and description - ignored" % (dep.pkg, self.task))
                         else:
-                            logger.error("Package %s in task %s neither in pool nor new and has no homepage information - ignored (%s)" % (dep.pkg, dep.taskname, dep.properties['pkgstatus']))
+                            logger.error("Package %s in task %s neither in pool nor new and has no homepage information - ignored (%s)" % (dep.pkg, self.task, dep.properties['pkgstatus']))
                     else:
                         if dep.desc['en'] == {}:
                             logger.error("Package %s neither in pool nor new and has no description - ignored" % dep.pkg)
@@ -1826,7 +1819,7 @@ class TaskDependencies:
                             if dep is not None:
                                 # Add the first real package from the packages which provide the virtual package to the list
                                 tmp_dep_list.append(dep)
-                            dep = DependantPackage(self.blendname, self.task)
+                            dep = DependantPackage(virt_provides)
                             # Store the comments in case they might be usefull for later applications
                             if why:
                                 dep.properties['why'] = why
@@ -1834,10 +1827,9 @@ class TaskDependencies:
                                 (_name, _url) = email.utils.parseaddr(responsible)
                                 dep.properties['maintainer'] = {'name':_name, 'email': _url}
                             dep.dep_strength   = key
-                            dep.pkg            = virt_provides
                             dep._QueryUDD4Package(source)
                 else:
-                    logger.warning("Dependency with unknown status: %s (Task %s)" % (dep.pkg, dep.taskname))
+                    logger.warning("Dependency with unknown status: %s (Task %s)" % (dep.pkg, self.task))
 
         for dependency in self.dependencies.values():
             dependency.sort()
diff --git a/webtools/blendstasktools_udd.py b/webtools/blendstasktools_udd.py
index 1b6a855..b62df3f 100644
--- a/webtools/blendstasktools_udd.py
+++ b/webtools/blendstasktools_udd.py
@@ -673,10 +673,8 @@ def GetPkgstat(strength):
 class DependantPackage:
     # Hold information about a package that is in dependency list
 
-    def __init__(self, blendname=None, taskname=None):
-        self.blendname      = blendname  # Blend that includes the package in dependency list
-        self.taskname       = taskname   # Task which includes the Dependency
-        self.pkg            = None  # Name of dependant package
+    def __init__(self, name):
+        self.pkg            = name  # Name of dependant package
         self.source         = None  # Name of source package of the dependency
         self.properties     = {}
         self.properties['license']     = 'unknown'
@@ -708,9 +706,7 @@ class DependantPackage:
         return cmp(self.pkg, other.pkg)
 
     def __str__(self):
-        ret = "Blend: " + self.blendname + ", " \
-              "Task:"   + self.taskname  + ", " \
-              "pkg:"    + self.pkg
+        ret = "pkg:"    + self.pkg
         if self.dep_strength:
             ret += ", Dep_strength: " + self.dep_strength
         if self.desc:
@@ -725,7 +721,7 @@ class DependantPackage:
         #    ret += ", desc['en']:"   + str(self.desc['en'])
         return ret
 
-    def SetPublications(self, row):
+    def SetPublications(self, taskname, row):
         for pub in ("year", "title", "authors", "doi", "pubmed", "url",
                     "journal", "volume", "number", "pages", "eprint"):
             if row[pub]:
@@ -774,8 +770,8 @@ class DependantPackage:
                     self.properties['published'] = {}
                 if pub in self.properties['published']:
                     if self.properties['published'][pub] == row[pub]:
-                        rmpub.write("%s: %s: Published-%s: %s" % (self.taskname, self.pkg, pub, row[pub]))
-                        logger.info("%s/%s: Publication-%s = %s can be removed"  % (self.taskname, self.pkg, pub, row[pub]))
+                        rmpub.write("%s: %s: Published-%s: %s" % (taskname, self.pkg, pub, row[pub]))
+                        logger.info("%s/%s: Publication-%s = %s can be removed"  % (taskname, self.pkg, pub, row[pub]))
                     else:
                         logger.info("%s conflicting fields Publication-%s in tasks file with value '%s' and in UDD with value '%s'" % (self.pkg, pub, self.properties['published'][pub], row[pub]))
                 self.properties['published'][pub] = row[pub]
@@ -988,8 +984,7 @@ class TaskDependencies:
 
     def SetMetapackageInfo(self, pkgname, ddtptranslations=None):
         # Gather information (specifically description translations if exists) about metapackage itself
-        self.metapkg             = DependantPackage(self.blendname, self.task)
-        self.metapkg.pkg         = pkgname
+        self.metapkg             = DependantPackage(pkgname)
         self.metapkg.source      = self.blendname
         if not ddtptranslations:
             return
@@ -1182,7 +1177,7 @@ class TaskDependencies:
                 dep.properties['remark'] = {'short': shortDesc, 'long': longDesc}
 
             # Publications
-            dep.SetPublications(row)
+            dep.SetPublications(self.task, row)
 
             self._AppendDependency2List(dep)
 
@@ -1213,10 +1208,9 @@ class TaskDependencies:
             for each_dep in dep_info:
                 # class DependantPackage - This class contains all the possible information about a package
                 # Create an object of class DependantPackage
-                dep = DependantPackage(self.blendname, self.task)
+                dep = DependantPackage(each_dep[0])
 
                 # Information about the dependant packages
-                dep.pkg = each_dep[0]   # Name
                 # dep.license
                 dep.dep_strength = each_dep[1]  # Depends: 'd' or Suggests: 's'
                
@@ -1242,9 +1236,7 @@ class TaskDependencies:
         if curs.rowcount > 0:
             pros_info = curs.fetchall() 
             for each_pros in pros_info:
-                dep = DependantPackage(self.blendname, self.task)
-                
-                dep.pkg = each_pros[0]          # Name
+                dep = DependantPackage(each_pros[0])
                 dep.properties['license'] = each_pros[1]
                 dep.dep_strength = each_pros[2]
                 
@@ -1269,9 +1261,7 @@ class TaskDependencies:
             pkgs_new = curs.fetchall()
 
             for each_new_pkg in pkgs_new:
-                dep = DependantPackage(self.blendname, self.task)
-              
-                dep.pkg = each_new_pkg[0]          # Name
+                dep = DependantPackage(each_new_pkg[0])
                 
                 alldepends.append(dep.pkg)
                 dependencies.append(dep)

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list