コード例 #1
0
 def patch_script(self, patchscript, folder):
     style = patchscript.get("style", "legacy")
     path = patchscript.get("path")
     filename = patchscript.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 QS para %s (el fichero no existe)" % filename)
         return
     self.iface.info("Aplicando parche QS %s . . ." % filename)
     old_output = self.iface.output
     old_verbosity = self.iface.verbosity
     self.iface.verbosity -= 2
     if self.iface.verbosity < 0: self.iface.verbosity = 0
     old_style, self.iface.patch_qs_style_name = self.iface.patch_qs_style_name, style
     self.iface.set_output_file(dst+".patched")
     if style in ['legacy']:
         ret = flpatchqs.patch_qs(self.iface,dst,src)
     elif style in ['qsdir']:
         ret = flpatchqs.patch_qs_dir(self.iface,dst,src)
     else:
         raise ValueError, "Estilo de parche QS desconocido: %s" % style
     self.iface.output = old_output 
     self.iface.verbosity = old_verbosity
     self.iface.patch_qs_style_name = old_style
     if not ret:
         self.iface.warn("Hubo algún problema aplicando el parche QS 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))