rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
basedir="/".join(pattern.split("/")[:-1])
basedir=os.path.dirname(pattern)
def addAllSequences(self): filelist=self._widgets["sequences_pick"].subwidget("filelist").subwidget("listbox")
self.addSequence([basedir+"/"+x for x in files])
self.addSequence([os.path.join(basedir,x) for x in files])
def addAllSequences(self): filelist=self._widgets["sequences_pick"].subwidget("filelist").subwidget("listbox")
basedir="/".join(pattern.split("/")[:-1])
basedir=os.path.dirname(pattern)
def addAllMatrices(self): filelist=self._widgets["mat_pick"].subwidget("filelist").subwidget("listbox")
self.addMatrix([basedir+"/"+x for x in files])
self.addMatrix([os.path.join(basedir,x) for x in files])
def addAllMatrices(self): filelist=self._widgets["mat_pick"].subwidget("filelist").subwidget("listbox")
raise "HPY"
def setBGfreq(self,a,c,g,t): """Sets 0-order background.
def intersection(self,other):
def intersection(self,other,common=None):
def intersection(self,other): """Returns the intersection of two PairModules.
for common in self.sNames: if other.DNApos.has_key(common): break
if not common: for common in self.sNames: if other.DNApos.has_key(common): break
def intersection(self,other): """Returns the intersection of two PairModules.
clq=self._cliques[j] strbuf.write('subgraph cluster%d {\nlabel="Clique %s";\n%s;\n\n}'%(j,j,";\n".join(["n%dC%d"%(x,j) for x in clq]))) for i in range(N): try: strbuf.write('n%dC%d [label="%s-%s CM%s"];\n'%(i,j,self._pairs[i].sNames[0][:3],self._pairs[i].sNames[1][:3],str(self._pairs[i].id[-3:]))) except AttributeError...
self.cliqueToDot(j,strbuf)
def cliquesToDot(self): strbuf=StringIO() strbuf.write("graph G {\n") N=len(self._pairs) if hasattr(self,"_cliques"): for j in range(len(self._cliques)): clq=self._cliques[j] strbuf.write('subgraph cluster%d {\nlabel="Clique %s";\n%s;\n\n}'%(j,j,";\n".join(["n%dC%d"%(x,j) for x in clq]))) for i in range(N): try: strbuf...
minnod=count
def extend2(old,ne,ce): """Extend procedure from Bron and Kerbosch""" #print old,ne,ce new=range(ce) minnod,nod=ce,0
s=pos
try: s=pos except Exception: print count,"<",minnod,old raise
def extend2(old,ne,ce): """Extend procedure from Bron and Kerbosch""" #print old,ne,ce new=range(ce) minnod,nod=ce,0
extend2(new,newne,newce)
try: extend2(new,newne,newce) except Exception: print "new:",new,newne,newce print "old:",old,ne,ce raise
def extend2(old,ne,ce): """Extend procedure from Bron and Kerbosch""" #print old,ne,ce new=range(ce) minnod,nod=ce,0
try: assert(ne<=s and not self.connected(fixp,old[s])) except AssertionError: print ne,"<=",s,self.connected(fixp,old[s]) raise
def extend2(old,ne,ce): """Extend procedure from Bron and Kerbosch""" #print old,ne,ce new=range(ce) minnod,nod=ce,0
if p==alnLen or (mult[seq1][p]>p1.sitePos[seq1][s1] and \ mult[seq2][p]>p2.sitePos[seq2][s2] and \ mult[common][p]>p2.sitePos[common][s2]):
if p==alnLen or ( (mult[seq1][p]>p1.sitePos[seq1][s1] or mult[seq1][p]==-1) and \ (mult[seq2][p]>p2.sitePos[seq2][s2] or mult[seq2][p]==-1) and \ (mult[common][p]>p2.sitePos[common][s2] or mult[common][p]==-1)):
def makeMultiAlign(self,clqId): """Makes a dictionary of arrays representing the multiple alignment from clique clqId.""" mult={} sites=[] colCount=[] clq=self._cliques[clqId] # Operate on this clique clq.sort() # Make the initial empty vectors for i in clq: for s in self._pairs[i].sNames: mult[s]=[]
seq,src,feat,start,stop,score,strand,frame,attribs=line.split('
try: seq,src,feat,start,stop,score,strand,frame,attribs=line.split(' except ValueError: print line raise
def _parseGFFfile(self,fname): """Parses the pairwise alignment GFF file.
seq2=attribs["Target"].strip('"')
try: seq2=attribs["Target"].strip('"') except TypeError: seq2=attribs["Target"].replace('"','')
def _parseGFFfile(self,fname): """Parses the pairwise alignment GFF file.
assert(lineModId==currModId)
def _parseGFFfile(self,fname): """Parses the pairwise alignment GFF file.
self.resAligns.append(mmod.makeMultiAlign(i))
try: self.resAligns.append(mmod.makeMultiAlign(i)) except AssertionError: raise
def multiAlign(self): """Compute the local multiple alignment.
if __name__=="__main__":
def apu(datat=1):
def __str__(self): strbuf=StringIO() for mod in self._modules: strbuf.write(str(mod)) return strbuf.getvalue()
a.addGFFfile("/home/kpalin/tyot/comparative/mabs/hmmyf5.align.opt.gff") a.addGFFfile("/home/kpalin/tyot/comparative/mabs/hrmyf5.align.opt.gff") a.addGFFfile("/home/kpalin/tyot/comparative/mabs/mrmyf5.align.opt.gff")
if datat==0: a.addGFFfile("/home/kpalin/tyot/comparative/mabs/hmmyf5.align.opt.gff") a.addGFFfile("/home/kpalin/tyot/comparative/mabs/hrmyf5.align.opt.gff") a.addGFFfile("/home/kpalin/tyot/comparative/mabs/mrmyf5.align.opt.gff") elif datat==1: a.addGFFfile("/home/kpalin/tyot/comparative/mabs/ENS.10ekaa.gff")
def __str__(self): strbuf=StringIO() for mod in self._modules: strbuf.write(str(mod)) return strbuf.getvalue()
import pdb
return
def __str__(self): strbuf=StringIO() for mod in self._modules: strbuf.write(str(mod)) return strbuf.getvalue()
if b==2 and c==6: print a._multiAlign[b]._cliques[6] print str(a._multiAlign[b].makeMultiAlign(c))
try: x=str(a._multiAlign[b].makeMultiAlign(c)) print x except AssertionError: pass open("tmp.%d.dot"%(b),"w").write(a._multiAlign[b].cliquesToDot()) print "Module",b,"cliques",len(a._multiAlign[b]._cliques) x=[len(x._cliques) for x in a._multiAlign] x.sort() print x if __name__=="__main__": import profile,pstats ...
def __str__(self): strbuf=StringIO() for mod in self._modules: strbuf.write(str(mod)) return strbuf.getvalue()
self.setBGFreq()
def addMatrix(self, arglist): "Arguments: filelist\nreads matrices from files" for filestring in arglist:
score of the actual matrix with respect to the background
score of the matrix with respect to the 0-order background.
def getTFBS(self, arglist): """Arguments: [bound]
self.tempFile.write(Output.get(self.__comp)) self.tempFile.flush() self.__gff=""
outData=Output.get(self.__comp) if len(outData)>0: self.tempFile.write(outData) self.tempFile.flush()
def condRemoveTmp(tmpName): try: os.remove(tmpName) except OSError: pass
if not i or len(i)<2:continue
def showMultiAlign(self,arglist): """Arguments: [minPairs] Outputs the multiple alignment to standard output. If an integer minPairs is given, no sites aligned with less than that number of pairwise alignments, is reported.""" if not hasattr(self,"malignment"): return if len(arglist)>0: minPairs=int(arglist[0]) else: m...
if len(i)<2:continue if len(self.seq)>0:
i.setAlnLimit(minPairs) if len([x for x in i.seqs if x in self.seq.getNames()])==len(i.seqs):
def saveMultiAlign(self,arglist): """Arguments: filename Outputs the multiple alignment to file 'filename'.""" fname=arglist[0] if not hasattr(self,"malignment"): print "No multiple alignment to save!" return m="w" for i in self.malignment: if len(i)<2:continue if len(self.seq)>0: i.strAln(self.seq) Output.savealign(st...
self.moreAlignments(1) print len(self.alignment.bestAlignments) for y in [(x.motif,x.score,zip(self.alignment.names,x.beginEnd,x.siteScore,x.siteSeqPos)) for x in self.alignment.bestAlignments[0]]:print y
def multiAlign(self,arglist): """Arguments: [filename[,num_of_align,[lambda[,xi[,mu[,nu,[,nuc_per_rotation]]]]]]]
cpreflen=len(os.path.commonprefix([x.fname for x in self.matlist])) for m in self.matlist: m.name=m.fname[cpreflen:]
cpreflen=len(os.path.commonprefix([os.path.dirname(x.fname) for x in self.matlist]))+1 for m in self.matlist: m.name=m.fname[cpreflen:]
def addMatrix(self, filenames): "adds new matrices from given files" for f in filenames: try: m=Matrix.Matrix(f) if self.matdict.has_key(f): pass else: print "adding %s, Info=%2.4g:"%(f,m.InfoContent) self.matlist.append(m) self.matdict[f]=m except ValueError: print "could not read",f except IOError, (errno, strerror):...
assert(DEBUGprevpos.get(seq,(0,0))[1]<end) assert(0<=end-DEBUGprevpos.get(seq,(0,end-1))[1]<1000)
assert(DEBUGprevpos.get(seq,(0,0))[1]<begin) assert(0<=begin-DEBUGprevpos.get(seq,(0,begin-1))[1]<1000)
def formatMultiAlignGFF(alignment): "Formats the multiple alignemnt for GFF file" if not alignment: return "No alignment\n" outStrIO=StringIO() # CM= Cis Module, MW = Matrix weight, COL = Column code on module GFFformat="%s\tmalign\t%s\t%d\t%d\t%4.2f\t%s\t.\tCM %d\tMW %g\tCOL %d\t%s\n" # the last %s is for inserting ...
try: token=[] while len(token)==0: try: token=raw_input("> ").split() except KeyboardInterrupt: print if self.isCommand(token[0]): comm=self.__commands[token[0]][0] num_of_args=self.__commands[token[0]][1] if num_of_args > len(token)-1: s='' if num_of_args!=1: s='s' print token[0], "needs at least ",\ num_of_ar...
token=[] while len(token)==0: try: token=raw_input("> ") except KeyboardInterrupt: print self.execute(token)
def run(self): "waits for std input and executes these commands" print 'Type "help" for more information' while(1): try: token=[] while len(token)==0: #print "> ", try: # read tokens for std input token=raw_input("> ").split() #except EOFError: # self.quit([]) except KeyboardInterrupt: print
def savealign(alignment, filename=''):
def savealign(alignment, filename,mode="w"):
def savealign(alignment, filename=''): "saves the alignment" try: #print filename F=open(filename,'w') F.write(alignment) F.close() return filename except IOError, (errno, strerror): print "I/O error(%s): %s" % (errno, strerror) return ''
F=open(filename,'w')
F=open(filename,mode)
def savealign(alignment, filename=''): "saves the alignment" try: #print filename F=open(filename,'w') F.write(alignment) F.close() return filename except IOError, (errno, strerror): print "I/O error(%s): %s" % (errno, strerror) return ''
y2add=yseq[yadded-ystart:ycoord[0]-1-ystart].lower() x2add=xseq[xadded-xstart:xcoord[0]-1-xstart].lower()
y2add=yseq[yadded-ystart:as.beginY-1-ystart].lower() x2add=xseq[xadded-xstart:as.beginX-1-xstart].lower()
def formatAlnSeq(xaln,yaln,xname,yname,xstart,ystart,linelen=60): """Formats the DNA sequence alignment output""" outstr="Sequence 1: %s\nSequence 2: %s\n\n"%(xname,yname) n=len(xaln) xpos,ypos=xstart+1,ystart+1 for i in range(0,n,linelen): xline,yline=xaln[i:i+linelen],yaln[i:i+linelen] outstr+="%7d : %s\n%7d : %s\n\n...
if len(arglist)>1: order=len(arglist[1]) else:
try: order=int(arglist[1]) except IndexError:
def _setMarkovBG(self,arglist=None): "Arguments: bgSampleSequence [order]\nBackground sample sequence and order of the model or saved background file." if len(arglist)>1: order=len(arglist[1]) else: order=4 try: self.setMarkovBG(arglist[0],order) except Exception,e: print "No such sequence or saved background (%s). Mar...
File=GzipFile(filename,'r') File.read(1) File.seek(0)
GZFile=GzipFile(None,fileobj=StringIO(fdata)) fileStr=GZFile.read()
def addSequence(self, filename): "adds Sequences from file" try: try: File=GzipFile(filename,'r') File.read(1) File.seek(0) except (NameError,IOError): File=open(filename,"r") name='' fileStr=File.read() File.close() if fileStr: if fileStr[0]=='>': toGetValue=self.readFasta(fileStr) elif len(fileStr)>1 and fileStr[:2]=...
File=open(filename,"r")
fileStr=fdata
def addSequence(self, filename): "adds Sequences from file" try: try: File=GzipFile(filename,'r') File.read(1) File.seek(0) except (NameError,IOError): File=open(filename,"r") name='' fileStr=File.read() File.close() if fileStr: if fileStr[0]=='>': toGetValue=self.readFasta(fileStr) elif len(fileStr)>1 and fileStr[:2]=...
fileStr=File.read() File.close()
def addSequence(self, filename): "adds Sequences from file" try: try: File=GzipFile(filename,'r') File.read(1) File.seek(0) except (NameError,IOError): File=open(filename,"r") name='' fileStr=File.read() File.close() if fileStr: if fileStr[0]=='>': toGetValue=self.readFasta(fileStr) elif len(fileStr)>1 and fileStr[:2]=...
except IOError, (errno, strerror): print "I/O error(%s): %s" % (errno, strerror)
except IOError, e: if type(e)==type((1,2)): (errno, strerror)=e print "I/O error(%s): %s" % (errno, strerror) else: print e
def addSequence(self, filename): "adds Sequences from file" try: try: File=GzipFile(filename,'r') File.read(1) File.seek(0) except (NameError,IOError): File=open(filename,"r") name='' fileStr=File.read() File.close() if fileStr: if fileStr[0]=='>': toGetValue=self.readFasta(fileStr) elif len(fileStr)>1 and fileStr[:2]=...
logging.exception()
logging.exception("smtp failed")
def send_message(message, recipients): """Send out a message to everyone subscribed to it.""" smtp = SMTP("localhost") for addr in recipients: if "##" in addr: (env_addr, addr) = addr.split("##") else: env_addr = addr logging.debug("Sending to %s", addr) message.replace_header("To", addr) try: smtp.sendmail("mom@ubu...
print >>f, "%s %s\n" % (package, patch)
print >>f, "%s %s" % (package, patch)
def main(): main = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "main") universe = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "universe") todo = [] todo.extend(main.items()) todo.extend(universe.items()) patches = [] for package, ubuntu_info in todo: try: patch = assay(package, ubuntu_info) if patch is not None: patches.appe...
return patch_file[:len(PATCHES_DIR) + 1]
return patch_file[len(PATCHES_DIR) + 1:]
def assay(package, ubuntu_info): """Compare the differences between a Debian and Ubuntu package.""" print print " * Processing %s" % package # Check there's still an ubuntu diff ubuntu_ver = version.Version(ubuntu_info["Version"]) if "ubuntu" not in ubuntu_info["Version"]: make_history(package) return None # Work out...
file_bug(package, component)
if len(sys.argv) <= 1: file_bug(package, component)
def main(): unstable = get_sources(DEBIAN_MIRROR, "unstable", "main") main = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "main") universe = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "universe") jobs = get_joblist() for package, component in jobs: try: print print " * Processing %s" % package (debian_info, debian_ver, ubunt...
if len(sys.argv) > 1:
if len(sys.argv) > 1 and sys.argv[1][0] != '-':
def get_joblist(): """Return (package, component) for each job.""" if len(sys.argv) > 1: return zip(sys.argv[1::2], sys.argv[2::2]) result = [] filename = update_joblist() f = open(filename) try: for line in f: result.append(line.rstrip("\n").split(" ", 1)) finally: f.close() return result
smtp.sendmail("mom@ubuntu.com", addr , message.as_string())
smtp.sendmail("mom@ubuntu.com", env_addr , message.as_string())
def send_message(message, recipients): """Send out a message to everyone subscribed to it.""" smtp = SMTP("localhost") for addr in recipients: logging.debug("Sending to %s", addr) message.replace_header("To", addr) smtp.sendmail("mom@ubuntu.com", addr , message.as_string()) smtp.quit()
% package, merged_ver, UBUNTU_DIST)
% (package, merged_ver, UBUNTU_DIST))
def add_changelog(package, merged_ver, merged_src): """Add a changelog entry to the package.""" changelog_file = "%s/debian/changelog" % merged_src changelog = open(changelog_file) new_changelog = open(changelog_file + ".new", "w") print >>new_changelog, ("%s-MERGE (%s) %s; urgency=low" % package, merged_ver, UBUNTU_D...
(merged_ver, merged_dsc, merged_patch) = merge(package, debian_ver, debian_dsc, debian_patch, ubuntu_ver, ubuntu_dsc, ubuntu_patch, base_ver, base_dsc, final_dir)
(merged_ver, merged_dsc, merged_patch, winning_side) \ = merge(package, debian_ver, debian_dsc, debian_patch, ubuntu_ver, ubuntu_dsc, ubuntu_patch, base_ver, base_dsc, final_dir)
def main(): unstable = get_sources(DEBIAN_MIRROR, "unstable", "main") main = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "main") universe = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "universe") jobs = get_joblist() for package, component in jobs: try: print print " * Processing %s" % package (debian_info, debian_ver, ubunt...
final_dir)
final_dir, winning_side)
def main(): unstable = get_sources(DEBIAN_MIRROR, "unstable", "main") main = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "main") universe = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "universe") jobs = get_joblist() for package, component in jobs: try: print print " * Processing %s" % package (debian_info, debian_ver, ubunt...
return filename
def update_joblist(): """Update the local job list cache.""" filename = "%s/needs-merged.txt" % CACHE_DIR return filename #SNARF url = JOBLIST_URL print " * Downloading %s" % url urllib.urlretrieve(url, filename) return filename
merged_src = "%s/%s_%s" % (work_dir, package, merged_ver) print " * Creating copy of %s" % package tree.copytree(ubuntu_src, merged_src) debian_hunks = read_patch(debian_patch) merged_dropped = "%s/%s_dropped.patch" % (work_dir, package) dropped = apply_patch(work_dir, debian_hunks, debian_src, ubuntu_src, base_s...
sides = (("debian", debian_patch, debian_src, "ubuntu", ubuntu_src), ("ubuntu", ubuntu_patch, ubuntu_src, "debian", debian_src)) (winning_dropped, winning_side, winning_work_dir) = (None, None, None) for right_name, right_patch, right_src, left_name, left_src in sides: merge_work_dir = "%s/%s" % (work_dir, right_name)...
def merge(package, debian_ver, debian_dsc, debian_patch, ubuntu_ver, ubuntu_dsc, ubuntu_patch, base_ver, base_dsc, final_dir): """Perform the merge and create a new source package.""" merged_ver = version.Version(str(debian_ver) + "ubuntu1") work_dir = os.path.abspath("%s/%s_%s" % (WORK_DIR, package, merged_ver)) os.m...
merged_dsc = create_source(work_dir, package, merged_ver, final_dir)
print " * Using result of applying %s patch" % winning_side merged_dsc = create_source(winning_work_dir, package, merged_ver, final_dir)
def merge(package, debian_ver, debian_dsc, debian_patch, ubuntu_ver, ubuntu_dsc, ubuntu_patch, base_ver, base_dsc, final_dir): """Perform the merge and create a new source package.""" merged_ver = version.Version(str(debian_ver) + "ubuntu1") work_dir = os.path.abspath("%s/%s_%s" % (WORK_DIR, package, merged_ver)) os.m...
return (merged_ver, merged_dsc, merged_patch)
return (merged_ver, merged_dsc, merged_patch, winning_side) def try_merge(work_dir, package, right_name, right_patch, right_src, left_name, left_src, base_src, merged_ver): """Try merging a patch onto a source package.""" merged_src = "%s/%s_%s" % (work_dir, package, merged_ver) print " * Creating copy of %s %s" % (...
def merge(package, debian_ver, debian_dsc, debian_patch, ubuntu_ver, ubuntu_dsc, ubuntu_patch, base_ver, base_dsc, final_dir): """Perform the merge and create a new source package.""" merged_ver = version.Version(str(debian_ver) + "ubuntu1") work_dir = os.path.abspath("%s/%s_%s" % (WORK_DIR, package, merged_ver)) os.m...
def apply_patch(work_dir, hunks, debian_src, ubuntu_src, base_src, merged_src,
def apply_patch(work_dir, hunks, right_src, left_src, base_src, merged_src,
def apply_patch(work_dir, hunks, debian_src, ubuntu_src, base_src, merged_src, merged_dropped): """Apply a patch decoded by read_patch to merged_src.""" pot_files = {} po_files = {} dropped = 0 for file_hdr, file_name, hunk_hdr, hunk_lines in list(hunks): if file_name.endswith("/ChangeLog"): mutate_changelog(hunk_hdr,...
if not update_pot(pot_file, debian_src, ubuntu_src, base_src, merged_src):
if not update_pot(pot_file, right_src, left_src, base_src, merged_src):
def apply_patch(work_dir, hunks, debian_src, ubuntu_src, base_src, merged_src, merged_dropped): """Apply a patch decoded by read_patch to merged_src.""" pot_files = {} po_files = {} dropped = 0 for file_hdr, file_name, hunk_hdr, hunk_lines in list(hunks): if file_name.endswith("/ChangeLog"): mutate_changelog(hunk_hdr,...
if not update_po(po_file, debian_src, ubuntu_src, base_src, merged_src):
if not update_po(po_file, right_src, left_src, base_src, merged_src):
def apply_patch(work_dir, hunks, debian_src, ubuntu_src, base_src, merged_src, merged_dropped): """Apply a patch decoded by read_patch to merged_src.""" pot_files = {} po_files = {} dropped = 0 for file_hdr, file_name, hunk_hdr, hunk_lines in list(hunks): if file_name.endswith("/ChangeLog"): mutate_changelog(hunk_hdr,...
return (dropped == 0)
return dropped
def apply_patch(work_dir, hunks, debian_src, ubuntu_src, base_src, merged_src, merged_dropped): """Apply a patch decoded by read_patch to merged_src.""" pot_files = {} po_files = {} dropped = 0 for file_hdr, file_name, hunk_hdr, hunk_lines in list(hunks): if file_name.endswith("/ChangeLog"): mutate_changelog(hunk_hdr,...
def update_pot(pot_file, debian_src, ubuntu_src, base_src, merged_src):
def update_pot(pot_file, right_src, left_src, base_src, merged_src):
def update_pot(pot_file, debian_src, ubuntu_src, base_src, merged_src): """Update a .pot file using msgcat.""" pot_file = pot_file[pot_file.index("/") + 1:] debian_pot = "%s/%s" % (debian_src, pot_file) ubuntu_pot = "%s/%s" % (ubuntu_src, pot_file) base_pot = "%s/%s" % (base_src, pot_file) merged_pot = "%s/%s" % (merg...
debian_pot = "%s/%s" % (debian_src, pot_file) ubuntu_pot = "%s/%s" % (ubuntu_src, pot_file)
right_pot = "%s/%s" % (right_src, pot_file) left_pot = "%s/%s" % (left_src, pot_file)
def update_pot(pot_file, debian_src, ubuntu_src, base_src, merged_src): """Update a .pot file using msgcat.""" pot_file = pot_file[pot_file.index("/") + 1:] debian_pot = "%s/%s" % (debian_src, pot_file) ubuntu_pot = "%s/%s" % (ubuntu_src, pot_file) base_pot = "%s/%s" % (base_src, pot_file) merged_pot = "%s/%s" % (merg...
if update_oneside(pot_file, debian_pot, ubuntu_pot, base_pot, merged_pot):
if update_oneside(pot_file, right_pot, left_pot, base_pot, merged_pot):
def update_pot(pot_file, debian_src, ubuntu_src, base_src, merged_src): """Update a .pot file using msgcat.""" pot_file = pot_file[pot_file.index("/") + 1:] debian_pot = "%s/%s" % (debian_src, pot_file) ubuntu_pot = "%s/%s" % (ubuntu_src, pot_file) base_pot = "%s/%s" % (base_src, pot_file) merged_pot = "%s/%s" % (merg...
cmd = ( "msgcat", "--use-first", "-o", merged_pot, debian_pot, ubuntu_pot )
cmd = ( "msgcat", "--use-first", "-o", merged_pot, right_pot, left_pot )
def update_pot(pot_file, debian_src, ubuntu_src, base_src, merged_src): """Update a .pot file using msgcat.""" pot_file = pot_file[pot_file.index("/") + 1:] debian_pot = "%s/%s" % (debian_src, pot_file) ubuntu_pot = "%s/%s" % (ubuntu_src, pot_file) base_pot = "%s/%s" % (base_src, pot_file) merged_pot = "%s/%s" % (merg...
def update_po(po_file, debian_src, ubuntu_src, base_src, merged_src):
def update_po(po_file, right_src, left_src, base_src, merged_src):
def update_po(po_file, debian_src, ubuntu_src, base_src, merged_src): """Update a .po file using msgcat or msgmerge.""" po_file = po_file[po_file.index("/") + 1:] debian_po = "%s/%s" % (debian_src, po_file) ubuntu_po = "%s/%s" % (ubuntu_src, po_file) base_po = "%s/%s" % (base_src, po_file) merged_po = "%s/%s" % (merge...
debian_po = "%s/%s" % (debian_src, po_file) ubuntu_po = "%s/%s" % (ubuntu_src, po_file)
right_po = "%s/%s" % (right_src, po_file) left_po = "%s/%s" % (left_src, po_file)
def update_po(po_file, debian_src, ubuntu_src, base_src, merged_src): """Update a .po file using msgcat or msgmerge.""" po_file = po_file[po_file.index("/") + 1:] debian_po = "%s/%s" % (debian_src, po_file) ubuntu_po = "%s/%s" % (ubuntu_src, po_file) base_po = "%s/%s" % (base_src, po_file) merged_po = "%s/%s" % (merge...
if update_oneside(po_file, debian_po, ubuntu_po, base_po, merged_po):
if update_oneside(po_file, right_po, left_po, base_po, merged_po):
def update_po(po_file, debian_src, ubuntu_src, base_src, merged_src): """Update a .po file using msgcat or msgmerge.""" po_file = po_file[po_file.index("/") + 1:] debian_po = "%s/%s" % (debian_src, po_file) ubuntu_po = "%s/%s" % (ubuntu_src, po_file) base_po = "%s/%s" % (base_src, po_file) merged_po = "%s/%s" % (merge...
return update_pot(po_file, debian_src, ubuntu_src, base_src, merged_src)
return update_pot(po_file, right_src, left_src, base_src, merged_src)
def update_po(po_file, debian_src, ubuntu_src, base_src, merged_src): """Update a .po file using msgcat or msgmerge.""" po_file = po_file[po_file.index("/") + 1:] debian_po = "%s/%s" % (debian_src, po_file) ubuntu_po = "%s/%s" % (ubuntu_src, po_file) base_po = "%s/%s" % (base_src, po_file) merged_po = "%s/%s" % (merge...
cmd = ( "msgmerge", "-o", merged_po, "-C", ubuntu_po, debian_po,
cmd = ( "msgmerge", "-o", merged_po, "-C", left_po, right_po,
def update_po(po_file, debian_src, ubuntu_src, base_src, merged_src): """Update a .po file using msgcat or msgmerge.""" po_file = po_file[po_file.index("/") + 1:] debian_po = "%s/%s" % (debian_src, po_file) ubuntu_po = "%s/%s" % (ubuntu_src, po_file) base_po = "%s/%s" % (base_src, po_file) merged_po = "%s/%s" % (merge...
def update_oneside(filename, debian_file, ubuntu_file, base_file, merged_file):
def update_oneside(filename, right_file, left_file, base_file, merged_file):
def update_oneside(filename, debian_file, ubuntu_file, base_file, merged_file): """Update files by copying or deleting when they only exist on one side.""" dirname = os.path.dirname(merged_file) # File removed in Ubuntu, leave it removed if os.path.exists(base_file) and not os.path.exists(ubuntu_file): print " + Lea...
if os.path.exists(base_file) and not os.path.exists(ubuntu_file): print " + Leaving %s (removed in Ubuntu)" % filename
if os.path.exists(base_file) and not os.path.exists(left_file): print " + Leaving %s (removed in left-hand)" % filename
def update_oneside(filename, debian_file, ubuntu_file, base_file, merged_file): """Update files by copying or deleting when they only exist on one side.""" dirname = os.path.dirname(merged_file) # File removed in Ubuntu, leave it removed if os.path.exists(base_file) and not os.path.exists(ubuntu_file): print " + Lea...
if os.path.exists(base_file) and not os.path.exists(debian_file):
if os.path.exists(base_file) and not os.path.exists(right_file):
def update_oneside(filename, debian_file, ubuntu_file, base_file, merged_file): """Update files by copying or deleting when they only exist on one side.""" dirname = os.path.dirname(merged_file) # File removed in Ubuntu, leave it removed if os.path.exists(base_file) and not os.path.exists(ubuntu_file): print " + Lea...
print " + Removing %s (removed in Debian)" % filename
print " + Removing %s (removed in right-hand)" % filename
def update_oneside(filename, debian_file, ubuntu_file, base_file, merged_file): """Update files by copying or deleting when they only exist on one side.""" dirname = os.path.dirname(merged_file) # File removed in Ubuntu, leave it removed if os.path.exists(base_file) and not os.path.exists(ubuntu_file): print " + Lea...
if os.path.exists(ubuntu_file) and not os.path.exists(debian_file): print " + Leaving %s (added in Ubuntu)" % filename
if os.path.exists(left_file) and not os.path.exists(right_file): print " + Leaving %s (added in left-hand)" % filename
def update_oneside(filename, debian_file, ubuntu_file, base_file, merged_file): """Update files by copying or deleting when they only exist on one side.""" dirname = os.path.dirname(merged_file) # File removed in Ubuntu, leave it removed if os.path.exists(base_file) and not os.path.exists(ubuntu_file): print " + Lea...
if os.path.exists(debian_file) and not os.path.exists(ubuntu_file):
if os.path.exists(right_file) and not os.path.exists(left_file):
def update_oneside(filename, debian_file, ubuntu_file, base_file, merged_file): """Update files by copying or deleting when they only exist on one side.""" dirname = os.path.dirname(merged_file) # File removed in Ubuntu, leave it removed if os.path.exists(base_file) and not os.path.exists(ubuntu_file): print " + Lea...
print " + Copying %s (added in Debian)" % filename shutil.copy2(debian_file, merged_file)
print " + Copying %s (added in right-hand)" % filename shutil.copy2(right_file, merged_file)
def update_oneside(filename, debian_file, ubuntu_file, base_file, merged_file): """Update files by copying or deleting when they only exist on one side.""" dirname = os.path.dirname(merged_file) # File removed in Ubuntu, leave it removed if os.path.exists(base_file) and not os.path.exists(ubuntu_file): print " + Lea...
if not os.path.exists(debian_file) and not os.path.exists(ubuntu_file): print " + Leaving %s (removed in Both)" % filename
if not os.path.exists(right_file) and not os.path.exists(left_file): print " + Leaving %s (removed in both)" % filename
def update_oneside(filename, debian_file, ubuntu_file, base_file, merged_file): """Update files by copying or deleting when they only exist on one side.""" dirname = os.path.dirname(merged_file) # File removed in Ubuntu, leave it removed if os.path.exists(base_file) and not os.path.exists(ubuntu_file): print " + Lea...
final_dir):
final_dir, winning_side):
def write_report(package, debian_ver, ubuntu_ver, base_ver, merged_ver, final_dir): """Write a little report.""" report_file = "%s/REPORT" % final_dir report = open(report_file, "w") try: print >>report, "%s -- %s" % (package, time.ctime()) print >>report print >>report, "Previous Ubuntu Version: %s" % ubuntu_ver print...
if os.path.exists("%s/%s_dropped.patch" % (final_dir, package)): print >>report, "Some Debian patch hunks were dropped, see:" print >>report, "\t%s_dropped.patch" % package
if os.path.exists("%s/%s_%s-dropped.patch" % (final_dir, package, winning_side)): print >>report, "Some %s patch hunks were dropped, see:" % winning_side.upper() print >>report, "\t%s_%s-dropped.patch" % (package, winning_side)
def write_report(package, debian_ver, ubuntu_ver, base_ver, merged_ver, final_dir): """Write a little report.""" report_file = "%s/REPORT" % final_dir report = open(report_file, "w") try: print >>report, "%s -- %s" % (package, time.ctime()) print >>report print >>report, "Previous Ubuntu Version: %s" % ubuntu_ver print...
print >>report
else: print >>report, "The %s patch applied with no errors." % winning_side print >>report
def write_report(package, debian_ver, ubuntu_ver, base_ver, merged_ver, final_dir): """Write a little report.""" report_file = "%s/REPORT" % final_dir report = open(report_file, "w") try: print >>report, "%s -- %s" % (package, time.ctime()) print >>report print >>report, "Previous Ubuntu Version: %s" % ubuntu_ver print...
mail_closures(bugs)
if len(bugs): mail_closures(bugs)
def main(options, args): distro = options.distro dist = options.suite bugs = [] # For each package in the distribution, iterate the pool and read each # changes file to obtain the list of closed bugs. for component in DISTROS[distro]["components"]: for source in get_sources(distro, dist, component): package = source[...
alias=alias, keywords="merge")
priority=priority, alias=alias, keywords="merge")
def file_bug(package, component): """File a bug, so our hard work doesn't go to waste.""" bzweb = bugzilla.WebInterface(BUGZILLA_URL) bz = bzweb.login(BUGZILLA_USERNAME, BUGZILLA_PASSWORD) if len(package) > 14: alias = "merge-%s-%s" % (package[:9], package[-4:]) else: alias = "merge-%s" % package subject = "%s: new ch...
file_bug(package)
file_bug(package, component)
def main(): unstable = get_sources(DEBIAN_MIRROR, "unstable", "main") main = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "main") universe = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "universe") jobs = get_joblist() for package, component in jobs: try: print print " * Processing %s" % package (debian_info, debian_ver, ubunt...
def file_bug(package):
def file_bug(package, component):
def file_bug(package): """File a bug, so our hard work doesn't go to waste.""" bzweb = bugzilla.WebInterface(BUGZILLA_URL) bz = bzweb.login(BUGZILLA_USERNAME, BUGZILLA_PASSWORD) alias = "merge-%s" % package subject = "%s: new changes from Debian require merging" % package comment = "New changes from Debian require ...
subject, comment, alias=alias)
subject, comment, severity=severity, alias=alias)
def file_bug(package): """File a bug, so our hard work doesn't go to waste.""" bzweb = bugzilla.WebInterface(BUGZILLA_URL) bz = bzweb.login(BUGZILLA_USERNAME, BUGZILLA_PASSWORD) alias = "merge-%s" % package subject = "%s: new changes from Debian require merging" % package comment = "New changes from Debian require ...
patch_dir = "%s/%s" % (PATCHES_DIR, package) if not os.path.isdir(patch_dir): os.makedirs(patch_dir) else: entries = os.listdir(patch_dir) for entry in entries: os.unlink(os.path.join(patch_dir, entry))
def write_analysed_patches(package, version, output): """Write result of analysing patches.""" categories = output.keys() categories.sort() for cat in categories: patch_dir = "%s/%s" % (PATCHES_DIR, package) if not os.path.isdir(patch_dir): os.makedirs(patch_dir) else: entries = os.listdir(patch_dir) for entry in entr...
update_attr(filename, right_src, left_src, base_src, merged_src)
update_attr(file_name, right_src, left_src, base_src, merged_src)
def apply_patch(work_dir, hunks, right_src, left_src, base_src, merged_src, merged_dropped): """Apply a patch decoded by read_patch to merged_src.""" pot_files = {} po_files = {} dropped = 0 for file_hdr, file_name, hunk_hdr, hunk_lines in list(hunks): update_attr(filename, right_src, left_src, base_src, merged_src) ...
assay(package, ubuntu_info)
patch = assay(package, ubuntu_info) if patch is not None: patches.append((package, patch))
def main(): main = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "main") universe = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "universe") todo = [] todo.extend(main.items()) todo.extend(universe.items()) for package, ubuntu_info in todo: try: assay(package, ubuntu_info) except Excuse, e: print >>sys.stderr, "W:", str(e) cont...
return
return None
def assay(package, ubuntu_info): """Compare the differences between a Debian and Ubuntu package.""" print print " * Processing %s" % package # Check there's still an ubuntu diff ubuntu_ver = version.Version(ubuntu_info["Version"]) if "ubuntu" not in ubuntu_info["Version"]: make_history(package) return # Work out the ...
nag_msg = "This is a reminder, further changes have occured in Debian\n"
nag_msg = "This is a reminder, further changes have occurred in Debian\n"
def file_bug(package, component): """File a bug, so our hard work doesn't go to waste.""" bzweb = bugzilla.WebInterface(BUGZILLA_URL) bz = bzweb.login(BUGZILLA_USERNAME, BUGZILLA_PASSWORD) alias = "merge-%s" % package subject = "%s: new changes from Debian require merging" % package comment = "New changes from Debia...
file_bug(package)
try: file_bug(package) except Exception, e: print >>sys.stderr, "W: Unable to file bug: %s" % str(e)
def main(): unstable = get_sources(DEBIAN_MIRROR, "unstable", "main") main = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "main") universe = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "universe") jobs = get_joblist() for package, component in jobs: try: print print " * Processing %s" % package (debian_info, debian_ver, ubunt...
analyse_patch(package, ubuntu_ver, ubuntu_patch)
def main(): unstable = get_sources(DEBIAN_MIRROR, "unstable", "main") main = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "main") universe = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "universe") jobs = get_joblist() for package, component in jobs: try: print print " * Processing %s" % package (debian_info, debian_ver, ubunt...
filename = "%s/%s/%s_%s.patch" % (FINAL_DIR, package, package, name)
if name is not None: filename = "%s/%s/%s_%s.patch" % (FINAL_DIR, package, package, name) else: filename = "%s/%s/%s_%s.patch" % (PATCHES_DIR, package, package, diff)
def create_patch(name, package, base, diff): """Create patches between two unpacked sources.""" filename = "%s/%s/%s_%s.patch" % (FINAL_DIR, package, package, name) base_dir = "%s_%s" % (package, base) diff_dir = "%s_%s" % (package, diff) print " * Creating %s_%s.patch (%s -> %s)" % (package, name, base, diff) output...
if not os.path.isdir(patch_dir): os.makedirs(patch_dir) else: entries = os.listdir(patch_dir) for entry in entries: os.unlink(os.path.join(patch_dir, entry))
def write_analysed_patches(package, version, output): """Write result of analysing patches.""" patch_dir = "%s/%s" % (PATCHES_DIR, package) if not os.path.isdir(patch_dir): os.makedirs(patch_dir) else: entries = os.listdir(patch_dir) for entry in entries: os.unlink(os.path.join(patch_dir, entry)) categories = output.k...
if len(sys.argv) <= 1:
if len(sys.argv) <= 1 and component != "universe":
def main(): unstable = get_sources(DEBIAN_MIRROR, "unstable", "main") main = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "main") universe = get_sources(UBUNTU_MIRROR, UBUNTU_DIST, "universe") jobs = get_joblist() for package, component in jobs: try: print print " * Processing %s" % package (debian_info, debian_ver, ubunt...
return myenv.SharedLibrary(target, source. LIBS=LIBS)
return myenv.SharedLibrary(target, source, LIBS=LIBS)
def SharedLibraryIncomplete(self, target, source, LIBS=None): """Like SharedLibrary, but don't insist that all symbols are resolved""" myenv = self.Clone() if myenv['PLATFORM'] == 'darwin': myenv['SHLINKFLAGS'] += " -undefined suppress -flat_namespace" return myenv.SharedLibrary(target, source. LIBS=LIBS)
PathOption(p, "Specify the location of %s" % p, dir)
PathOption(p, "Specify the location of %s" % p, dir), PathOption(p + "Include", "Specify the location of %s's include files" % p, dir and dir + "/include" or None), PathOption(p + "Lib", "Specify the location of %s's libraries" % p, dir and dir + "/lib" or None),
def my_excepthook(type, value, tb): print >> sys.stderr, "Error:", value sys.exit(1)
errors = []
def my_excepthook(type, value, tb): print >> sys.stderr, "Error:", value sys.exit(1)
errors = "" for key in ARGUMENTS.keys(): errors += " %s=%s" % (key, ARGUMENTS[key]) if errors: msg = "Unprocessed arguments:%s" % errors if HelpFlagIsSet(): print >> sys.stderr, msg elif traceback: raise RuntimeError, msg else: sys.excepthook(RuntimeError, msg, None)
def my_excepthook(type, value, tb): print >> sys.stderr, "Error:", value sys.exit(1)
"""If product, product-include, or product-lib is set in ARGUMENTS,
"""If product, productInclude, or productLib is set in ARGUMENTS,
def searchArgumentsForDirs(ARGUMENTS, product): """If product, product-include, or product-lib is set in ARGUMENTS, return a triple of all three values, and delete the ARGUMENTS""" product_include = product + "-include" product_lib = product + "-lib" # # Set ARGUMENTS[product] if either of product-{include,lib} is set ...
product_include = product + "-include" product_lib = product + "-lib"
product_include = product + "Include" product_lib = product + "Lib"
def searchArgumentsForDirs(ARGUMENTS, product): """If product, product-include, or product-lib is set in ARGUMENTS, return a triple of all three values, and delete the ARGUMENTS""" product_include = product + "-include" product_lib = product + "-lib" # # Set ARGUMENTS[product] if either of product-{include,lib} is set ...
"""If product, product-include, or product-lib is set in env,
"""If product, productInclude, or productLib is set in env,
def searchEnvForDirs(env, product): """If product, product-include, or product-lib is set in env, return a triple of all three values""" product_include = product + "-include" product_lib = product + "-lib" # ARGUMENTS = {} for k in [product, product_include, product_lib]: try: ARGUMENTS[k] = env[k] except KeyError: pa...
product_include = product + "-include" product_lib = product + "-lib"
product_include = product + "Include" product_lib = product + "Lib"
def searchEnvForDirs(env, product): """If product, product-include, or product-lib is set in env, return a triple of all three values""" product_include = product + "-include" product_lib = product + "-lib" # ARGUMENTS = {} for k in [product, product_include, product_lib]: try: ARGUMENTS[k] = env[k] except KeyError: pa...
sdef.setPermission('Modify portal content', 0, ['M', 'a', 'n', 'a', 'g', 'e', 'r'])
sdef.setPermission('Modify portal content', 1, ['Manager'])
sdef = wf.states['published']
except ExitNow:
except asyncore.ExitNow:
def poll(self): results = asyncore.poller.poll(0) for fd, flags in results: obj = asyncore.socket_map.get(fd) if obj is None: self.logger.warning('Invalid FD for poll() - %d', fd) try: if flags & (select.POLLIN | select.POLLPRI): obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() if flags & (s...