rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') | opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vxa') | def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg print __doc__%globals() sys.exit(2) # Begin SLB 2/24/99: Added extra_roots variable to # collect extra roots. extra_roots = [] # End SLB 2/24/99 for o, a in opts: if o == '-R': restart = 1 if o == '-d': dumpfile = a if o == '-m': maxpage = string.atoi(a) if o == '-n': norun = 1 if o == '-q': verbose = 0 if o == '-r': roundsize = string.atoi(a) # Begin SLB 2/24/99: Added processing for # -t option. if o == '-t': extra_roots.append(a) # End SLB 2/24/99 if o == '-v': verbose = verbose + 1 if o == '-x': checkext = not checkext if verbose > 0: print AGENTNAME, "version", __version__ if restart: c = load_pickle(dumpfile=dumpfile, verbose=verbose) else: c = Checker() c.setflags(checkext=checkext, verbose=verbose, maxpage=maxpage, roundsize=roundsize) if not restart and not args: args.append(DEFROOT) for arg in args: c.addroot(arg) # Begin SLB 2/24/99. The -t flag is only needed if external # links are not to be checked. So -t values are ignored unless # -x was specified. if not checkext: for root in extra_roots: # Make sure it's terminated by a slash, # so that addroot doesn't discard the last # directory component. if root[-1] != "/": root = root + "/" c.addroot(root) # End SLB 2/24/99 try: if not norun: try: c.run() except KeyboardInterrupt: if verbose > 0: print "[run interrupted]" try: c.report() except KeyboardInterrupt: if verbose > 0: print "[report interrupted]" finally: if c.save_pickle(dumpfile): if dumpfile == DUMPFILE: print "Use ``%s -R'' to restart." % sys.argv[0] else: print "Use ``%s -R -d %s'' to restart." % (sys.argv[0], dumpfile) | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
if o == '-t': extra_roots.append(a) | if o == '-t': extra_roots.append(a) if o == '-a': nonames = not nonames | def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg print __doc__%globals() sys.exit(2) # Begin SLB 2/24/99: Added extra_roots variable to # collect extra roots. extra_roots = [] # End SLB 2/24/99 for o, a in opts: if o == '-R': restart = 1 if o == '-d': dumpfile = a if o == '-m': maxpage = string.atoi(a) if o == '-n': norun = 1 if o == '-q': verbose = 0 if o == '-r': roundsize = string.atoi(a) # Begin SLB 2/24/99: Added processing for # -t option. if o == '-t': extra_roots.append(a) # End SLB 2/24/99 if o == '-v': verbose = verbose + 1 if o == '-x': checkext = not checkext if verbose > 0: print AGENTNAME, "version", __version__ if restart: c = load_pickle(dumpfile=dumpfile, verbose=verbose) else: c = Checker() c.setflags(checkext=checkext, verbose=verbose, maxpage=maxpage, roundsize=roundsize) if not restart and not args: args.append(DEFROOT) for arg in args: c.addroot(arg) # Begin SLB 2/24/99. The -t flag is only needed if external # links are not to be checked. So -t values are ignored unless # -x was specified. if not checkext: for root in extra_roots: # Make sure it's terminated by a slash, # so that addroot doesn't discard the last # directory component. if root[-1] != "/": root = root + "/" c.addroot(root) # End SLB 2/24/99 try: if not norun: try: c.run() except KeyboardInterrupt: if verbose > 0: print "[run interrupted]" try: c.report() except KeyboardInterrupt: if verbose > 0: print "[report interrupted]" finally: if c.save_pickle(dumpfile): if dumpfile == DUMPFILE: print "Use ``%s -R'' to restart." % sys.argv[0] else: print "Use ``%s -R -d %s'' to restart." % (sys.argv[0], dumpfile) | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
maxpage=maxpage, roundsize=roundsize) | maxpage=maxpage, roundsize=roundsize, nonames=nonames ) | def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg print __doc__%globals() sys.exit(2) # Begin SLB 2/24/99: Added extra_roots variable to # collect extra roots. extra_roots = [] # End SLB 2/24/99 for o, a in opts: if o == '-R': restart = 1 if o == '-d': dumpfile = a if o == '-m': maxpage = string.atoi(a) if o == '-n': norun = 1 if o == '-q': verbose = 0 if o == '-r': roundsize = string.atoi(a) # Begin SLB 2/24/99: Added processing for # -t option. if o == '-t': extra_roots.append(a) # End SLB 2/24/99 if o == '-v': verbose = verbose + 1 if o == '-x': checkext = not checkext if verbose > 0: print AGENTNAME, "version", __version__ if restart: c = load_pickle(dumpfile=dumpfile, verbose=verbose) else: c = Checker() c.setflags(checkext=checkext, verbose=verbose, maxpage=maxpage, roundsize=roundsize) if not restart and not args: args.append(DEFROOT) for arg in args: c.addroot(arg) # Begin SLB 2/24/99. The -t flag is only needed if external # links are not to be checked. So -t values are ignored unless # -x was specified. if not checkext: for root in extra_roots: # Make sure it's terminated by a slash, # so that addroot doesn't discard the last # directory component. if root[-1] != "/": root = root + "/" c.addroot(root) # End SLB 2/24/99 try: if not norun: try: c.run() except KeyboardInterrupt: if verbose > 0: print "[run interrupted]" try: c.report() except KeyboardInterrupt: if verbose > 0: print "[report interrupted]" finally: if c.save_pickle(dumpfile): if dumpfile == DUMPFILE: print "Use ``%s -R'' to restart." % sys.argv[0] else: print "Use ``%s -R -d %s'' to restart." % (sys.argv[0], dumpfile) | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
for root in extra_roots: if root[-1] != "/": root = root + "/" c.addroot(root) | for root in extra_roots: if root[-1] != "/": root = root + "/" c.addroot(root, add_to_do = 0) | def main(): checkext = CHECKEXT verbose = VERBOSE maxpage = MAXPAGE roundsize = ROUNDSIZE dumpfile = DUMPFILE restart = 0 norun = 0 try: # Begin SLB 2/24/99: Added -t option here. opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vx') # End SLB 2/24/99 except getopt.error, msg: sys.stdout = sys.stderr print msg print __doc__%globals() sys.exit(2) # Begin SLB 2/24/99: Added extra_roots variable to # collect extra roots. extra_roots = [] # End SLB 2/24/99 for o, a in opts: if o == '-R': restart = 1 if o == '-d': dumpfile = a if o == '-m': maxpage = string.atoi(a) if o == '-n': norun = 1 if o == '-q': verbose = 0 if o == '-r': roundsize = string.atoi(a) # Begin SLB 2/24/99: Added processing for # -t option. if o == '-t': extra_roots.append(a) # End SLB 2/24/99 if o == '-v': verbose = verbose + 1 if o == '-x': checkext = not checkext if verbose > 0: print AGENTNAME, "version", __version__ if restart: c = load_pickle(dumpfile=dumpfile, verbose=verbose) else: c = Checker() c.setflags(checkext=checkext, verbose=verbose, maxpage=maxpage, roundsize=roundsize) if not restart and not args: args.append(DEFROOT) for arg in args: c.addroot(arg) # Begin SLB 2/24/99. The -t flag is only needed if external # links are not to be checked. So -t values are ignored unless # -x was specified. if not checkext: for root in extra_roots: # Make sure it's terminated by a slash, # so that addroot doesn't discard the last # directory component. if root[-1] != "/": root = root + "/" c.addroot(root) # End SLB 2/24/99 try: if not norun: try: c.run() except KeyboardInterrupt: if verbose > 0: print "[run interrupted]" try: c.report() except KeyboardInterrupt: if verbose > 0: print "[report interrupted]" finally: if c.save_pickle(dumpfile): if dumpfile == DUMPFILE: print "Use ``%s -R'' to restart." % sys.argv[0] else: print "Use ``%s -R -d %s'' to restart." % (sys.argv[0], dumpfile) | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
self.name_table = {} | self.name_table = {} | def reset(self): self.roots = [] self.todo = {} self.done = {} self.bad = {} | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
def reset(self): self.roots = [] self.todo = {} self.done = {} self.bad = {} | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
||
def note(self, level, format, *args): if self.verbose > level: if args: format = format%args self.message(format) | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
||
def addroot(self, root): | def addroot(self, root, add_to_do = 1): | def addroot(self, root): if root not in self.roots: troot = root scheme, netloc, path, params, query, fragment = \ urlparse.urlparse(root) i = string.rfind(path, "/") + 1 if 0 < i < len(path): path = path[:i] troot = urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) self.roots.append(troot) self.addrobot(root) # Begin SLB 2/24/99: Modified this call to respect # the fact that the "done" and "todo" dictionaries # are now (URL, fragment) pairs self.newlink((root, ""), ("<root>", root)) # End SLB 2/24/99 | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
self.newlink((root, ""), ("<root>", root)) | if add_to_do: self.newlink((root, ""), ("<root>", root)) | def addroot(self, root): if root not in self.roots: troot = root scheme, netloc, path, params, query, fragment = \ urlparse.urlparse(root) i = string.rfind(path, "/") + 1 if 0 < i < len(path): path = path[:i] troot = urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) self.roots.append(troot) self.addrobot(root) # Begin SLB 2/24/99: Modified this call to respect # the fact that the "done" and "todo" dictionaries # are now (URL, fragment) pairs self.newlink((root, ""), ("<root>", root)) # End SLB 2/24/99 | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
for url, rawlink, msg in triples: | for url, rawlink, msg in triples: | def report_errors(self): if not self.bad: self.message("\nNo errors") return self.message("\nError Report:") sources = self.errors.keys() sources.sort() for source in sources: triples = self.errors[source] self.message("") if len(triples) > 1: self.message("%d Errors in %s", len(triples), source) else: self.message("Error in %s", source) # Begin SLB 2/24/99: Modified this loop to # call self.format_url() instead of referring # to the URL directly, since the URLs in these # triples is now a (URL, fragment) pair. The value # of the "source" variable comes from the list of # origins, and is a URL, not a pair. for url, rawlink, msg in triples: if rawlink != self.format_url(url): s = " (%s)" % rawlink else: s = "" self.message(" HREF %s%s\n msg %s", self.format_url(url), s, msg) # End SLB 2/24/99. | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
self.format_url(url), s, msg) | self.format_url(url), s, msg) | def report_errors(self): if not self.bad: self.message("\nNo errors") return self.message("\nError Report:") sources = self.errors.keys() sources.sort() for source in sources: triples = self.errors[source] self.message("") if len(triples) > 1: self.message("%d Errors in %s", len(triples), source) else: self.message("Error in %s", source) # Begin SLB 2/24/99: Modified this loop to # call self.format_url() instead of referring # to the URL directly, since the URLs in these # triples is now a (URL, fragment) pair. The value # of the "source" variable comes from the list of # origins, and is a URL, not a pair. for url, rawlink, msg in triples: if rawlink != self.format_url(url): s = " (%s)" % rawlink else: s = "" self.message(" HREF %s%s\n msg %s", self.format_url(url), s, msg) # End SLB 2/24/99. | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
def dopage(self, url_pair): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
||
" from", self.todo[url_pair]) | " from", self.todo[url_pair]) | def dopage(self, url_pair): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
url, local_fragment = url_pair self.name_table[url] = page if local_fragment and local_fragment not in page.getnames(): self.setbad(url_pair, ("Missing name anchor `%s'" % local_fragment)) for info in page.getlinkinfos(): | self.name_table[url] = page if local_fragment and local_fragment not in page.getnames(): self.setbad(url_pair, ("Missing name anchor `%s'" % local_fragment)) for info in page.getlinkinfos(): | def dopage(self, url_pair): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
def dopage(self, url_pair): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
||
else: self.name_table[url_pair[0]] = None | else: self.name_table[url_pair[0]] = None | def dopage(self, url_pair): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
def dopage(self, url_pair): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
||
self.done[url].append(origin) | if origin not in self.done[url]: self.done[url].append(origin) | def newdonelink(self, url, origin): self.done[url].append(origin) | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
if self.bad.has_key(url): source, rawlink = origin triple = url, rawlink, self.bad[url] self.seterror(source, triple) | def newdonelink(self, url, origin): self.done[url].append(origin) | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
|
def newtodolink(self, url, origin): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
||
self.todo[url].append(origin) | if origin not in self.todo[url]: self.todo[url].append(origin) | def newtodolink(self, url, origin): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
def newtodolink(self, url, origin): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
||
def format_url(self, url): link, fragment = url if fragment: return link + " else: return link | def format_url(self, url): link, fragment = url if fragment: return link + " else: return link | def format_url(self, url): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
def inroots(self, url): for root in self.roots: if url[:len(root)] == root: return self.isallowed(root, url) return 0 | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
||
url, fragment = url_pair if self.name_table.has_key(url): return self.name_table[url] | url, fragment = url_pair if self.name_table.has_key(url): return self.name_table[url] | def getpage(self, url_pair): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
def getpage(self, url_pair): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
||
def getpage(self, url_pair): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
||
url, fragment = url_pair | url, fragment = url_pair | def readhtml(self, url_pair): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
url, fragment = url_pair | url, fragment = url_pair | def openhtml(self, url_pair): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
url, fragment = url_pair | url, fragment = url_pair | def openpage(self, url_pair): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
def setbad(self, url, msg): if self.bad.has_key(url) and self.bad[url] == msg: self.note(0, "(Seen this error before)") return self.bad[url] = msg self.changed = 1 self.markerror(url) | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
||
if triple not in self.errors[url]: self.errors[url].append(triple) | if triple not in self.errors[url]: self.errors[url].append(triple) | def seterror(self, url, triple): try: # Begin SLB 2/24/99: Because of the way the # URLs are now processed, I need to check to make # sure the URL hasn't been entered in the error list. # The first element of the triple here is a (URL, fragment) # pair, but the URL key is not, since it's from the # list of origins. if triple not in self.errors[url]: | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
size = len(self.text) | size = len(self.text) | def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
return | return | def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
checker=self.checker) | checker=self.checker) | def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
def __init__(self, text, url, verbose=VERBOSE, maxpage=MAXPAGE, checker=None): self.text = text self.url = url self.verbose = verbose self.maxpage = maxpage self.checker = checker | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
||
return self.parser.names | return self.parser.names | def getnames(self): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
if not self.parser: return [] | if not self.parser: return [] | def getlinkinfos(self): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
fragment = t[-1] | fragment = t[-1] | def getlinkinfos(self): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
infos.append((link, rawlink, fragment)) | infos.append((link, rawlink, fragment)) | def getlinkinfos(self): | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
if path[-1] != os.sep: url = url + '/' | def open_file(self, url): path = urllib.url2pathname(urllib.unquote(url)) if path[-1] != os.sep: url = url + '/' if os.path.isdir(path): indexpath = os.path.join(path, "index.html") if os.path.exists(indexpath): return self.open_file(url + "index.html") try: names = os.listdir(path) except os.error, msg: raise IOError, msg, sys.exc_traceback names.sort() s = MyStringIO("file:"+url, {'content-type': 'text/html'}) s.write('<BASE HREF="file:%s">\n' % urllib.quote(os.path.join(path, ""))) for name in names: q = urllib.quote(name) s.write('<A HREF="%s">%s</A>\n' % (q, q)) s.seek(0) return s return urllib.FancyURLopener.open_file(self, path) | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
|
return urllib.FancyURLopener.open_file(self, path) | return urllib.FancyURLopener.open_file(self, url) | def open_file(self, url): path = urllib.url2pathname(urllib.unquote(url)) if path[-1] != os.sep: url = url + '/' if os.path.isdir(path): indexpath = os.path.join(path, "index.html") if os.path.exists(indexpath): return self.open_file(url + "index.html") try: names = os.listdir(path) except os.error, msg: raise IOError, msg, sys.exc_traceback names.sort() s = MyStringIO("file:"+url, {'content-type': 'text/html'}) s.write('<BASE HREF="file:%s">\n' % urllib.quote(os.path.join(path, ""))) for name in names: q = urllib.quote(name) s.write('<A HREF="%s">%s</A>\n' % (q, q)) s.seek(0) return s return urllib.FancyURLopener.open_file(self, path) | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
self.names = [] self.url = url | self.names = [] self.url = url | def __init__(self, url, verbose=VERBOSE, checker=None): self.myverbose = verbose # now unused self.checker = checker self.base = None self.links = {} | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
for name, value in attributes: if name == "name": if value in self.names: self.checker.message("WARNING: duplicate name %s in %s", value, self.url) else: self.names.append(value) break | for name, value in attributes: if name == "name": if value in self.names: self.checker.message("WARNING: duplicate name %s in %s", value, self.url) else: self.names.append(value) break | def start_a(self, attributes): self.link_attr(attributes, 'href') | f97eecccb714a71cf5a1ca9399cd9c579014a5b9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f97eecccb714a71cf5a1ca9399cd9c579014a5b9/wcnew.py |
(1, Complex(0,10), 'TypeError'), | (1, Complex(0,10), 1), | def test(): testsuite = { 'a+b': [ (1, 10, 11), (1, Complex(0,10), Complex(1,10)), (Complex(0,10), 1, Complex(1,10)), (Complex(0,10), Complex(1), Complex(1,10)), (Complex(1), Complex(0,10), Complex(1,10)), ], 'a-b': [ (1, 10, -9), (1, Complex(0,10), Complex(1,-10)), (Complex(0,10), 1, Complex(-1,10)), (Complex(0,10), Complex(1), Complex(-1,10)), (Complex(1), Complex(0,10), Complex(1,-10)), ], 'a*b': [ (1, 10, 10), (1, Complex(0,10), Complex(0, 10)), (Complex(0,10), 1, Complex(0,10)), (Complex(0,10), Complex(1), Complex(0,10)), (Complex(1), Complex(0,10), Complex(0,10)), ], 'a/b': [ (1., 10, 0.1), (1, Complex(0,10), Complex(0, -0.1)), (Complex(0, 10), 1, Complex(0, 10)), (Complex(0, 10), Complex(1), Complex(0, 10)), (Complex(1), Complex(0,10), Complex(0, -0.1)), ], 'pow(a,b)': [ (1, 10, 1), (1, Complex(0,10), 'TypeError'), (Complex(0,10), 1, Complex(0,10)), (Complex(0,10), Complex(1), Complex(0,10)), (Complex(1), Complex(0,10), 'TypeError'), (2, Complex(4,0), 16), ], 'cmp(a,b)': [ (1, 10, -1), (1, Complex(0,10), 1), (Complex(0,10), 1, -1), (Complex(0,10), Complex(1), -1), (Complex(1), Complex(0,10), 1), ], } exprs = testsuite.keys() exprs.sort() for expr in exprs: print expr + ':' t = (expr,) for item in testsuite[expr]: apply(checkop, t+item) | 1a24bb53d562444fad22880a3606ed91c4f66057 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1a24bb53d562444fad22880a3606ed91c4f66057/Complex.py |
(Complex(1), Complex(0,10), 'TypeError'), | (Complex(1), Complex(0,10), 1), | def test(): testsuite = { 'a+b': [ (1, 10, 11), (1, Complex(0,10), Complex(1,10)), (Complex(0,10), 1, Complex(1,10)), (Complex(0,10), Complex(1), Complex(1,10)), (Complex(1), Complex(0,10), Complex(1,10)), ], 'a-b': [ (1, 10, -9), (1, Complex(0,10), Complex(1,-10)), (Complex(0,10), 1, Complex(-1,10)), (Complex(0,10), Complex(1), Complex(-1,10)), (Complex(1), Complex(0,10), Complex(1,-10)), ], 'a*b': [ (1, 10, 10), (1, Complex(0,10), Complex(0, 10)), (Complex(0,10), 1, Complex(0,10)), (Complex(0,10), Complex(1), Complex(0,10)), (Complex(1), Complex(0,10), Complex(0,10)), ], 'a/b': [ (1., 10, 0.1), (1, Complex(0,10), Complex(0, -0.1)), (Complex(0, 10), 1, Complex(0, 10)), (Complex(0, 10), Complex(1), Complex(0, 10)), (Complex(1), Complex(0,10), Complex(0, -0.1)), ], 'pow(a,b)': [ (1, 10, 1), (1, Complex(0,10), 'TypeError'), (Complex(0,10), 1, Complex(0,10)), (Complex(0,10), Complex(1), Complex(0,10)), (Complex(1), Complex(0,10), 'TypeError'), (2, Complex(4,0), 16), ], 'cmp(a,b)': [ (1, 10, -1), (1, Complex(0,10), 1), (Complex(0,10), 1, -1), (Complex(0,10), Complex(1), -1), (Complex(1), Complex(0,10), 1), ], } exprs = testsuite.keys() exprs.sort() for expr in exprs: print expr + ':' t = (expr,) for item in testsuite[expr]: apply(checkop, t+item) | 1a24bb53d562444fad22880a3606ed91c4f66057 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1a24bb53d562444fad22880a3606ed91c4f66057/Complex.py |
import os | import os, fcntl | def export_add(self, x, y): return x + y | 3a97605500919ceeff8c6cd2dd7d352baa1142d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3a97605500919ceeff8c6cd2dd7d352baa1142d8/SimpleXMLRPCServer.py |
import string str = '' email = '' comment = '' | token = [] tokens = [] | def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email) | 7883e1dfbda28cf23085fa01e9e40d4bef9ee19b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7883e1dfbda28cf23085fa01e9e40d4bef9ee19b/rfc822.py |
bracket = 0 seen_bracket = 0 | def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email) | 7883e1dfbda28cf23085fa01e9e40d4bef9ee19b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7883e1dfbda28cf23085fa01e9e40d4bef9ee19b/rfc822.py |
|
str = str + c | token.append(c) | def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email) | 7883e1dfbda28cf23085fa01e9e40d4bef9ee19b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7883e1dfbda28cf23085fa01e9e40d4bef9ee19b/rfc822.py |
continue | def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email) | 7883e1dfbda28cf23085fa01e9e40d4bef9ee19b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7883e1dfbda28cf23085fa01e9e40d4bef9ee19b/rfc822.py |
|
str = str + c | token.append(c) | def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email) | 7883e1dfbda28cf23085fa01e9e40d4bef9ee19b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7883e1dfbda28cf23085fa01e9e40d4bef9ee19b/rfc822.py |
continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 | was_quoted = 1 continue | def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email) | 7883e1dfbda28cf23085fa01e9e40d4bef9ee19b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7883e1dfbda28cf23085fa01e9e40d4bef9ee19b/rfc822.py |
str = str + c continue if c == ')': | elif c == ')': | def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email) | 7883e1dfbda28cf23085fa01e9e40d4bef9ee19b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7883e1dfbda28cf23085fa01e9e40d4bef9ee19b/rfc822.py |
comment = comment + str str = '' | token = string.join(token, '') tokens.append((2, token)) token = [] | def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email) | 7883e1dfbda28cf23085fa01e9e40d4bef9ee19b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7883e1dfbda28cf23085fa01e9e40d4bef9ee19b/rfc822.py |
paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' | paren = 1 token = string.join(token, '') tokens.append((was_quoted, token)) was_quoted = 0 token = [] continue if c in string.whitespace: space = 1 continue if c in '<>@,;:.[]': token = string.join(token, '') tokens.append((was_quoted, token)) was_quoted = 0 token = [] tokens.append((0, c)) space = 0 continue if space: token = string.join(token, '') tokens.append((was_quoted, token)) was_quoted = 0 token = [] space = 0 token.append(c) token = string.join(token, '') tokens.append((was_quoted, token)) if (0, '<') in tokens: name = [] addr = [] cur = name for token in tokens: if token[1] == '': | def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email) | 7883e1dfbda28cf23085fa01e9e40d4bef9ee19b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7883e1dfbda28cf23085fa01e9e40d4bef9ee19b/rfc822.py |
if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == ' break str = str + c if str: if seen_bracket: if bracket: email = str | if token == (0, '<'): if addr: raise error, 'syntax error' cur = addr elif token == (0, '>'): if cur is not addr: raise error, 'syntax error' cur = name elif token[0] == 2: if cur is name: name.append('(' + token[1] + ')') else: name.append(token[1]) elif token[0] == 1 and cur is addr: if specials.search(token[1]) >= 0: cur.append(quote(token[1])) else: cur.append(token[1]) | def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email) | 7883e1dfbda28cf23085fa01e9e40d4bef9ee19b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7883e1dfbda28cf23085fa01e9e40d4bef9ee19b/rfc822.py |
comment = comment + str else: if paren: comment = comment + str | cur.append(token[1]) else: name = [] addr = [] for token in tokens: if token[1] == '': continue if token[0] == 2: name.append(token[1]) elif token[0] == 1: if specials.search(token[1]) >= 0: addr.append(quote(token[1])) else: addr.append(token[1]) | def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email) | 7883e1dfbda28cf23085fa01e9e40d4bef9ee19b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7883e1dfbda28cf23085fa01e9e40d4bef9ee19b/rfc822.py |
email = email + str return string.strip(comment), string.strip(email) | addr.append(token[1]) return string.join(name, ' '), string.join(addr, '') | def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email) | 7883e1dfbda28cf23085fa01e9e40d4bef9ee19b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7883e1dfbda28cf23085fa01e9e40d4bef9ee19b/rfc822.py |
meta = '\n <meta name="aesop" content="%s">' | meta = '<meta name="aesop" content="%s">\n ' % self.aesop_type | def get_header(self): s = HEAD % self.variables if self.uplink: if self.uptitle: link = ('<link rel="up" href="%s" title="%s">' % (self.uplink, self.uptitle)) else: link = '<link rel="up" href="%s">' % self.uplink repl = " %s\n</head>" % link s = s.replace("</head>", repl, 1) if self.aesop_type: meta = '\n <meta name="aesop" content="%s">' # Insert this in the middle of the head that's been # generated so far, keeping <meta> and <link> elements in # neat groups: s = s.replace("<link ", meta + "<link ", 1) return s | b07216b43ad3e375e2a4a80c726bae618c329553 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b07216b43ad3e375e2a4a80c726bae618c329553/support.py |
fp = open(findfile('audiotest.au'), 'rb') | datadir = os.path.join(os.path.dirname(landmark), 'data', '') fp = open(findfile('audiotest.au', datadir), 'rb') | def setUp(self): # In Python, audiotest.au lives in Lib/test not Lib/test/data fp = open(findfile('audiotest.au'), 'rb') try: self._audiodata = fp.read() finally: fp.close() self._au = MIMEAudio(self._audiodata) | f29ffbdbf5a70f5230ce130372055924f71277a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f29ffbdbf5a70f5230ce130372055924f71277a6/test_email.py |
n = int(s.rstrip(NUL) or "0", 8) | n = int(s.rstrip(NUL + " ") or "0", 8) | def nti(s): """Convert a number field to a python number. """ # There are two possible encodings for a number field, see # itn() below. if s[0] != chr(0200): n = int(s.rstrip(NUL) or "0", 8) else: n = 0L for i in xrange(len(s) - 1): n <<= 8 n += ord(s[i + 1]) return n | 35207712dcfef23dea29d83e4d3d15fcab38b55e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/35207712dcfef23dea29d83e4d3d15fcab38b55e/tarfile.py |
if not args: usage('hostname missing') host = args[0] | def main(): global verbose, interactive, mac, rmok, nologin try: opts, args = getopt.getopt(sys.argv[1:], 'a:bil:mnp:qrs:v') except getopt.error, msg: usage(msg) login = '' passwd = '' account = '' for o, a in opts: if o == '-l': login = a if o == '-p': passwd = a if o == '-a': account = a if o == '-v': verbose = verbose + 1 if o == '-q': verbose = 0 if o == '-i': interactive = 1 if o == '-m': mac = 1; nologin = 1; skippats.append('*.o') if o == '-n': nologin = 1 if o == '-r': rmok = 1 if o == '-s': skippats.append(a) if not args: usage('hostname missing') host = args[0] remotedir = '' localdir = '' if args[1:]: remotedir = args[1] if args[2:]: localdir = args[2] if args[3:]: usage('too many arguments') # f = ftplib.FTP() if verbose: print 'Connecting to %s...' % `host` f.connect(host) if not nologin: if verbose: print 'Logging in as %s...' % `login or 'anonymous'` f.login(login, passwd, account) if verbose: print 'OK.' pwd = f.pwd() if verbose > 1: print 'PWD =', `pwd` if remotedir: if verbose > 1: print 'cwd(%s)' % `remotedir` f.cwd(remotedir) if verbose > 1: print 'OK.' pwd = f.pwd() if verbose > 1: print 'PWD =', `pwd` # mirrorsubdir(f, localdir) | a4debfffc98f05bff35bb1abc08a749e1753b983 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a4debfffc98f05bff35bb1abc08a749e1753b983/ftpmirror.py |
|
builtin = r"([^\\.]\b|^)" + any("BUILTIN", builtinlist) + r"\b" | builtin = r"([^.'\"\\]\b|^)" + any("BUILTIN", builtinlist) + r"\b" | def make_pat(): kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b" builtinlist = [str(name) for name in dir(__builtin__) if not name.startswith('_')] builtin = r"([^\\.]\b|^)" + any("BUILTIN", builtinlist) + r"\b" comment = any("COMMENT", [r"#[^\n]*"]) sqstring = r"(\b[rR])?'[^'\\\n]*(\\.[^'\\\n]*)*'?" dqstring = r'(\b[rR])?"[^"\\\n]*(\\.[^"\\\n]*)*"?' sq3string = r"(\b[rR])?'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?" dq3string = r'(\b[rR])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?' string = any("STRING", [sq3string, dq3string, sqstring, dqstring]) return kw + "|" + builtin + "|" + comment + "|" + string + "|" + any("SYNC", [r"\n"]) | 0bc3d9857f571021f7c2ccebe1967f4f87cb3e21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bc3d9857f571021f7c2ccebe1967f4f87cb3e21/ColorDelegator.py |
return kw + "|" + builtin + "|" + comment + "|" + string + "|" + any("SYNC", [r"\n"]) | return kw + "|" + builtin + "|" + comment + "|" + string +\ "|" + any("SYNC", [r"\n"]) | def make_pat(): kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b" builtinlist = [str(name) for name in dir(__builtin__) if not name.startswith('_')] builtin = r"([^\\.]\b|^)" + any("BUILTIN", builtinlist) + r"\b" comment = any("COMMENT", [r"#[^\n]*"]) sqstring = r"(\b[rR])?'[^'\\\n]*(\\.[^'\\\n]*)*'?" dqstring = r'(\b[rR])?"[^"\\\n]*(\\.[^"\\\n]*)*"?' sq3string = r"(\b[rR])?'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?" dq3string = r'(\b[rR])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?' string = any("STRING", [sq3string, dq3string, sqstring, dqstring]) return kw + "|" + builtin + "|" + comment + "|" + string + "|" + any("SYNC", [r"\n"]) | 0bc3d9857f571021f7c2ccebe1967f4f87cb3e21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bc3d9857f571021f7c2ccebe1967f4f87cb3e21/ColorDelegator.py |
allow_colorizing = 1 colorizing = 0 | allow_colorizing = True colorizing = False | def delete(self, index1, index2=None): index1 = self.index(index1) self.delegate.delete(index1, index2) self.notify_range(index1) | 0bc3d9857f571021f7c2ccebe1967f4f87cb3e21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bc3d9857f571021f7c2ccebe1967f4f87cb3e21/ColorDelegator.py |
self.stop_colorizing = 1 | self.stop_colorizing = True | def notify_range(self, index1, index2=None): self.tag_add("TODO", index1, index2) if self.after_id: if DEBUG: print "colorizing already scheduled" return if self.colorizing: self.stop_colorizing = 1 if DEBUG: print "stop colorizing" if self.allow_colorizing: if DEBUG: print "schedule colorizing" self.after_id = self.after(1, self.recolorize) | 0bc3d9857f571021f7c2ccebe1967f4f87cb3e21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bc3d9857f571021f7c2ccebe1967f4f87cb3e21/ColorDelegator.py |
self.allow_colorizing = 0 self.stop_colorizing = 1 | self.allow_colorizing = False self.stop_colorizing = True | def close(self, close_when_done=None): if self.after_id: after_id = self.after_id self.after_id = None if DEBUG: print "cancel scheduled recolorizer" self.after_cancel(after_id) self.allow_colorizing = 0 self.stop_colorizing = 1 if close_when_done: if not self.colorizing: close_when_done.destroy() else: self.close_when_done = close_when_done | 0bc3d9857f571021f7c2ccebe1967f4f87cb3e21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bc3d9857f571021f7c2ccebe1967f4f87cb3e21/ColorDelegator.py |
self.stop_colorizing = 1 | self.stop_colorizing = True | def toggle_colorize_event(self, event): if self.after_id: after_id = self.after_id self.after_id = None if DEBUG: print "cancel scheduled recolorizer" self.after_cancel(after_id) if self.allow_colorizing and self.colorizing: if DEBUG: print "stop colorizing" self.stop_colorizing = 1 self.allow_colorizing = not self.allow_colorizing if self.allow_colorizing and not self.colorizing: self.after_id = self.after(1, self.recolorize) if DEBUG: print "auto colorizing turned", self.allow_colorizing and "on" or "off" return "break" | 0bc3d9857f571021f7c2ccebe1967f4f87cb3e21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bc3d9857f571021f7c2ccebe1967f4f87cb3e21/ColorDelegator.py |
print "auto colorizing turned", self.allow_colorizing and "on" or "off" | print "auto colorizing turned",\ self.allow_colorizing and "on" or "off" | def toggle_colorize_event(self, event): if self.after_id: after_id = self.after_id self.after_id = None if DEBUG: print "cancel scheduled recolorizer" self.after_cancel(after_id) if self.allow_colorizing and self.colorizing: if DEBUG: print "stop colorizing" self.stop_colorizing = 1 self.allow_colorizing = not self.allow_colorizing if self.allow_colorizing and not self.colorizing: self.after_id = self.after(1, self.recolorize) if DEBUG: print "auto colorizing turned", self.allow_colorizing and "on" or "off" return "break" | 0bc3d9857f571021f7c2ccebe1967f4f87cb3e21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bc3d9857f571021f7c2ccebe1967f4f87cb3e21/ColorDelegator.py |
self.stop_colorizing = 0 self.colorizing = 1 | self.stop_colorizing = False self.colorizing = True | def recolorize(self): self.after_id = None if not self.delegate: if DEBUG: print "no delegate" return if not self.allow_colorizing: if DEBUG: print "auto colorizing is off" return if self.colorizing: if DEBUG: print "already colorizing" return try: self.stop_colorizing = 0 self.colorizing = 1 if DEBUG: print "colorizing..." t0 = time.clock() self.recolorize_main() t1 = time.clock() if DEBUG: print "%.3f seconds" % (t1-t0) finally: self.colorizing = 0 if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"): if DEBUG: print "reschedule colorizing" self.after_id = self.after(1, self.recolorize) if self.close_when_done: top = self.close_when_done self.close_when_done = None top.destroy() | 0bc3d9857f571021f7c2ccebe1967f4f87cb3e21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bc3d9857f571021f7c2ccebe1967f4f87cb3e21/ColorDelegator.py |
self.colorizing = 0 | self.colorizing = False | def recolorize(self): self.after_id = None if not self.delegate: if DEBUG: print "no delegate" return if not self.allow_colorizing: if DEBUG: print "auto colorizing is off" return if self.colorizing: if DEBUG: print "already colorizing" return try: self.stop_colorizing = 0 self.colorizing = 1 if DEBUG: print "colorizing..." t0 = time.clock() self.recolorize_main() t1 = time.clock() if DEBUG: print "%.3f seconds" % (t1-t0) finally: self.colorizing = 0 if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"): if DEBUG: print "reschedule colorizing" self.after_id = self.after(1, self.recolorize) if self.close_when_done: top = self.close_when_done self.close_when_done = None top.destroy() | 0bc3d9857f571021f7c2ccebe1967f4f87cb3e21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bc3d9857f571021f7c2ccebe1967f4f87cb3e21/ColorDelegator.py |
while 1: | while True: | def recolorize_main(self): next = "1.0" while 1: item = self.tag_nextrange("TODO", next) if not item: break head, tail = item self.tag_remove("SYNC", head, tail) item = self.tag_prevrange("SYNC", head) if item: head = item[1] else: head = "1.0" | 0bc3d9857f571021f7c2ccebe1967f4f87cb3e21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bc3d9857f571021f7c2ccebe1967f4f87cb3e21/ColorDelegator.py |
ok = 0 | ok = False | def recolorize_main(self): next = "1.0" while 1: item = self.tag_nextrange("TODO", next) if not item: break head, tail = item self.tag_remove("SYNC", head, tail) item = self.tag_prevrange("SYNC", head) if item: head = item[1] else: head = "1.0" | 0bc3d9857f571021f7c2ccebe1967f4f87cb3e21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bc3d9857f571021f7c2ccebe1967f4f87cb3e21/ColorDelegator.py |
while 1: | while True: | def recolorize_main(self): next = "1.0" while 1: item = self.tag_nextrange("TODO", next) if not item: break head, tail = item self.tag_remove("SYNC", head, tail) item = self.tag_prevrange("SYNC", head) if item: head = item[1] else: head = "1.0" | 0bc3d9857f571021f7c2ccebe1967f4f87cb3e21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bc3d9857f571021f7c2ccebe1967f4f87cb3e21/ColorDelegator.py |
ok = 0 | ok = False | def recolorize_main(self): next = "1.0" while 1: item = self.tag_nextrange("TODO", next) if not item: break head, tail = item self.tag_remove("SYNC", head, tail) item = self.tag_prevrange("SYNC", head) if item: head = item[1] else: head = "1.0" | 0bc3d9857f571021f7c2ccebe1967f4f87cb3e21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bc3d9857f571021f7c2ccebe1967f4f87cb3e21/ColorDelegator.py |
def __init__(self, root=None, font=None, name=None, **options): | def __init__(self, root=None, font=None, name=None, exists=False, **options): | def __init__(self, root=None, font=None, name=None, **options): if not root: root = Tkinter._default_root if font: # get actual settings corresponding to the given font font = root.tk.splitlist(root.tk.call("font", "actual", font)) else: font = self._set(options) if not name: name = "font" + str(id(self)) self.name = name root.tk.call("font", "create", name, *font) # backlinks! self._root = root self._split = root.tk.splitlist self._call = root.tk.call | fe84d17a6a3e255191f664c5609a061a9bb70c60 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fe84d17a6a3e255191f664c5609a061a9bb70c60/tkFont.py |
root.tk.call("font", "create", name, *font) | if exists: self.delete_font = False if self.name not in root.tk.call("font", "names"): raise Tkinter._tkinter.TclError, "named font %s does not already exist" % (self.name,) if font: print "font=%r" % font root.tk.call("font", "configure", self.name, *font) else: root.tk.call("font", "create", self.name, *font) self.delete_font = True | def __init__(self, root=None, font=None, name=None, **options): if not root: root = Tkinter._default_root if font: # get actual settings corresponding to the given font font = root.tk.splitlist(root.tk.call("font", "actual", font)) else: font = self._set(options) if not name: name = "font" + str(id(self)) self.name = name root.tk.call("font", "create", name, *font) # backlinks! self._root = root self._split = root.tk.splitlist self._call = root.tk.call | fe84d17a6a3e255191f664c5609a061a9bb70c60 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fe84d17a6a3e255191f664c5609a061a9bb70c60/tkFont.py |
self._call("font", "delete", self.name) | if self.delete_font: self._call("font", "delete", self.name) | def __del__(self): try: self._call("font", "delete", self.name) except (AttributeError, Tkinter.TclError): pass | fe84d17a6a3e255191f664c5609a061a9bb70c60 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fe84d17a6a3e255191f664c5609a061a9bb70c60/tkFont.py |
def __del__(self): try: self._call("font", "delete", self.name) except (AttributeError, Tkinter.TclError): pass | fe84d17a6a3e255191f664c5609a061a9bb70c60 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fe84d17a6a3e255191f664c5609a061a9bb70c60/tkFont.py |
||
name = `id(self)` | Image._last_id += 1 name = "pyimage" +`Image._last_id` | def __init__(self, imgtype, name=None, cnf={}, master=None, **kw): self.name = None if not master: master = _default_root if not master: raise RuntimeError, 'Too early to create image' self.tk = master.tk if not name: name = `id(self)` # The following is needed for systems where id(x) # can return a negative number, such as Linux/m68k: if name[0] == '-': name = '_' + name[1:] if kw and cnf: cnf = _cnfmerge((cnf, kw)) elif kw: cnf = kw options = () for k, v in cnf.items(): if callable(v): v = self._register(v) options = options + ('-'+k, v) self.tk.call(('image', 'create', imgtype, name,) + options) self.name = name | 0d8ce6111c16c23c87afc2b06e60bb1b61f75746 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0d8ce6111c16c23c87afc2b06e60bb1b61f75746/Tkinter.py |
def _handle_long_word(self, chunks, cur_line, cur_len, width): | def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width): | def _handle_long_word(self, chunks, cur_line, cur_len, width): """_handle_long_word(chunks : [string], cur_line : [string], cur_len : int, width : int) | 8bfa8935ea2fc645e5f166f180c2ba18cf11ade3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8bfa8935ea2fc645e5f166f180c2ba18cf11ade3/textwrap.py |
cur_line.append(chunks[0][0:space_left]) chunks[0] = chunks[0][space_left:] | cur_line.append(reversed_chunks[-1][:space_left]) reversed_chunks[-1] = reversed_chunks[-1][space_left:] | def _handle_long_word(self, chunks, cur_line, cur_len, width): """_handle_long_word(chunks : [string], cur_line : [string], cur_len : int, width : int) | 8bfa8935ea2fc645e5f166f180c2ba18cf11ade3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8bfa8935ea2fc645e5f166f180c2ba18cf11ade3/textwrap.py |
cur_line.append(chunks.pop(0)) | cur_line.append(reversed_chunks.pop()) | def _handle_long_word(self, chunks, cur_line, cur_len, width): """_handle_long_word(chunks : [string], cur_line : [string], cur_len : int, width : int) | 8bfa8935ea2fc645e5f166f180c2ba18cf11ade3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8bfa8935ea2fc645e5f166f180c2ba18cf11ade3/textwrap.py |
if chunks[0].strip() == '' and lines: del chunks[0] | if chunks[-1].strip() == '' and lines: del chunks[-1] | def _wrap_chunks(self, chunks): """_wrap_chunks(chunks : [string]) -> [string] | 8bfa8935ea2fc645e5f166f180c2ba18cf11ade3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8bfa8935ea2fc645e5f166f180c2ba18cf11ade3/textwrap.py |
l = len(chunks[0]) | l = len(chunks[-1]) | def _wrap_chunks(self, chunks): """_wrap_chunks(chunks : [string]) -> [string] | 8bfa8935ea2fc645e5f166f180c2ba18cf11ade3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8bfa8935ea2fc645e5f166f180c2ba18cf11ade3/textwrap.py |
cur_line.append(chunks.pop(0)) | cur_line.append(chunks.pop()) | def _wrap_chunks(self, chunks): """_wrap_chunks(chunks : [string]) -> [string] | 8bfa8935ea2fc645e5f166f180c2ba18cf11ade3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8bfa8935ea2fc645e5f166f180c2ba18cf11ade3/textwrap.py |
if chunks and len(chunks[0]) > width: | if chunks and len(chunks[-1]) > width: | def _wrap_chunks(self, chunks): """_wrap_chunks(chunks : [string]) -> [string] | 8bfa8935ea2fc645e5f166f180c2ba18cf11ade3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8bfa8935ea2fc645e5f166f180c2ba18cf11ade3/textwrap.py |
dry_run=0): CCompiler.__init__ (self, verbose, dry_run) | dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) | def __init__ (self, verbose=0, dry_run=0): | 4fecfce4d09eca422af8ad60363bc83005b7c032 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4fecfce4d09eca422af8ad60363bc83005b7c032/unixccompiler.py |
skipped = newer_pairwise (sources, objects) for skipped_pair in skipped: self.announce ("skipping %s (%s up-to-date)" % skipped_pair) | if not self.force: skipped = newer_pairwise (sources, objects) for skipped_pair in skipped: self.announce ("skipping %s (%s up-to-date)" % skipped_pair) | def compile (self, sources, output_dir=None, macros=None, includes=None, extra_preargs=None, extra_postargs=None): | 4fecfce4d09eca422af8ad60363bc83005b7c032 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4fecfce4d09eca422af8ad60363bc83005b7c032/unixccompiler.py |
lib_opts = gen_lib_options (self.library_dirs + library_dirs, self.libraries + libraries, "-L%s", "-l%s") | lib_opts = gen_lib_options (self, self.library_dirs + library_dirs, self.libraries + libraries) | def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, extra_preargs=None, extra_postargs=None): | 4fecfce4d09eca422af8ad60363bc83005b7c032 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4fecfce4d09eca422af8ad60363bc83005b7c032/unixccompiler.py |
try: newer = newer_group (objects, output_filename) except OSError: if self.dry_run: newer = 1 else: raise if newer: ld_args = self.ldflags_shared + lib_opts + \ objects + ['-o', output_filename] | if not self.force: try: newer = newer_group (objects, output_filename) except OSError: if self.dry_run: newer = 1 else: raise if self.force or newer: ld_args = self.ldflags_shared + objects + \ lib_opts + ['-o', output_filename] | def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, extra_preargs=None, extra_postargs=None): | 4fecfce4d09eca422af8ad60363bc83005b7c032 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4fecfce4d09eca422af8ad60363bc83005b7c032/unixccompiler.py |
return "lib%s%s" % (libname, self._static_lib_ext ) | return "lib%s%s" % (libname, self._static_lib_ext) | def library_filename (self, libname): return "lib%s%s" % (libname, self._static_lib_ext ) | 4fecfce4d09eca422af8ad60363bc83005b7c032 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4fecfce4d09eca422af8ad60363bc83005b7c032/unixccompiler.py |
return "lib%s%s" % (libname, self._shared_lib_ext ) | return "lib%s%s" % (libname, self._shared_lib_ext) def library_dir_option (self, dir): return "-L" + dir def library_option (self, lib): return "-l" + lib def find_library_file (self, dirs, lib): for dir in dirs: shared = os.path.join (dir, self.shared_library_filename (lib)) static = os.path.join (dir, self.library_filename (lib)) if os.path.exists (shared): return shared elif os.path.exists (static): return static else: return None | def shared_library_filename (self, libname): return "lib%s%s" % (libname, self._shared_lib_ext ) | 4fecfce4d09eca422af8ad60363bc83005b7c032 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4fecfce4d09eca422af8ad60363bc83005b7c032/unixccompiler.py |
def fileConfig(fname): | def fileConfig(fname, defaults=None): | def fileConfig(fname): """ Read the logging configuration from a ConfigParser-format file. This can be called several times from an application, allowing an end user the ability to select from various pre-canned configurations (if the developer provides a mechanism to present the choices and load the chosen configuration). In versions of ConfigParser which have the readfp method [typically shipped in 2.x versions of Python], you can pass in a file-like object rather than a filename, in which case the file-like object will be read using readfp. """ import ConfigParser cp = ConfigParser.ConfigParser() if hasattr(cp, 'readfp') and hasattr(fname, 'readline'): cp.readfp(fname) else: cp.read(fname) #first, do the formatters... flist = cp.get("formatters", "keys") if len(flist): flist = string.split(flist, ",") formatters = {} for form in flist: sectname = "formatter_%s" % form opts = cp.options(sectname) if "format" in opts: fs = cp.get(sectname, "format", 1) else: fs = None if "datefmt" in opts: dfs = cp.get(sectname, "datefmt", 1) else: dfs = None f = logging.Formatter(fs, dfs) formatters[form] = f #next, do the handlers... #critical section... logging._acquireLock() try: try: #first, lose the existing handlers... logging._handlers.clear() #now set up the new ones... hlist = cp.get("handlers", "keys") if len(hlist): hlist = string.split(hlist, ",") handlers = {} fixups = [] #for inter-handler references for hand in hlist: sectname = "handler_%s" % hand klass = cp.get(sectname, "class") opts = cp.options(sectname) if "formatter" in opts: fmt = cp.get(sectname, "formatter") else: fmt = "" klass = eval(klass, vars(logging)) args = cp.get(sectname, "args") args = eval(args, vars(logging)) h = apply(klass, args) if "level" in opts: level = cp.get(sectname, "level") h.setLevel(logging._levelNames[level]) if len(fmt): h.setFormatter(formatters[fmt]) #temporary hack for FileHandler and MemoryHandler. if klass == logging.handlers.MemoryHandler: if "target" in opts: target = cp.get(sectname,"target") else: target = "" if len(target): #the target handler may not be loaded yet, so keep for later... fixups.append((h, target)) handlers[hand] = h #now all handlers are loaded, fixup inter-handler references... for fixup in fixups: h = fixup[0] t = fixup[1] h.setTarget(handlers[t]) #at last, the loggers...first the root... llist = cp.get("loggers", "keys") llist = string.split(llist, ",") llist.remove("root") sectname = "logger_root" root = logging.root log = root opts = cp.options(sectname) if "level" in opts: level = cp.get(sectname, "level") log.setLevel(logging._levelNames[level]) for h in root.handlers: root.removeHandler(h) hlist = cp.get(sectname, "handlers") if len(hlist): hlist = string.split(hlist, ",") for hand in hlist: log.addHandler(handlers[hand]) #and now the others... #we don't want to lose the existing loggers, #since other threads may have pointers to them. #existing is set to contain all existing loggers, #and as we go through the new configuration we #remove any which are configured. At the end, #what's left in existing is the set of loggers #which were in the previous configuration but #which are not in the new configuration. existing = root.manager.loggerDict.keys() #now set up the new ones... for log in llist: sectname = "logger_%s" % log qn = cp.get(sectname, "qualname") opts = cp.options(sectname) if "propagate" in opts: propagate = cp.getint(sectname, "propagate") else: propagate = 1 logger = logging.getLogger(qn) if qn in existing: existing.remove(qn) if "level" in opts: level = cp.get(sectname, "level") logger.setLevel(logging._levelNames[level]) for h in logger.handlers: logger.removeHandler(h) logger.propagate = propagate logger.disabled = 0 hlist = cp.get(sectname, "handlers") if len(hlist): hlist = string.split(hlist, ",") for hand in hlist: logger.addHandler(handlers[hand]) #Disable any old loggers. There's no point deleting #them as other threads may continue to hold references #and by disabling them, you stop them doing any logging. for log in existing: root.manager.loggerDict[log].disabled = 1 except: import traceback ei = sys.exc_info() traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr) del ei finally: logging._releaseLock() | 3165786dd19fca1b967b2f4c782d20bc2339a6e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3165786dd19fca1b967b2f4c782d20bc2339a6e3/config.py |
cp = ConfigParser.ConfigParser() | cp = ConfigParser.ConfigParser(defaults) | def fileConfig(fname): """ Read the logging configuration from a ConfigParser-format file. This can be called several times from an application, allowing an end user the ability to select from various pre-canned configurations (if the developer provides a mechanism to present the choices and load the chosen configuration). In versions of ConfigParser which have the readfp method [typically shipped in 2.x versions of Python], you can pass in a file-like object rather than a filename, in which case the file-like object will be read using readfp. """ import ConfigParser cp = ConfigParser.ConfigParser() if hasattr(cp, 'readfp') and hasattr(fname, 'readline'): cp.readfp(fname) else: cp.read(fname) #first, do the formatters... flist = cp.get("formatters", "keys") if len(flist): flist = string.split(flist, ",") formatters = {} for form in flist: sectname = "formatter_%s" % form opts = cp.options(sectname) if "format" in opts: fs = cp.get(sectname, "format", 1) else: fs = None if "datefmt" in opts: dfs = cp.get(sectname, "datefmt", 1) else: dfs = None f = logging.Formatter(fs, dfs) formatters[form] = f #next, do the handlers... #critical section... logging._acquireLock() try: try: #first, lose the existing handlers... logging._handlers.clear() #now set up the new ones... hlist = cp.get("handlers", "keys") if len(hlist): hlist = string.split(hlist, ",") handlers = {} fixups = [] #for inter-handler references for hand in hlist: sectname = "handler_%s" % hand klass = cp.get(sectname, "class") opts = cp.options(sectname) if "formatter" in opts: fmt = cp.get(sectname, "formatter") else: fmt = "" klass = eval(klass, vars(logging)) args = cp.get(sectname, "args") args = eval(args, vars(logging)) h = apply(klass, args) if "level" in opts: level = cp.get(sectname, "level") h.setLevel(logging._levelNames[level]) if len(fmt): h.setFormatter(formatters[fmt]) #temporary hack for FileHandler and MemoryHandler. if klass == logging.handlers.MemoryHandler: if "target" in opts: target = cp.get(sectname,"target") else: target = "" if len(target): #the target handler may not be loaded yet, so keep for later... fixups.append((h, target)) handlers[hand] = h #now all handlers are loaded, fixup inter-handler references... for fixup in fixups: h = fixup[0] t = fixup[1] h.setTarget(handlers[t]) #at last, the loggers...first the root... llist = cp.get("loggers", "keys") llist = string.split(llist, ",") llist.remove("root") sectname = "logger_root" root = logging.root log = root opts = cp.options(sectname) if "level" in opts: level = cp.get(sectname, "level") log.setLevel(logging._levelNames[level]) for h in root.handlers: root.removeHandler(h) hlist = cp.get(sectname, "handlers") if len(hlist): hlist = string.split(hlist, ",") for hand in hlist: log.addHandler(handlers[hand]) #and now the others... #we don't want to lose the existing loggers, #since other threads may have pointers to them. #existing is set to contain all existing loggers, #and as we go through the new configuration we #remove any which are configured. At the end, #what's left in existing is the set of loggers #which were in the previous configuration but #which are not in the new configuration. existing = root.manager.loggerDict.keys() #now set up the new ones... for log in llist: sectname = "logger_%s" % log qn = cp.get(sectname, "qualname") opts = cp.options(sectname) if "propagate" in opts: propagate = cp.getint(sectname, "propagate") else: propagate = 1 logger = logging.getLogger(qn) if qn in existing: existing.remove(qn) if "level" in opts: level = cp.get(sectname, "level") logger.setLevel(logging._levelNames[level]) for h in logger.handlers: logger.removeHandler(h) logger.propagate = propagate logger.disabled = 0 hlist = cp.get(sectname, "handlers") if len(hlist): hlist = string.split(hlist, ",") for hand in hlist: logger.addHandler(handlers[hand]) #Disable any old loggers. There's no point deleting #them as other threads may continue to hold references #and by disabling them, you stop them doing any logging. for log in existing: root.manager.loggerDict[log].disabled = 1 except: import traceback ei = sys.exc_info() traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr) del ei finally: logging._releaseLock() | 3165786dd19fca1b967b2f4c782d20bc2339a6e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3165786dd19fca1b967b2f4c782d20bc2339a6e3/config.py |
opts, args = getopt.getopt(sys.argv[1:], 'e:p:') | opts, args = getopt.getopt(sys.argv[1:], 'e:p:P:') | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:') except getopt.error, msg: usage('getopt error: ' + str(msg)) # proces option arguments for o, a in opts: if o == '-e': extensions.append(a) if o == '-p': prefix = a # locations derived from options binlib = os.path.join(prefix, 'lib/python/lib') incldir = os.path.join(prefix, 'include/Py') config_c_in = os.path.join(binlib, 'config.c.in') frozenmain_c = os.path.join(binlib, 'frozenmain.c') makefile_in = os.path.join(binlib, 'Makefile') defines = ['-DHAVE_CONFIG_H', '-DUSE_FROZEN', '-DNO_MAIN', '-DPYTHONPATH=\\"$(PYTHONPATH)\\"'] includes = ['-I' + incldir, '-I' + binlib] # sanity check of directories and files for dir in [prefix, binlib, incldir] + extensions: if not os.path.exists(dir): usage('needed directory %s not found' % dir) if not os.path.isdir(dir): usage('%s: not a directory' % dir) for file in config_c_in, makefile_in, frozenmain_c: if not os.path.exists(file): usage('needed file %s not found' % file) if not os.path.isfile(file): usage('%s: not a plain file' % file) for dir in extensions: setup = os.path.join(dir, 'Setup') if not os.path.exists(setup): usage('needed file %s not found' % setup) if not os.path.isfile(setup): usage('%s: not a plain file' % setup) # check that enough arguments are passed if not args: usage('at least one filename argument required') # check that file arguments exist for arg in args: if not os.path.exists(arg): usage('argument %s not found' % arg) if not os.path.isfile(arg): usage('%s: not a plain file' % arg) # process non-option arguments scriptfile = args[0] modules = args[1:] # derive target name from script name base = os.path.basename(scriptfile) base, ext = os.path.splitext(base) if base: if base != scriptfile: target = base else: target = base + '.bin' # Actual work starts here... dict = findmodules.findmodules(scriptfile, modules, path) backup = frozen_c + '~' try: os.rename(frozen_c, backup) except os.error: backup = None outfp = open(frozen_c, 'w') try: makefreeze.makefreeze(outfp, dict) finally: outfp.close() if backup: if cmp.cmp(backup, frozen_c): sys.stderr.write('%s not changed, not written\n' % frozen_c) os.rename(backup, frozen_c) builtins = [] unknown = [] mods = dict.keys() mods.sort() for mod in mods: if dict[mod] == '<builtin>': builtins.append(mod) elif dict[mod] == '<unknown>': unknown.append(mod) addfiles = [] if unknown: addfiles, addmods = \ checkextensions.checkextensions(unknown, extensions) for mod in addmods: unknown.remove(mod) builtins = builtins + addmods if unknown: sys.stderr.write('Warning: unknown modules remain: %s\n' % string.join(unknown)) builtins.sort() infp = open(config_c_in) backup = config_c + '~' try: os.rename(config_c, backup) except os.error: backup = None outfp = open(config_c, 'w') try: makeconfig.makeconfig(infp, outfp, builtins) finally: outfp.close() infp.close() if backup: if cmp.cmp(backup, config_c): sys.stderr.write('%s not changed, not written\n' % config_c) os.rename(backup, config_c) cflags = defines + includes + ['$(OPT)'] libs = [] for n in 'Modules', 'Python', 'Objects', 'Parser': n = 'lib%s.a' % n n = os.path.join(binlib, n) libs.append(n) makevars = parsesetup.getmakevars(makefile_in) somevars = {} for key in makevars.keys(): somevars[key] = makevars[key] somevars['CFLAGS'] = string.join(cflags) # override files = ['$(OPT)', config_c, frozen_c, frozenmain_c] + \ addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] backup = makefile + '~' try: os.rename(makefile, backup) except os.error: backup = None outfp = open(makefile, 'w') try: makemakefile.makemakefile(outfp, somevars, files, target) finally: outfp.close() if backup: if not cmp.cmp(backup, makefile): print 'previous Makefile saved as', backup else: sys.stderr.write('%s not changed, not written\n' % makefile) os.rename(backup, makefile) # Done! print 'Now run make to build the target:', target | 150316ee2e7db3d0ad633f2dbe53a066add49e45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/150316ee2e7db3d0ad633f2dbe53a066add49e45/freeze.py |
binlib = os.path.join(prefix, 'lib/python/lib') | binlib = os.path.join(exec_prefix, 'lib/python/lib') | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:') except getopt.error, msg: usage('getopt error: ' + str(msg)) # proces option arguments for o, a in opts: if o == '-e': extensions.append(a) if o == '-p': prefix = a # locations derived from options binlib = os.path.join(prefix, 'lib/python/lib') incldir = os.path.join(prefix, 'include/Py') config_c_in = os.path.join(binlib, 'config.c.in') frozenmain_c = os.path.join(binlib, 'frozenmain.c') makefile_in = os.path.join(binlib, 'Makefile') defines = ['-DHAVE_CONFIG_H', '-DUSE_FROZEN', '-DNO_MAIN', '-DPYTHONPATH=\\"$(PYTHONPATH)\\"'] includes = ['-I' + incldir, '-I' + binlib] # sanity check of directories and files for dir in [prefix, binlib, incldir] + extensions: if not os.path.exists(dir): usage('needed directory %s not found' % dir) if not os.path.isdir(dir): usage('%s: not a directory' % dir) for file in config_c_in, makefile_in, frozenmain_c: if not os.path.exists(file): usage('needed file %s not found' % file) if not os.path.isfile(file): usage('%s: not a plain file' % file) for dir in extensions: setup = os.path.join(dir, 'Setup') if not os.path.exists(setup): usage('needed file %s not found' % setup) if not os.path.isfile(setup): usage('%s: not a plain file' % setup) # check that enough arguments are passed if not args: usage('at least one filename argument required') # check that file arguments exist for arg in args: if not os.path.exists(arg): usage('argument %s not found' % arg) if not os.path.isfile(arg): usage('%s: not a plain file' % arg) # process non-option arguments scriptfile = args[0] modules = args[1:] # derive target name from script name base = os.path.basename(scriptfile) base, ext = os.path.splitext(base) if base: if base != scriptfile: target = base else: target = base + '.bin' # Actual work starts here... dict = findmodules.findmodules(scriptfile, modules, path) backup = frozen_c + '~' try: os.rename(frozen_c, backup) except os.error: backup = None outfp = open(frozen_c, 'w') try: makefreeze.makefreeze(outfp, dict) finally: outfp.close() if backup: if cmp.cmp(backup, frozen_c): sys.stderr.write('%s not changed, not written\n' % frozen_c) os.rename(backup, frozen_c) builtins = [] unknown = [] mods = dict.keys() mods.sort() for mod in mods: if dict[mod] == '<builtin>': builtins.append(mod) elif dict[mod] == '<unknown>': unknown.append(mod) addfiles = [] if unknown: addfiles, addmods = \ checkextensions.checkextensions(unknown, extensions) for mod in addmods: unknown.remove(mod) builtins = builtins + addmods if unknown: sys.stderr.write('Warning: unknown modules remain: %s\n' % string.join(unknown)) builtins.sort() infp = open(config_c_in) backup = config_c + '~' try: os.rename(config_c, backup) except os.error: backup = None outfp = open(config_c, 'w') try: makeconfig.makeconfig(infp, outfp, builtins) finally: outfp.close() infp.close() if backup: if cmp.cmp(backup, config_c): sys.stderr.write('%s not changed, not written\n' % config_c) os.rename(backup, config_c) cflags = defines + includes + ['$(OPT)'] libs = [] for n in 'Modules', 'Python', 'Objects', 'Parser': n = 'lib%s.a' % n n = os.path.join(binlib, n) libs.append(n) makevars = parsesetup.getmakevars(makefile_in) somevars = {} for key in makevars.keys(): somevars[key] = makevars[key] somevars['CFLAGS'] = string.join(cflags) # override files = ['$(OPT)', config_c, frozen_c, frozenmain_c] + \ addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] backup = makefile + '~' try: os.rename(makefile, backup) except os.error: backup = None outfp = open(makefile, 'w') try: makemakefile.makemakefile(outfp, somevars, files, target) finally: outfp.close() if backup: if not cmp.cmp(backup, makefile): print 'previous Makefile saved as', backup else: sys.stderr.write('%s not changed, not written\n' % makefile) os.rename(backup, makefile) # Done! print 'Now run make to build the target:', target | 150316ee2e7db3d0ad633f2dbe53a066add49e45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/150316ee2e7db3d0ad633f2dbe53a066add49e45/freeze.py |
defines = ['-DHAVE_CONFIG_H', '-DUSE_FROZEN', '-DNO_MAIN', | defines = ['-DHAVE_CONFIG_H', | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:') except getopt.error, msg: usage('getopt error: ' + str(msg)) # proces option arguments for o, a in opts: if o == '-e': extensions.append(a) if o == '-p': prefix = a # locations derived from options binlib = os.path.join(prefix, 'lib/python/lib') incldir = os.path.join(prefix, 'include/Py') config_c_in = os.path.join(binlib, 'config.c.in') frozenmain_c = os.path.join(binlib, 'frozenmain.c') makefile_in = os.path.join(binlib, 'Makefile') defines = ['-DHAVE_CONFIG_H', '-DUSE_FROZEN', '-DNO_MAIN', '-DPYTHONPATH=\\"$(PYTHONPATH)\\"'] includes = ['-I' + incldir, '-I' + binlib] # sanity check of directories and files for dir in [prefix, binlib, incldir] + extensions: if not os.path.exists(dir): usage('needed directory %s not found' % dir) if not os.path.isdir(dir): usage('%s: not a directory' % dir) for file in config_c_in, makefile_in, frozenmain_c: if not os.path.exists(file): usage('needed file %s not found' % file) if not os.path.isfile(file): usage('%s: not a plain file' % file) for dir in extensions: setup = os.path.join(dir, 'Setup') if not os.path.exists(setup): usage('needed file %s not found' % setup) if not os.path.isfile(setup): usage('%s: not a plain file' % setup) # check that enough arguments are passed if not args: usage('at least one filename argument required') # check that file arguments exist for arg in args: if not os.path.exists(arg): usage('argument %s not found' % arg) if not os.path.isfile(arg): usage('%s: not a plain file' % arg) # process non-option arguments scriptfile = args[0] modules = args[1:] # derive target name from script name base = os.path.basename(scriptfile) base, ext = os.path.splitext(base) if base: if base != scriptfile: target = base else: target = base + '.bin' # Actual work starts here... dict = findmodules.findmodules(scriptfile, modules, path) backup = frozen_c + '~' try: os.rename(frozen_c, backup) except os.error: backup = None outfp = open(frozen_c, 'w') try: makefreeze.makefreeze(outfp, dict) finally: outfp.close() if backup: if cmp.cmp(backup, frozen_c): sys.stderr.write('%s not changed, not written\n' % frozen_c) os.rename(backup, frozen_c) builtins = [] unknown = [] mods = dict.keys() mods.sort() for mod in mods: if dict[mod] == '<builtin>': builtins.append(mod) elif dict[mod] == '<unknown>': unknown.append(mod) addfiles = [] if unknown: addfiles, addmods = \ checkextensions.checkextensions(unknown, extensions) for mod in addmods: unknown.remove(mod) builtins = builtins + addmods if unknown: sys.stderr.write('Warning: unknown modules remain: %s\n' % string.join(unknown)) builtins.sort() infp = open(config_c_in) backup = config_c + '~' try: os.rename(config_c, backup) except os.error: backup = None outfp = open(config_c, 'w') try: makeconfig.makeconfig(infp, outfp, builtins) finally: outfp.close() infp.close() if backup: if cmp.cmp(backup, config_c): sys.stderr.write('%s not changed, not written\n' % config_c) os.rename(backup, config_c) cflags = defines + includes + ['$(OPT)'] libs = [] for n in 'Modules', 'Python', 'Objects', 'Parser': n = 'lib%s.a' % n n = os.path.join(binlib, n) libs.append(n) makevars = parsesetup.getmakevars(makefile_in) somevars = {} for key in makevars.keys(): somevars[key] = makevars[key] somevars['CFLAGS'] = string.join(cflags) # override files = ['$(OPT)', config_c, frozen_c, frozenmain_c] + \ addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] backup = makefile + '~' try: os.rename(makefile, backup) except os.error: backup = None outfp = open(makefile, 'w') try: makemakefile.makemakefile(outfp, somevars, files, target) finally: outfp.close() if backup: if not cmp.cmp(backup, makefile): print 'previous Makefile saved as', backup else: sys.stderr.write('%s not changed, not written\n' % makefile) os.rename(backup, makefile) # Done! print 'Now run make to build the target:', target | 150316ee2e7db3d0ad633f2dbe53a066add49e45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/150316ee2e7db3d0ad633f2dbe53a066add49e45/freeze.py |
for dir in [prefix, binlib, incldir] + extensions: | for dir in [prefix, exec_prefix, binlib, incldir] + extensions: | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:') except getopt.error, msg: usage('getopt error: ' + str(msg)) # proces option arguments for o, a in opts: if o == '-e': extensions.append(a) if o == '-p': prefix = a # locations derived from options binlib = os.path.join(prefix, 'lib/python/lib') incldir = os.path.join(prefix, 'include/Py') config_c_in = os.path.join(binlib, 'config.c.in') frozenmain_c = os.path.join(binlib, 'frozenmain.c') makefile_in = os.path.join(binlib, 'Makefile') defines = ['-DHAVE_CONFIG_H', '-DUSE_FROZEN', '-DNO_MAIN', '-DPYTHONPATH=\\"$(PYTHONPATH)\\"'] includes = ['-I' + incldir, '-I' + binlib] # sanity check of directories and files for dir in [prefix, binlib, incldir] + extensions: if not os.path.exists(dir): usage('needed directory %s not found' % dir) if not os.path.isdir(dir): usage('%s: not a directory' % dir) for file in config_c_in, makefile_in, frozenmain_c: if not os.path.exists(file): usage('needed file %s not found' % file) if not os.path.isfile(file): usage('%s: not a plain file' % file) for dir in extensions: setup = os.path.join(dir, 'Setup') if not os.path.exists(setup): usage('needed file %s not found' % setup) if not os.path.isfile(setup): usage('%s: not a plain file' % setup) # check that enough arguments are passed if not args: usage('at least one filename argument required') # check that file arguments exist for arg in args: if not os.path.exists(arg): usage('argument %s not found' % arg) if not os.path.isfile(arg): usage('%s: not a plain file' % arg) # process non-option arguments scriptfile = args[0] modules = args[1:] # derive target name from script name base = os.path.basename(scriptfile) base, ext = os.path.splitext(base) if base: if base != scriptfile: target = base else: target = base + '.bin' # Actual work starts here... dict = findmodules.findmodules(scriptfile, modules, path) backup = frozen_c + '~' try: os.rename(frozen_c, backup) except os.error: backup = None outfp = open(frozen_c, 'w') try: makefreeze.makefreeze(outfp, dict) finally: outfp.close() if backup: if cmp.cmp(backup, frozen_c): sys.stderr.write('%s not changed, not written\n' % frozen_c) os.rename(backup, frozen_c) builtins = [] unknown = [] mods = dict.keys() mods.sort() for mod in mods: if dict[mod] == '<builtin>': builtins.append(mod) elif dict[mod] == '<unknown>': unknown.append(mod) addfiles = [] if unknown: addfiles, addmods = \ checkextensions.checkextensions(unknown, extensions) for mod in addmods: unknown.remove(mod) builtins = builtins + addmods if unknown: sys.stderr.write('Warning: unknown modules remain: %s\n' % string.join(unknown)) builtins.sort() infp = open(config_c_in) backup = config_c + '~' try: os.rename(config_c, backup) except os.error: backup = None outfp = open(config_c, 'w') try: makeconfig.makeconfig(infp, outfp, builtins) finally: outfp.close() infp.close() if backup: if cmp.cmp(backup, config_c): sys.stderr.write('%s not changed, not written\n' % config_c) os.rename(backup, config_c) cflags = defines + includes + ['$(OPT)'] libs = [] for n in 'Modules', 'Python', 'Objects', 'Parser': n = 'lib%s.a' % n n = os.path.join(binlib, n) libs.append(n) makevars = parsesetup.getmakevars(makefile_in) somevars = {} for key in makevars.keys(): somevars[key] = makevars[key] somevars['CFLAGS'] = string.join(cflags) # override files = ['$(OPT)', config_c, frozen_c, frozenmain_c] + \ addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] backup = makefile + '~' try: os.rename(makefile, backup) except os.error: backup = None outfp = open(makefile, 'w') try: makemakefile.makemakefile(outfp, somevars, files, target) finally: outfp.close() if backup: if not cmp.cmp(backup, makefile): print 'previous Makefile saved as', backup else: sys.stderr.write('%s not changed, not written\n' % makefile) os.rename(backup, makefile) # Done! print 'Now run make to build the target:', target | 150316ee2e7db3d0ad633f2dbe53a066add49e45 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/150316ee2e7db3d0ad633f2dbe53a066add49e45/freeze.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.