From 4a4ce85212411f6b1bbb7b0781d1f1e12ffc74a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B0=D0=BC=D0=BE=D1=83=D0=BA=D0=B8=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= Date: Tue, 23 Mar 2010 17:11:18 +0300 Subject: [PATCH] Fix plasma format --- pym/cl_profile.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/pym/cl_profile.py b/pym/cl_profile.py index 6cc07c0..53c372d 100644 --- a/pym/cl_profile.py +++ b/pym/cl_profile.py @@ -2313,6 +2313,9 @@ class profile(_file, _terms, xmlShare, processingTemplates): # стек глобальных переменных stackGlobalVars = [] + # директория установленных программ + basePkgDir = "/var/db/pkg" + def __init__(self, objVar, servDir=False, dirsFilter=[], filesFilter=[]): # Необрабатываемые директории self.dirsFilter = dirsFilter @@ -2677,20 +2680,19 @@ class profile(_file, _terms, xmlShare, processingTemplates): def getInstallPkgGentoo(): """Выдает два списка, инсталлированные программы и номера версий""" - baseDir = "/var/db/pkg" pkgs = [] reVer = re.compile("(?<=\-)\d+\.?\d*\.?\d*") def getFilesDir(pkgs, dirname, names): for nameFile in names: absNameFile = os.path.join(dirname,nameFile) if os.path.isdir(absNameFile): - tail = absNameFile.split(baseDir) + tail = absNameFile.split(self.basePkgDir) if len(tail)==2: tail = tail[1].split('/') if len(tail)==3 and tail[1]!='virtual': pkgs.append(tail[2]) return True - os.path.walk(baseDir,getFilesDir, pkgs) + os.path.walk(self.basePkgDir,getFilesDir, pkgs) pkgs.sort() names = [] versions = [] @@ -2724,8 +2726,6 @@ class profile(_file, _terms, xmlShare, processingTemplates): terms = funTxt[4:-1].replace(" ","") # Название программы nameProg = terms - #if "/" in terms: - #category, nameProg = if not self.installProg: self.installProg,self.installProgVersions=getInstallPkgGentoo() replace = pkg(nameProg,self.installProg,self.installProgVersions) @@ -6184,6 +6184,15 @@ class plasma(samba): "br": xmlArea.insertBefore(childNodes[it], firstChildArea) + # Добавление перевода строк в если его нет между полями + if self.docObj.getTypeField(node) == "var" and\ + node.previousSibling and\ + not (self.docObj.getTypeField(node.previousSibling) in\ + ("br","comment")): + xmlArea.insertBefore(self.docObj.createField("br", + [],"",[], + False,False), + node) # Добавляем BR если его нет первым полем xmlFields = xpath.Evaluate("child::field", xmlArea)