[med-svn] r1616 - trunk/community/infrastructure/scripts
tille at alioth.debian.org
tille at alioth.debian.org
Mon Mar 17 22:17:31 UTC 2008
Author: tille
Date: 2008-03-17 22:17:29 +0000 (Mon, 17 Mar 2008)
New Revision: 1616
Modified:
trunk/community/infrastructure/scripts/cddtasktools.py
Log:
Enabled comment fields starting with ^X[A-Z]*- (that do not issue a warning)
Preparation to parse DDTP translation - Interface might change!!!
Modified: trunk/community/infrastructure/scripts/cddtasktools.py
===================================================================
--- trunk/community/infrastructure/scripts/cddtasktools.py 2008-03-17 19:04:42 UTC (rev 1615)
+++ trunk/community/infrastructure/scripts/cddtasktools.py 2008-03-17 22:17:29 UTC (rev 1616)
@@ -151,11 +151,12 @@
print >>stderr, "Unknown CDD."
return None
- self.cddname = cddname
- self.tasksdir = InitTasksFiles(self.cddname)
- self.tasks = {}
- self.tasknames = []
- self.available = available
+ self.cddname = cddname
+ self.tasksdir = InitTasksFiles(self.cddname)
+ self.tasks = {}
+ self.tasknames = []
+ self.available = available
+ self.alldeps_in_main = []
def GetTasknames(self):
for task in os.listdir(self.tasksdir):
@@ -233,7 +234,8 @@
# Here only those packages are returned that are in
# Debian main, because there are no DDTP translations
# for contrib and non-free available
- ret = []
+ if self.alldeps_in_main != []:
+ return self.alldeps_in_main
if dependencytypes == ():
# official: A package with this name is found in the Debian repository
# unofficial: The tasks file contains a tag Pkg-URL for the package which is not None
@@ -252,9 +254,9 @@
for tdep in tdeps.dependencies[dep]:
# add only packages in main, because others do not have DDTP translations
if tdep.component == 'main':
- ret.append(tdep.pkg)
- ret.sort()
- return ret
+ self.alldeps_in_main.append(tdep.pkg)
+ self.alldeps_in_main.sort()
+ return self.alldeps_in_main
def GetTranslations(self, languages=()):
# Get DDTP translations for the package dependencies in a CDD
@@ -277,11 +279,12 @@
# Only main has DDTP translations
component = 'main'
+ pks2translate = self.GetAllDependantPackagesOfCDD()
+ trans = {}
for lang in languages:
# f = urllib.urlopen(DDTPURL+dist+'/'+component+DDTPDIR+'/'+lang)
- cachefile = cachedir+'/'+dist+'_'+component+'_'+lang
- print "DEBUG:", cachefile
- (file,info) = urllib.urlretrieve(DDTPURL+dist+'/'+component+DDTPDIR+lang,cachefile)
+ cachefile = cachedir+'/'+dist+'_'+component+'_'+lang+'.'+COMPRESSIONEXTENSION
+ (file,info) = urllib.urlretrieve(DDTPURL+dist+'/'+component+DDTPDIR+lang+'.'+COMPRESSIONEXTENSION,cachefile)
if COMPRESSIONEXTENSION == 'gz':
g = gzip.GzipFile(file)
elif COMPRESSIONEXTENSION == 'bz2':
@@ -290,10 +293,15 @@
print >>stderr, "Unknown compression extension " + COMPRESSIONEXTENSION
return exit(-1)
- # for stanza in deb822.Sources.iter_paragraphs(g, shared_storage=False):
+ trans[lang] = {}
+ for stanza in deb822.Sources.iter_paragraphs(g, shared_storage=False):
+ pkg = stanza['package']
+ if pkg not in pks2translate:
+ continue
+ trans[lang][pkg] = SplitDescription(stanza['description-'+lang])
+ return trans
-
class TaskDependencies:
# List of depencencies defined in one Metapackage
def __init__(self, cddname, task):
@@ -448,7 +456,9 @@
(dep.pkgShortDesc, dep.pkgLongDesc) = SplitDescription(stanza['pkg-description'])
else:
if key not in KEYSTOIGNORE:
- print "Unknown key '%s': %s" % (key, stanza[key])
+ # Also ignore keys starting with X[A-Z]-
+ if not re.compile("^X[A-Z]*-").search(key):
+ print "Unknown key '%s': %s" % (key, stanza[key])
if dep != None:
self.dependencies[self._FindDependencyType(dep)].append(dep)
More information about the debian-med-commit
mailing list