dbrtools/dbr/dbrpatch.py
changeset 217 1eec8c29548a
parent 203 e274d29c8bc9
equal deleted inserted replaced
214:dd2b0824de90 217:1eec8c29548a
   220         db[file]['size'] = new[file]['size']
   220         db[file]['size'] = new[file]['size']
   221         db[file]['name'] = name
   221         db[file]['name'] = name
   222     return db
   222     return db
   223 
   223 
   224 def listpatches():
   224 def listpatches():
   225     path = dbrutils.patchpath()
   225     patchfiles = glob.glob(os.path.join(dbrutils.patchpath(),'patch*.txt'))
   226     patchfiles = glob.glob('%spatch*.txt' % path)
       
   227     print 'Installed patches'
   226     print 'Installed patches'
   228     for file in patchfiles:
   227     for file in patchfiles:
   229       print '\t%s' % re.sub('.txt','',os.path.basename(file))
   228       print '\t%s' % re.sub('.txt','',os.path.basename(file))
   230 
   229 
   231 def removepatch(patch):
   230 def removepatch(patch):
   232     path = dbrutils.patchpath()
   231     path = dbrutils.patchpath()
   233     file = '%s%s%s' %(path,patch,'.txt')
   232     file = os.path.join(path,'%s.txt' % patch)
   234     files = set()
   233     files = set()
   235     files.add(file)
   234     files.add(file)
   236     dbrutils.deletefiles(files)
   235     dbrutils.deletefiles(files)
   237         
   236         
   238 
   237 
   239 def loadpatches(path):
   238 def loadpatches(path):
   240     patches = dict()
   239     patches = dict()
   241     patchfiles = glob.glob('%spatch*.txt' % path)
   240     patchfiles = glob.glob(os.path.join(path,'patch*.txt'))
   242 
   241 
   243     for file in patchfiles:
   242     for file in patchfiles:
   244         print 'Loading patch: %s' % re.sub('.txt','',os.path.basename(file))
   243         print 'Loading patch: %s' % re.sub('.txt','',os.path.basename(file))
   245 #        print 'Reading: %s\n' % file
   244 #        print 'Reading: %s\n' % file
   246 #        patchname = re.match('\S+patch(\S+)\.txt',file)
   245 #        patchname = re.match('\S+patch(\S+)\.txt',file)