コード例 #1
0
 def patch_xml(self, patchxml, folder):
     style = patchxml.get("style", "legacy1")
     path = patchxml.get("path")
     filename = patchxml.get("name")
     
     pathname = os.path.join(path, filename)
     src = os.path.join(self.patch_dir,filename)
     dst = os.path.join(folder,pathname)
     
     if not os.path.exists(dst):
         self.iface.warn("Ignorando parche XML para %s (el fichero no existe)" % filename)
         return
     self.iface.info("Aplicando parche XML %s . . ." % filename)
     old_output = self.iface.output
     old_verbosity = self.iface.verbosity
     self.iface.verbosity -= 2
     if self.iface.verbosity < 0: self.iface.verbosity = min([0,self.iface.verbosity])
     self.iface.set_output_file(dst+".patched")
     ret = flpatchlxml.patch_lxml(self.iface,src,dst)
     self.iface.output = old_output 
     self.iface.verbosity = old_verbosity
     if not ret:
         self.iface.warn("Hubo algún problema aplicando el parche XML para %s" % filename)
         try: os.unlink(dst+".patched")
         except IOError: pass
     else:
         os.unlink(dst)
         os.rename(dst+".patched",dst)
コード例 #2
0
 def do_file_patch(self, ext, base, patch):
     try:
         ext = str(ext).upper()
         if ext == 'QS': return flpatchqs.patch_qs(self,base,patch)
         if ext == 'QSDIR': return flpatchqs.patch_qs_dir(self,base,patch)
         if ext == 'XML': return flpatchlxml.patch_lxml(self,patch,base)
         print "Unknown $ext %s" % (repr(ext))
     except Exception,e:
         self.exception(type(e).__name__,str(e))
コード例 #3
0
ファイル: __init__.py プロジェクト: sbellver/eneboo-tools
 def do_file_patch(self, ext, base, patch):
     try:
         ext = str(ext).upper()
         if ext == 'QS': return flpatchqs.patch_qs(self, base, patch)
         if ext == 'QSDIR': return flpatchqs.patch_qs_dir(self, base, patch)
         if ext == 'XML': return flpatchlxml.patch_lxml(self, patch, base)
         print "Unknown $ext %s" % (repr(ext))
     except Exception, e:
         self.exception(type(e).__name__, str(e))
コード例 #4
0
ファイル: __init__.py プロジェクト: Aulla/eneboo-tools
 def do_file_patch(self, ext, base, patch):
     try:
         ext = str(ext).upper()
         if ext == 'QS': return flpatchqs.patch_qs(self, base, patch)
         if ext == 'QSDIR': return flpatchqs.patch_qs_dir(self, base, patch)
         if ext == 'PY':
             aBase = base.split("/")
             nom = aBase[-1:][0]
             if nom.startswith("test_"):
                 return flpatchtest.patch_test(self, base, patch)
             elif nom.endswith("_ut.py"):
                 return flpatchpy.patch_py(self, base, patch)
             elif nom.endswith("_def.py"):
                 return flpatchpy.patch_py(self, base, patch)
             elif "models" in base or "pruebasqs" in base:
                 return flpatchmodel.patch_model(self, base, patch)
             else:
                 return flpatchpy.patch_py(self, base, patch)
         if ext == 'XML': return flpatchlxml.patch_lxml(self, patch, base)
         print "Unknown $ext %s" % (repr(ext))
     except Exception, e:
         self.exception(type(e).__name__, str(e))