rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.segmentStop + blockSize)) self.segmentStop += blockSize | self.segmentStop + blockDuration)) self.lock.acquire() if self.flushing: self.stillCancelCond.notify() self.vobuReadReturn = True break self.segmentStop += blockDuration if remainingBlocks != None: remainingBlocks -= 1 self.showingStill = False | def stillFrame(self, seconds): """Tell the pipeline that a still frame was sent, and direct it to play silence for the specified number of seconds.""" gst.debug("still frame: %d" % seconds) |
print 'setTimeJump attempted, implement me!' | print >> sys.stder, 'setTimeJump attempted, implement me!' | def setTimedJump(self, programChainNr, seconds): """Sets the special purpose registers (SPRMs) 10 and 9 with 'programChainNr' and 'seconds', respectively. |
print 'Button command:' print disassemble.disassemble(buttonCmd) | def playButtonCmd(self, cellCommands, buttonCmd): """Play the specified button command. | |
print disassemble.disassemble(self.commands.get(self.commandNr), pos=self.commandNr) | def goto(self, commandNr): assert commandNr > 0 | |
elif isinstance(programChain.container, dvdread.LangUnit): | elif self.inMenu(): | def updateAudio(self): """Send an audio event corresponding to the current logical audio stream.""" programChain = self.currentProgramChain() if programChain == None or self.audio == 15: # We aren't playing a program chain, or the logical audio # track is explicitly set to none. physical = -1 elif isinstance(programCha... |
@staticmethod def getAttributeContainer(programChain): """Find the container of the current stream attributes.""" if isinstance(programChain.container, dvdread.LangUnit): return programChain.container.container elif isinstance(programChain.container, dvdread.VideoTitleSet): return programChain.container elif isinstance... | def updateAudio(self): """Send an audio event corresponding to the current logical audio stream.""" programChain = self.currentProgramChain() if programChain == None or self.audio == 15: # We aren't playing a program chain, or the logical audio # track is explicitly set to none. physical = -1 elif isinstance(programCha... | |
elif isinstance(programChain.container, dvdread.LangUnit): | elif self.inMenu(): | def updateSubpicture(self): """Send a subpicture event corresponding to the current logical subpicture stream.""" programChain = self.currentProgramChain() |
if self.getAttributeContainer(programChain). \ videoAttributes.aspectRatio == dvdread.ASPECT_RATIO_4_3: | if self.currentVideoAttributes().aspectRatio == \ dvdread.ASPECT_RATIO_4_3: | def updateSubpicture(self): """Send a subpicture event corresponding to the current logical subpicture stream.""" programChain = self.currentProgramChain() |
'titleNr', | 'titleSetNr', | def openSetParentalLevel(self, commandNr): # FIXME: implement this. print "Attempt to set parental level, implement me!" |
self.titleNr = None | self.titleSetNr = None | def __init__(self, machine): self.machine = machine self.cell = None self.domain = None self.titleNr = None self.sectorNr = None |
if isinstance(cell.programChain.container, dvdread.LangUnit): | if self.machine.inMenu(): | def playCell(self, cell, sectorNr=None): """Play the specified cell. |
if isinstance(cell.programChain.container, dvdread.LangUnit): self.titleNr = cell.programChain.container.container.titleSetNr elif isinstance(cell.programChain.container, dvdread.VideoTitleSet): self.titleNr = cell.programChain.container.titleSetNr elif isinstance(cell.programChain.container, dvdread.VideoManager): sel... | titleSet = self.machine.currentTitleSet() if titleSet != None: self.titleSetNr = titleSet.titleSetNr else: self.titleSetNr = 0 | def playCell(self, cell, sectorNr=None): """Play the specified cell. |
yield cmds.PlayVobu(self.domain, self.titleNr, self.sectorNr) | yield cmds.PlayVobu(self.domain, self.titleSetNr, self.sectorNr) | def playFromVobu(self, sectorNr): """Play the VOBU at the specified sector number.""" self.sectorNr = sectorNr |
self.clock = wrapclock.wrap(self.audioSinkElem.get_clock()) self.use_clock(self.clock) | def __init__(self, options, name="player"): Thread.__init__(self, name) | |
method(self, *args, **keywords) | return method(self, *args, **keywords) | def wrapper(self, *args, **keywords): self.lock.acquire() try: method(self, *args, **keywords) finally: self.lock.release() |
`machine` module. | `machine.cmds` module. | def push(self, value): """Push back 'value' into the iterator""" self.pushedBack.append(value) |
self.pipeline.get_bus().add_watch(self.flushMsgHandler) | def __init__(self, machine, pipeline): self.machine = machine self.pipeline = pipeline | |
gst.log("Vobu read") | gst.log("VOBU read") | def vobuRead(self, src): """Invoked by the source element after reading a complete VOBU.""" gst.log("Vobu read") |
gst.log("Vobu header") | gst.log("VOBU header") | def vobuHeader(self, src, buf): """The signal handler for the source's vobu-header signal.""" gst.log("Vobu header") |
def flushMsgHandler(self, bus, msg): """Implements pipeline flushing by sending a flushing seek event from the application thread.""" if msg.type & gst.MESSAGE_APPLICATION and \ msg.structure.has_name('seamless.Flush'): self.pipeline.set_state(gst.STATE_PAUSED) elif self.flushing and \ msg.type & gst.MESSAGE_STAT... | def vobuHeader(self, src, buf): """The signal handler for the source's vobu-header signal.""" gst.log("Vobu header") | |
self.cancelVobu() | def interactiveWrapper(count): """Call the iterator and send an `EndInteractive` operation at the end.""" yield itersched.Call(itr) | |
self.mainItr.push(self.__class__.flush) self.flushing = True | self.flush() | def interactiveWrapper(count): """Call the iterator and send an `EndInteractive` operation at the end.""" yield itersched.Call(itr) |
self.src.set_property('cancel-vobu', True) | def cancelVobu(self): """Cancel the playback of the current VOBU. | |
def flush(self): """Flush the pipeline.""" gst.debug("flush") self.area = None self.button = None self.palette = None self.segmentStart = None self.segmentStop = None msg = gst.message_new_application(self.src, gst.Structure('seamless.Flush')) self.pipeline.get_bus().post(msg) self.vobuReadReturn = True | def stillFrame(self, seconds): """Tell the pipeline that a still frame was sent, and direct it to play silence for the specified number of seconds.""" gst.debug("still frame: %d" % seconds) | |
with the manager as parameter, perform the required operations The machine is restricted to use the operations defined in the | with the manager as parameter, perform the required operations. The machine is restricted to use the operations defined in the | def wrapper(self, *args, **keywords): self.lock.acquire() try: method(self, *args, **keywords) finally: self.lock.release() |
'immediate', 'interactiveCount') | 'interactiveCount', 'segmentStart', 'segmentStop', 'ev') | def wrapper(self, *args, **keywords): self.lock.acquire() try: method(self, *args, **keywords) finally: self.lock.release() |
self.immediate = False | def __init__(self, machine, pipeline): self.machine = machine self.pipeline = pipeline | |
if self.immediate: self.src.emit('push-event', event) else: self.src.emit('queue-event', event) | self.srcPad.push_event(event) | def sendEvent(self, event): """Send `event` down the pipeline.""" if self.immediate: self.src.emit('push-event', event) else: self.src.emit('queue-event', event) |
self.immediate = True | def vobuRead(self, src): """Invoked by the source element after reading a complete VOBU.""" | |
self.src.emit('push-event', events.eos()) | self.sendEvent(events.eos()) | def vobuRead(self, src): """Invoked by the source element after reading a complete VOBU.""" |
self.immediate = False | def vobuRead(self, src): """Invoked by the source element after reading a complete VOBU.""" | |
nav = dvdread.NavPacket(buf.get_data()) | nav = dvdread.NavPacket(buf.data) | def vobuHeader(self, src, buf): """The signal handler for the source's vobu-header signal.""" # Release the lock set by the playVobu operation. self.lock.release() |
self.src.emit('push-event', events.nav(nav.startTime, nav.endTime)) | start = events.mpegTimeToGstTime(nav.startTime) stop = events.mpegTimeToGstTime(nav.endTime) if self.segmentStop != start: self.segmentStart = start self.segmentStop = stop update = False gst.debug('New current segment') else: self.segmentStop = stop update = True gst.debug('Current segment update') self.sendEvent(ev... | def vobuHeader(self, src, buf): """The signal handler for the source's vobu-header signal.""" # Release the lock set by the playVobu operation. self.lock.release() |
self.sendEvent(events.filler()) | def pause(self): """Pause the pipeline for a short time (currently 0.1s). | |
self.shutdownAudio() | def stillFrame(self): """Tell the pipeline that a still frame was sent.""" gst.debug("still frame") | |
if action == 0: self.arena[x][y] = self.arena[x][y] ^ LOCK self.fullredraw = TRUE small_redraw() return if self.arena[x][y] & LOCK: return | if undo: self.arena[x][y] = self.arena[x][y] &~ LOCK else: if action == 0: self.arena[x][y] = self.arena[x][y] ^ LOCK self.fullredraw = TRUE small_redraw() return if self.arena[x][y] & LOCK: return | def move(self, x, y, action, undo=FALSE): assert(not self.moveinprogress) |
epochtuple = (1970, 1, 1, 0, 0, 0, 0, 0, 0) | epochtuple = (1970, 1, 2, 3, 46, 40, 0, 0, 0) | def _timecvt(self, timestamp): |
epoch = 2*try1-try2 | epoch = 2*try1-try2 - 100000 | def _timecvt(self, timestamp): |
win.set_title("Net %dx%d %s (%d)" % \ (NSQUARES_X, NSQUARES_Y, wrapstr, game.currgame)) | win.set_title("Net %dx%d %s (%s)" % \ (NSQUARES_X, NSQUARES_Y, wrapstr, itoa(game.currgame))) | def new_game(menuitem=None, seed=None): global game game = NetGame(seed) game.draw(pix) game.status(statusbar) if WRAPPING: wrapstr = "wrapping" else: wrapstr = "non-wrapping" win.set_title("Net %dx%d %s (%d)" % \ (NSQUARES_X, NSQUARES_Y, wrapstr, game.currgame)) redraw(darea) |
self.moves = 0 | self.moves = [] | def __init__(self): self.cube = [0, 0, 0, 0, 0, 0] self.arena = [] for i in range(NSQUARES): self.arena.append([0] * NSQUARES) list = range(NSQUARES * NSQUARES) # Pick six squares to be blue. for i in range(6): pos = random.choice(list) x, y = divmod(pos, NSQUARES) list.remove(pos) self.arena[x][y] = 1 # And a final no... |
points.append((ORIGIN+(cubex+x)*SQUARESIZE, ORIGIN+(cubey+y)*SQUARESIZE)) | points.append((int(ORIGIN+(cubex+x)*SQUARESIZE), int(ORIGIN+(cubey+y)*SQUARESIZE))) | def draw(self, pixmap): gc = pix.new_gc() gc.foreground = grey draw_rectangle(pix, gc, TRUE, 0, 0, TOTALSIZE, TOTALSIZE) |
def move(self, dx, dy): if self.moveinprogress: self.finish_move() | assert self.bbox[0] != None assert self.bbox[1] != None assert self.bbox[2] != None assert self.bbox[3] != None def move(self, dx, dy, undo=FALSE): assert(not self.moveinprogress) self.moveisundo = undo if undo: self.arena[self.newx][self.newy], self.newcube[B] = \ self.newcube[B], self.arena[self.newx][self.newy] | def move(self, dx, dy): # Hurry up an existing move if one is still being animated. if self.moveinprogress: self.finish_move() |
if not self.completed: self.moves = self.moves + 1 | if not self.completed and not undo: self.moves.append((dx,dy)) | def move(self, dx, dy): # Hurry up an existing move if one is still being animated. if self.moveinprogress: self.finish_move() |
if not self.completed: | if not self.completed and not self.moveisundo: | def finish_move(self): # Swap bottom face. (Once the game is completed, we allow # the user to arbitrarily roll the fully blue cube around # the grid just for fun.) if not self.completed: self.arena[self.newx][self.newy], self.newcube[B] = \ self.newcube[B], self.arena[self.newx][self.newy] |
message = "Moves: %d" % self.moves | message = "Moves: %d" % len(self.moves) | def status(self, statusbar): message = "Moves: %d" % self.moves if self.completed: message = "COMPLETED! " + message statusbar.pop(statusctx) statusbar.push(statusctx, message) |
if event.keyval == GDK.Escape or event.string == '\021': | if event.keyval == GDK.Escape or event.string in ['\021', 'q', 'Q']: | def key_event(win, event=None): global timer_inst if event.keyval == GDK.Escape or event.string == '\021': win.destroy() return if event.string == '\016': new_game(None) return if event.keyval == GDK.Up or event.keyval == GDK.KP_Up: game.move(0, -1) elif event.keyval == GDK.Down or event.keyval == GDK.KP_Down: game.... |
if event.keyval == GDK.Up or event.keyval == GDK.KP_Up: | if game.moveinprogress: game.finish_move() small_redraw() if event.string in ['\032', 'u', 'U']: game.undo() elif event.keyval == GDK.Up or event.keyval == GDK.KP_Up: | def key_event(win, event=None): global timer_inst if event.keyval == GDK.Escape or event.string == '\021': win.destroy() return if event.string == '\016': new_game(None) return if event.keyval == GDK.Up or event.keyval == GDK.KP_Up: game.move(0, -1) elif event.keyval == GDK.Down or event.keyval == GDK.KP_Down: game.... |
timeout_add(20, timer, win) | game.status(statusbar) if timer_inst != None: timeout_remove(timer_inst) timer_inst = timeout_add(20, timer, win) | def key_event(win, event=None): global timer_inst if event.keyval == GDK.Escape or event.string == '\021': win.destroy() return if event.string == '\016': new_game(None) return if event.keyval == GDK.Up or event.keyval == GDK.KP_Up: game.move(0, -1) elif event.keyval == GDK.Down or event.keyval == GDK.KP_Down: game.... |
game.draw(pix) redraw(darea) | small_redraw() | def timer(win): if not game.moveinprogress: # move has been finished for us already game.status(statusbar) return FALSE game.moveprogress = game.moveprogress + 1.0/6 if game.moveprogress >= 1.0: game.finish_move() game.status(statusbar) ret = FALSE else: ret = TRUE game.draw(pix) redraw(darea) return ret |
def redraw(darea): | def redraw(darea, rect=[0,0,TOTALSIZE,TOTALSIZE]): | def redraw(darea): gc = darea.get_style().white_gc darea.draw_pixmap(gc, pix, 0, 0, 0, 0, TOTALSIZE, TOTALSIZE) |
darea.draw_pixmap(gc, pix, 0, 0, 0, 0, TOTALSIZE, TOTALSIZE) | x, y, x2, y2 = rect w, h = x2-x+1, y2-y+1 if gc != None: darea.draw_pixmap(gc, pix, x, y, x, y, w, h) | def redraw(darea): gc = darea.get_style().white_gc darea.draw_pixmap(gc, pix, 0, 0, 0, 0, TOTALSIZE, TOTALSIZE) |
game = CubeGame() game.draw(pix) game.status(statusbar) | new_game(None) | def redraw(darea): gc = darea.get_style().white_gc darea.draw_pixmap(gc, pix, 0, 0, 0, 0, TOTALSIZE, TOTALSIZE) |
def draw_thick_line(pix, gc, x1, y1, x2, y2, active): draw_line(pix, gc, x1-1, y1, x2-1, y2) draw_line(pix, gc, x1+1, y1, x2+1, y2) draw_line(pix, gc, x1, y1-1, x2, y2-1) draw_line(pix, gc, x1, y1+1, x2, y2+1) tmp = gc.foreground if active: gc.foreground = powered draw_line(pix, gc, x1, y1, x2, y2) gc.foreground = tmp | class container: pass cont = container() def draw_thick_line(pix, gc, x1, y1, x2, y2, active, cont=cont): if cont.phase == 0: draw_line(pix, gc, x1-1, y1, x2-1, y2) draw_line(pix, gc, x1+1, y1, x2+1, y2) draw_line(pix, gc, x1, y1-1, x2, y2-1) draw_line(pix, gc, x1, y1+1, x2, y2+1) elif cont.phase == 1: tmp = gc.foregro... | def draw_thick_line(pix, gc, x1, y1, x2, y2, active): draw_line(pix, gc, x1-1, y1, x2-1, y2) draw_line(pix, gc, x1+1, y1, x2+1, y2) draw_line(pix, gc, x1, y1-1, x2, y2-1) draw_line(pix, gc, x1, y1+1, x2, y2+1) tmp = gc.foreground if active: gc.foreground = powered draw_line(pix, gc, x1, y1, x2, y2) gc.foreground = tmp |
for x in range(NSQUARES_X): for y in range(NSQUARES_Y): gc.foreground = lines k = self.arena[x][y] act = k & ACTIVE k = k & ~ACTIVE r = (SQUARESIZE-1) / 2 xmid = ORIGIN + SQUARESIZE * x + r ymid = ORIGIN + SQUARESIZE * y + r matrix = [[1,0],[0,1]] if self.moveinprogress: if self.movex == x and self.movey == y: angle ... | for cont.phase in range(3): for x in range(NSQUARES_X): for y in range(NSQUARES_Y): gc.foreground = lines k = self.arena[x][y] act = k & ACTIVE k = k & ~ACTIVE r = (SQUARESIZE-1) / 2 xmid = ORIGIN + SQUARESIZE * x + r ymid = ORIGIN + SQUARESIZE * y + r matrix = [[1,0],[0,1]] if self.moveinprogress: if self.movex == x... | def draw_thick_line(pix, gc, x1, y1, x2, y2, active): draw_line(pix, gc, x1-1, y1, x2-1, y2) draw_line(pix, gc, x1+1, y1, x2+1, y2) draw_line(pix, gc, x1, y1-1, x2, y2-1) draw_line(pix, gc, x1, y1+1, x2, y2+1) tmp = gc.foreground if active: gc.foreground = powered draw_line(pix, gc, x1, y1, x2, y2) gc.foreground = tmp |
throwerror() contrib = self.RGTPContribution() words = string.split(data[0][1:]) contrib.sequence = string.atol(words[0], 16) contrib.timestamp = self._timecvt(words[1]) contrib.data = [] | contrib.data.append("") contrib.sequence = 0 contrib.timestamp = self._timecvt("00000000") else: words = string.split(data[0][1:]) contrib.sequence = string.atol(words[0], 16) contrib.timestamp = self._timecvt(words[1]) | def item(self, itemid): |
if s[0:3] != "280": | if s[0:3] != "280" and s[0:3] != "": | def close(self): |
while dl != 0: | while dl != 0 and dg != 0: | def confrac(n, d, e=1, output=sys.stdout): "Print continued fraction of n/d, optionally with error +/- e in n" terms = [] n1, nk = 0, 1 d1, dk = 1, 0 nl, dl = n-e, d ng, dg = n+e, d while dl != 0: i = nl / dl if i != ng / dg: break nl, dl = dl, nl % dl ng, dg = dg, ng % dg nk, n1 = nk * i + n1, nk dk, d1 = dk * i + d1,... |
self.get(lt_assign) | self.eat(lt_assign) | def init_declarator(self, dcl=None): n = node("init_declarator") if dcl == None: dcl = self.declarator(1) # non-abstract only n.append(dcl) if self.peektype() == lt_assign: self.get(lt_assign) n.append(self.initializer()) return n |
n = node("postfix_expression") self.eat(lt_lparen) n.append(self.type_name()) self.eat(lt_rparen) self.eat(lt_lbrace) n.append(self.initializer_list()) if self.peektype() == lt_comma: self.eat(lt_comma) self.eat(lt_rbrace) | lpar = self.eat(lt_lparen) if not self.type_name_peek(): self.unget(lpar) n = self.primary_expression() else: n = node("postfix_expression") n.append(self.type_name()) self.eat(lt_rparen) self.eat(lt_lbrace) n.append(self.initializer_list()) if self.peektype() == lt_comma: self.eat(lt_comma) self.eat(lt_rbrace) | def postfix_expression(self): if self.peektype() == lt_lparen: n = node("postfix_expression") self.eat(lt_lparen) n.append(self.type_name()) self.eat(lt_rparen) self.eat(lt_lbrace) n.append(self.initializer_list()) if self.peektype() == lt_comma: self.eat(lt_comma) self.eat(lt_rbrace) else: n = self.primary_expression(... |
n.append(t) | n.append(self.get()) | def unary_expression(self): t = self.peektype() if t == lt_increment or t == lt_decrement: n = node("unary_expression") n.append(t) n.append(self.unary_expression()) return n elif t == lt_sizeof: n = node("unary_expression") n.append(t) if self.peektype() == lt_lparen: # Either a unary-expression or ( type-name ). # Ne... |
facelist.append(cube[face], points) | facelist.append((cube[face], points)) | def draw(self, pixmap): |
fn = self.shlib_compiler.library_filename(fn,'shared') print "shlib",fn return fn | return self.shlib_compiler.library_filename(fn,'shared') | def get_ext_filename(self, fullname): filename = _build_ext.get_ext_filename(self,fullname) for ext in self.shlibs: if self.get_ext_fullname(ext.name)==fullname: fn, ext = os.path.splitext(filename) fn = self.shlib_compiler.library_filename(fn,'shared') print "shlib",fn return fn return filename |
zip_safe = True, | zip_safe = False, | def get_description(): # Get our long description from the documentation f = file('setuptools.txt') lines = [] for line in f: if not line.strip(): break # skip to first blank line for line in f: if line.startswith('.. contents::'): break # read to table of contents lines.append(line) f.close() return ''.join(li... |
from setuptools.command.easy_install import main | try: from setuptools.command.easy_install import main except ImportError: from easy_install import main | def main(argv, version=DEFAULT_VERSION): """Install or upgrade setuptools and EasyInstall""" try: import setuptools except ImportError: import tempfile, shutil tmpdir = tempfile.mkdtemp(prefix="easy_install-") try: egg = download_setuptools(version, to_dir=tmpdir) sys.path.insert(0,egg) from setuptools.command.easy_in... |
def __iter__(self): """Yield distributions for non-duplicate projects in the working set The yield order is the order in which the items' path entries were added to the working set. """ for item in self.entries: for key in self.entry_keys[item]: yield self.by_key[key] | def __iter__(self): """Yield distributions for non-duplicate projects in the working set | |
egg = download_setuptools(version, download_base, to_dir, dl_delay) | egg = download_setuptools(version, download_base, to_dir, download_delay) | def use_setuptools( version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, download_delay=15 |
main(list(argv)+[req]) | main(list(argv)+[download_setuptools()]) | def main(argv, version=DEFAULT_VERSION): """Install or upgrade setuptools and EasyInstall""" try: import setuptools except ImportError: import tempfile, shutil tmpdir = tempfile.mkdtemp(prefix="easy_install-") try: egg = download_setuptools(version, to_dir=tmpdir) sys.path.insert(0,egg) from setuptools.command.easy_in... |
py_ver = base[-7:-4] | py_ver = name[-7:-4] | def parse_bdist_wininst(name): """Return (base,pyversion) or (None,None) for possible .exe name""" lower = name.lower() base, py_ver = None, None if lower.endswith('.exe'): if lower.endswith('.win32.exe'): base = name[:-10] elif lower[-16:].startswith('.win32-py'): py_ver = base[-7:-4] base = name[:-16] return base,... |
win_base, py_ver = parse_bdist_wininst(name) | win_base, py_ver = parse_bdist_wininst(base) | def distros_for_url(url, metadata=None): """Yield egg or source distribution objects that might be found at a URL""" path = urlparse.urlparse(url)[2] base = urllib2.unquote(path.split('/')[-1]) if base.endswith('.egg'): dist = Distribution.from_filename(base, metadata) dist.path = url return [dist] # only one, unam... |
import doctest return doctest.DocFileSuite( 'api_tests.txt', optionflags=doctest.ELLIPSIS, package='pkg_resources', ) | import doctest, unittest suite = unittest.TestSuite(( doctest.DocFileSuite( 'api_tests.txt', optionflags=doctest.ELLIPSIS, package='pkg_resources', ), )) if sys.platform == 'win32': suite.addTest(doctest.DocFileSuite('win_script_wrapper.txt')) return suite | def additional_tests(): import doctest return doctest.DocFileSuite( 'api_tests.txt', optionflags=doctest.ELLIPSIS, package='pkg_resources', ) |
ext_outputs = cmd._mutate_outputs( self.distribution.has_ext_modules(), 'build_ext', 'build_lib', '' ) | ext_outputs = self.get_ext_outputs() | def run(self): # Generate metadata first self.run_command("egg_info") |
return self.install_egg(dist_filename,True) | return [self.install_egg(dist_filename,True)] | def install_eggs(self, dist_filename): # .egg dirs or files are already built, so just return them if dist_filename.lower().endswith('.egg'): return self.install_egg(dist_filename,True) |
def scan_all(self, msg, *args): | def scan_all(self, msg=None, *args): | def scan_all(self, msg, *args): if self.index_url not in self.fetched_urls: if msg: self.warn(msg,*args) self.warn( "Scanning index of all packages (this may take a while)" ) self.scan_url(self.index_url) |
uncache_zipdir(destination) | def install_egg(self, egg_path, tmpdir): destination = os.path.join(self.install_dir,os.path.basename(egg_path)) destination = os.path.abspath(destination) if not self.dry_run: ensure_directory(destination) | |
def uncache_zipdir(path): """Ensure that the zip directory cache doesn't have stale info for path""" from zipimport import _zip_directory_cache as zdc if path in zdc: del zdc[path] else: path = normalize_path(path) for p in zdc: if normalize_path(p)==path: del zdc[p] return | def auto_chmod(func, arg, exc): if func is os.remove and os.name=='nt': os.chmod(arg, stat.S_IWRITE) return func(arg) exc = sys.exc_info() raise exc[0], (exc[1][0], exc[1][1] + (" %s %s" % (func,arg))) | |
self.root = None | self.root = self.prefix = None | def initialize_options(self): self.zip_ok = None self.install_dir = self.script_dir = self.exclude_scripts = None self.index_url = None self.find_links = None self.build_directory = None self.args = None self.optimize = self.record = None self.upgrade = self.always_copy = self.multi_version = None self.editable = self.... |
def _expand(self, *attrs): config_vars = self.get_finalized_command('install').config_vars from distutils.util import subst_vars for attr in attrs: val = getattr(self, attr) if val is not None: if os.name == 'posix': val = os.path.expanduser(val) val = subst_vars(val, config_vars) setattr(self, attr, val) | def _expand(self, *attrs): config_vars = self.get_finalized_command('install').config_vars from distutils.util import subst_vars for attr in attrs: val = getattr(self, attr) if val is not None: if os.name == 'posix': val = os.path.expanduser(val) val = subst_vars(val, config_vars) setattr(self, attr, val) | |
return """ CONFIGURATION PROBLEM: | return """bad install directory or PYTHONPATH | def no_default_version_msg(self): return """ |
by default. Here are some of your options for correcting this: | by default. The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s and your PYTHONPATH environment variable currently contains: %r Here are some of your options for correcting the problem: | def no_default_version_msg(self): return """ |
Please make the appropriate changes for your system and try again. Thank you for your patience. """ | Please make the appropriate changes for your system and try again.""" % ( self.install_dir, os.environ.get('PYTHONPATH','') ) | def no_default_version_msg(self): return """ |
if site_lib not in sitedirs: sitedirs.append(site_lib) sitedirs = filter(os.path.isdir, sitedirs) | if site_lib not in sitedirs: sitedirs.append(site_lib) | def get_site_dirs(): # return a list of 'site' dirs sitedirs = filter(None,os.environ.get('PYTHONPATH','').split(os.pathsep)) prefixes = [sys.prefix] if sys.exec_prefix != sys.prefix: prefixes.append(sys.exec_prefix) for prefix in prefixes: if prefix: if sys.platform in ('os2emx', 'riscos'): sitedirs.append(os.path.joi... |
for sitedir in sys.path: | for sitedir in sys.path+sitedirs: | def addsitepackages(known_paths): """Add site-packages (and possibly site-python) to sys.path""" prefixes = [sys.prefix] if sys.exec_prefix != sys.prefix: prefixes.append(sys.exec_prefix) for prefix in prefixes: if prefix: if sys.platform in ('os2emx', 'riscos'): sitedirs = [os.path.join(prefix, "Lib", "site-packages")... |
module.__path__.append(subpath) loader.load_module(packageName) | path = module.__path__; path.append(subpath) loader.load_module(packageName); module.__path__ = path | def _handle_ns(packageName, path_item): """Ensure that named package includes a subpath of path_item (if needed)""" importer = get_importer(path_item) if importer is None: return None loader = importer.find_module(packageName) if loader is None: return None module = sys.modules.get(packageName) if module is None: modul... |
f.seek(prepended-(12+cfglen+bmlen)) | f.seek(prepended-(12+cfglen)) | def extract_wininst_cfg(dist_filename): """Extract configuration data from a bdist_wininst .exe Returns a ConfigParser.RawConfigParser, or None """ f = open(dist_filename,'rb') try: endrec = zipfile._EndRecData(f) if endrec is None: return None prepended = (endrec[9] - endrec[5]) - endrec[6] if prepended < 12: # no ... |
if not hasattr(self, "package_data"): | if not have_package_data: | def __init__ (self, attrs=None): self.features = {} self.test_suite = None self.requires = [] _Distribution.__init__(self,attrs) if not hasattr(self, "package_data"): from setuptools.command.build_py import build_py self.package_data = {} self.cmdclass.setdefault('build_py',build_py) self.cmdclass.setdefault('build_ext... |
self.package_data = {} | def __init__ (self, attrs=None): self.features = {} self.test_suite = None self.requires = [] _Distribution.__init__(self,attrs) if not hasattr(self, "package_data"): from setuptools.command.build_py import build_py self.package_data = {} self.cmdclass.setdefault('build_py',build_py) self.cmdclass.setdefault('build_ext... | |
return (self.python is None or dist.py_version==self.python) \ | return (self.python is None or dist.py_version is None or dist.py_version==self.python) \ | def can_add(self, dist): """Is distribution `dist` acceptable for this collection?""" return (self.python is None or dist.py_version==self.python) \ and compatible_platforms(dist.platform,self.platform) |
def __len__(self): return len(self._distmap) | def __len__(self): return len(self._distmap) | |
self.cached_files = [] | self.cached_files = {} | def __init__(self): self.cached_files = [] |
self.cached_files.append(target_path) | self.cached_files[target_path] = 1 | def get_cache_path(self, archive_name, names=()): """Return absolute location in cache for `archive_name` and `names` |
py_version=py_version or PY_MAJOR, platform=platform | py_version=py_version, platform=platform | def from_filename(cls,filename,metadata=None): name,version,py_version,platform = [None]*4 basename,ext = os.path.splitext(os.path.basename(filename)) if ext.lower()==".egg": match = EGG_NAME(basename) if match: name,version,py_version,platform = match.group( 'name','ver','pyver','plat' ) return cls( filename, metadata... |
tmp = [(dist.version,dist.distro_type,dist) for dist in dists] | tmp = [(dist.parsed_version,dist.distro_type,dist) for dist in dists] | def _sort_dists(dists): tmp = [(dist.version,dist.distro_type,dist) for dist in dists] tmp.sort() dists[::-1] = [d for v,t,d in tmp] |
if self.tag_svn_revision and os.path.exists('.svn'): version += '-r%s' % self.get_svn_revision() | if self.tag_svn_revision and ( os.path.exists('.svn') or os.path.exists('PKG-INFO') ): version += '-r%s' % self.get_svn_revision() | def tagged_version(self): version = self.distribution.get_version() if self.tag_build: version+=self.tag_build if self.tag_svn_revision and os.path.exists('.svn'): version += '-r%s' % self.get_svn_revision() if self.tag_date: import time version += time.strftime("-%Y%m%d") return safe_version(version) |
import time version += time.strftime("-%Y%m%d") | import time; version += time.strftime("-%Y%m%d") | def tagged_version(self): version = self.distribution.get_version() if self.tag_build: version+=self.tag_build if self.tag_svn_revision and os.path.exists('.svn'): version += '-r%s' % self.get_svn_revision() if self.tag_date: import time version += time.strftime("-%Y%m%d") return safe_version(version) |
_install_scripts.run(self) | if self.distribution.scripts: _install_scripts.run(self) else: self.outfiles = [] | def run(self): self.run_command("egg_info") _install_scripts.run(self) # run first to set up self.outfiles |
shutil.rmtree(tmpdir) | smart_rmtree(tmpdir) | def easy_install(self, spec, deps=False): tmpdir = tempfile.mkdtemp(prefix="easy_install-") download = None |
if requirement is None: requirement = dist.as_requirement() if dist not in requirement: | if not deps and not self.always_copy: | def process_distribution(self, requirement, dist, deps=True, *info): self.update_pth(dist) self.package_index.add(dist) self.local_index.add(dist) self.install_egg_scripts(dist) self.installed_projects[dist.key] = dist log.warn(self.installation_report(dist, *info)) |
if deps or self.always_copy: log.info("Processing dependencies for %s", requirement) else: return if self.always_copy: for req in dist.requires(requirement.extras): if req.key not in self.installed_projects: self.easy_install(req) return | elif requirement is not None and dist.key != requirement.key: log.warn("Skipping dependencies for %s", dist) return if requirement is None or dist not in requirement: distreq = dist.as_requirement() requirement = Requirement( distreq.project_name, distreq.specs, requirement.extras ) log.info("Processing dependencies... | def process_distribution(self, requirement, dist, deps=True, *info): self.update_pth(dist) self.package_index.add(dist) self.local_index.add(dist) self.install_egg_scripts(dist) self.installed_projects[dist.key] = dist log.warn(self.installation_report(dist, *info)) |
WorkingSet([]).resolve( | distros = WorkingSet([]).resolve( | def process_distribution(self, requirement, dist, deps=True, *info): self.update_pth(dist) self.package_index.add(dist) self.local_index.add(dist) self.install_egg_scripts(dist) self.installed_projects[dist.key] = dist log.warn(self.installation_report(dist, *info)) |
v = 'v' * self.verbose - 1 | v = 'v' * (self.verbose - 1) | def run_setup(self, setup_script, setup_base, args): sys.modules.setdefault('distutils.command.bdist_egg', bdist_egg) sys.modules.setdefault('distutils.command.egg_info', egg_info) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.