[Cdd-commits] r967 - cdd/trunk/webtools

CDD Subversion Commit noreply at alioth.debian.org
Fri Jul 11 14:24:40 UTC 2008


Author: tille
Date: Fri Jul 11 14:24:39 2008
New Revision: 967

Modified:
   cdd/trunk/webtools/cddtasktools.py
   cdd/trunk/webtools/tasks.py
Log:
Make sure that information of official package has priority over information in tasks file


Modified: cdd/trunk/webtools/cddtasktools.py
==============================================================================
--- cdd/trunk/webtools/cddtasktools.py	(original)
+++ cdd/trunk/webtools/cddtasktools.py	Fri Jul 11 14:24:39 2008
@@ -40,6 +40,8 @@
 # COMPRESSIONEXTENSION='bz2'
 COMPRESSIONEXTENSION='gz'
 
+HOMEPAGENONE = '#'
+
 def ReadConfig(cddname=''):
     # Try to read config file CONFDIR/<cddname>.conf
     conffile = CONFDIR + '/' + cddname + '.conf'
@@ -175,7 +177,7 @@
 
         # The following keys will be mostly used for programs that
         # are not yet existing in Debian and will go to our todo list
-        self.homepage       = '#'  # Homepage of program
+        self.homepage       = HOMEPAGENONE # Homepage of program
         self.version        = None # Version of program
         self.responsible    = None # E-Mail address of issuer of ITP or some person
                                    # who volunteered to care for this program
@@ -480,7 +482,7 @@
 
                 if key in dep_strength_keys:
                     # Hack: Debian Edu tasks files are using '\' at EOL which is broken
-                    #       in RFC 822 files, but cdd-gen-control from cdd-dev 0.5.0 relies
+                    #       in RFC 822 files, but cdd-gen-control from cdd-dev 0.5.x relies
                     #       on this.  So remove this stuff here for the Moment
                     dependencies = re.sub('\\\\\n\s+', '', stanza[key])
 
@@ -545,7 +547,9 @@
                 # are not yet existing in Debian and will go to our todo list
                 if key == 'Homepage':
                     if dep != None:
-                        dep.homepage = stanza['homepage']
+                        # set Homepage only if not just set via official package information
+                        if dep.homepage == HOMEPAGENONE:
+                            dep.homepage = stanza['homepage']
                     else:
                         print >>stderr, "Dep not initiated before Homepage %s -> something is wrong." \
                               % stanza['homepage']
@@ -563,14 +567,18 @@
                               % stanza['license']
                 elif key == 'WNPP':
                     if dep != None:
-                        dep.wnpp     = stanza['wnpp']
+                        if dep.pkg in self.available.packages[component].keys():
+                            print "Hint: WNPP for package %s just closed - extra information can be removed from task file." % (dep.pkg)
+                        else:
+                            dep.wnpp     = stanza['wnpp']
                     else:
                         print >>stderr, "Dep not initiated before WNPP %s -> something is wrong." \
                               % stanza['wnpp']
                 elif key == 'Pkg-URL':
                     if dep != None:
-                	# Escape '&' in URLs with %26 (Trick stolen by pasting the URL into a search engine ;-))
-                        dep.pkgURL   = stanza['pkg-url'].replace("&", "%26")
+                        if dep.pkgURL == None: # only if no official package is just available
+                            # Escape '&' in URLs with %26 (Trick stolen by pasting the URL into a search engine ;-))
+                            dep.pkgURL   = stanza['pkg-url'].replace("&", "%26")
                     else:
                         print >>stderr, "Dep not initiated before Pkg-URL %s -> something is wrong." \
                               % stanza['pkg-url']
@@ -579,7 +587,9 @@
                         print >>stderr, "Dep not initiated before Pkg-Description %s -> something is wrong." \
                               % stanza['pkg-description'].splitlines()[0]
                     else:
-                        (dep.desc['en']['short'], dep.desc['en']['long']) = SplitDescription(stanza['pkg-description'])
+                        # Only update use description from task file if not known from official package
+                        if dep.desc['en'] == {}:
+                            (dep.desc['en']['short'], dep.desc['en']['long']) = SplitDescription(stanza['pkg-description'])
                 else:
             	    if key not in KEYSTOIGNORE:
                         # Also ignore keys starting with X[A-Z]-
@@ -615,7 +625,7 @@
             # URL of a package we are dealing with a prospective package
             if dep.desc['en']['short'] != None and dep.desc['en']['long'] != None:
                 return 'prospective'
-        print >>stderr, "DEBUG: insufficient information for pkg = %s, component = %s, pkgURL = %s, Desc = %s" % \
+        print >>stderr, "Insufficient information for pkg = %s, component = %s, pkgURL = %s, Desc = %s" % \
     			 (dep.pkg, dep.component, dep.pkgURL, str(dep.desc['en']))
         return 'unknown'
 
@@ -711,7 +721,7 @@
                     # form valid URLS
                     deppkg.homepage = unicode(stanza['homepage'], 'utf-8')
                 except KeyError:
-                    deppkg.homepage = '#' # Not every package has a homepage tag
+                    deppkg.homepage = HOMEPAGENONE # Not every package has a homepage tag
                 except:
                     deppkg.homepage = '.' # Something else in case unexpected things happen
                 deppkg.version      = stanza['version'].split('-')[0]

Modified: cdd/trunk/webtools/tasks.py
==============================================================================
--- cdd/trunk/webtools/tasks.py	(original)
+++ cdd/trunk/webtools/tasks.py	Fri Jul 11 14:24:39 2008
@@ -111,6 +111,8 @@
 		# Genshi needs explicite information that it is dealing with an UTF-8 string which should not be changed
 		advertising = _(advertising)
 		data['projectadvertising'] = Markup(unicode(advertising))# , 'utf-8'))
+	else:
+		data['projectadvertising'] = None
 
 	COLORCODES = { 'official'      : _('Green: The project is <a href="#official-debs">available as an official Debian package</a>'),
     		       'unofficial'    : _('Yellow: The project is <a href="#unofficial-debs">available as an unofficial Debian package</a>'),
@@ -153,7 +155,13 @@
 	except: # simply continue if file does not exist
 		pass
 	f = open(outputfile, 'w')
-	print >> f, template.generate(**data).render('xhtml')
+	try:
+		print >> f, template.generate(**data).render('xhtml')
+	except UnicodeDecodeError, errtxt:
+		print >> stderr, \
+		    "Some critical encoding problem occured when trying to render index for lang %s.\n%s" \
+		    % (lang, errtxt)
+		
 	f.close()
 
 	for task in data['taskskeys']:



More information about the Cdd-commits mailing list