rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
file_stat = self.stat()
file_stat = self.stat(request)
def renderGET(self, request):
l = int(request.get_header("Content-Length"))
l = int(request.getHeader("Content-Length"))
def renderPUT(self, request): try: l = int(request.get_header("Content-Length")) logger.info("Incomming file: %d bytes long", l)
path, params, query, fragment = request.split_uri()
urlpath = request.URLPath() path = urlpath.path logger.info("path is %s", path)
def renderPUT(self, request): try: l = int(request.get_header("Content-Length")) logger.info("Incomming file: %d bytes long", l)
if request.has_key("Content-Type"):
if request.getAllHeaders().has_key("Content-Type"):
def renderPUT(self, request): try: l = int(request.get_header("Content-Length")) logger.info("Incomming file: %d bytes long", l)
file = self.open(path, 'w+') request.collector = put_collector(file, l, request, 0) request.channel.set_terminator (None)
file = self.open('w+', request) FileStore(file, l, request, False) return twisted.web.server.NOT_DONE_YET
def renderPUT(self, request): try: l = int(request.get_header("Content-Length")) logger.info("Incomming file: %d bytes long", l)
class SongList(Collection): fields = ( db_audiostore.remus_audio_objects_au_id, ) order_by = ( db_audiostore.remus_albums_alb_name, db_audiostore.remus_audio_objects_au_track_number, ) def __init__(self, parent): super(SongList, self).__init__(parent) def name(self): return "songlist"
def name(self): return "--".join(self.songtuple)
self.file.seek(0) return self.file
file = self.file self.file = None return file
def open(self, mode, request=None): # Check query parameters for custom ordering if request.args.has_key('order'): # Find out what order parameters we had before, which # doesn't have a DESC modifier on them. For those, we # reverse the search order (i.e. apply the DESC modifier). coll_order = self.order_by or () old_o...
db_audiostore.remus_audio_objects_au_title,
db_audiostore.remus_artists_art_sortname,
def TIME_TO_SEC(*args): return sqlquery.Function("TIME_TO_SEC", *args)
else: print "unknown message type"
def discover(self): """iterate on ourself to find the information on the given file""" if self.finished: return self.info("setting to PLAY") if not self.set_state(gst.STATE_PLAYING): # the pipeline wasn't able to be set to playing self.finished = True return bus = self.get_bus() while 1: if self.finished: self.debug("s...
elif message.type == gst.MESSAGE_SEGMENT_DONE:
elif message.type == gst.MESSAGE_EOS:
def _bus_watch(self, bus, message): if message.type == gst.MESSAGE_ERROR: print 'error', message self._stop_queries() m = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, "Error processing file") gerror, debug = message.parse_error() txt = ('There was...
def _do_segment_seek(self): flags = gst.SEEK_FLAG_SEGMENT | gst.SEEK_FLAG_FLUSH
def _do_seek(self): flags = gst.SEEK_FLAG_FLUSH
def _do_segment_seek(self): flags = gst.SEEK_FLAG_SEGMENT | gst.SEEK_FLAG_FLUSH # HACK: self.seek should work, should try that at some point return self.demux.seek(1.0, gst.FORMAT_TIME, flags, gst.SEEK_TYPE_SET, self.start_time, gst.SEEK_TYPE_SET, self.stop_time)
self._do_segment_seek)
self._do_seek)
def _no_more_pads(self, element): pads = [x.get_pad('src') for x in self.parsers] set_connection_blocked_async_marshalled(pads, self._do_segment_seek)
'pyg_constant_strip_prefix("%s", strip_prefix), %s);\n'
'(char *) pyg_constant_strip_prefix("%s", strip_prefix), %s);\n'
def write_enums(parser, overrides, prefix, fp=sys.stdout): if not parser.enums: return fp.write('\n/* ----------- enums and flags ----------- */\n\n') fp.write( 'void\n' + prefix + '_add_constants(PyObject *module, const gchar *strip_prefix)\n{\n') for enum in parser.enums: if overrides.is_type_ignored(enum.c_name): c...
print "\t%d x %d @ %.2f fps" % (self.videowidth,
print "\t%d x %d @ %d/%d fps" % (self.videowidth,
def print_info(self): """prints out the information on the given file""" if not self.finished: self.discover() if not self.mimetype: print "Unknown media type" return print "Mime Type :\t", self.mimetype if not self.is_video and not self.is_audio: return print "Length :\t", time_to_string(max(self.audiolength, self.vid...
self.videorate)
self.videorate.num, self.videorate.denom)
def print_info(self): """prints out the information on the given file""" if not self.finished: self.discover() if not self.mimetype: print "Unknown media type" return print "Mime Type :\t", self.mimetype if not self.is_video and not self.is_audio: return print "Length :\t", time_to_string(max(self.audiolength, self.vid...
self.path = path
self.path = [os.path.abspath(x) for x in path]
def __init__(self, filename=None, path=[]): self.modulename = None self.ignores = {} self.glob_ignores = [] self.type_ignores = {} self.overrides = {} self.overridden = {} self.kwargs = {} self.noargs = {} self.onearg = {} self.staticmethod = {} self.classmethod = {} self.startlines = {} self.override_attrs = {} self.o...
os.chdir(os.path.abspath(path))
os.chdir(path)
def handle_file(self, filename): oldpath = os.getcwd()
continue
os.chdir(oldpath)
def handle_file(self, filename): oldpath = os.getcwd()
dirname = os.path.dirname(os.path.abspath(filename))
dirname = path
def handle_file(self, filename): oldpath = os.getcwd()
if 'ltihooks' in sys.modules: del sys.modules['ltihooks']
del sys.modules['ltihooks']
def __repr__(self): return '<gst.Fraction %d/%d>' % (self.num, self.denom)
assert res[1] == -1
def testQuery(self): gst.debug('querying fakesrc in FORMAT_BYTES') res = self.element.query_position(gst.FORMAT_BYTES) self.assertEquals(self.pipeline.__gstrefcount__, 1) self.assertEquals(sys.getrefcount(self.pipeline), 3) self.assertEquals(self.element.__gstrefcount__, 2) self.assertEquals(sys.getrefcount(self.elemen...
def do_change_state(self): self._state_changed = True
def do_change_state(self, state_change): if state_change == gst.STATE_CHANGE_PAUSED_TO_PLAYING: self._state_changed = True
def do_change_state(self): self._state_changed = True # chain up to parent return gst.Bin.do_change_state(self)
return gst.Bin.do_change_state(self)
return gst.Bin.do_change_state(self, state_change)
def do_change_state(self): self._state_changed = True # chain up to parent return gst.Bin.do_change_state(self)
import gst.interfaces as interfaces
def __repr__(self): return '<gst.Fraction %d/%d>' % (self.num, self.denom)
matcher.register('GstData*', GstDataPtrArg())
def write_return(self, ptype, ownsreturn, info): if ptype == 'GstCaps*': info.varlist.add('GstCaps', '*ret') copyval = 'FALSE' elif ptype == 'const-GstCaps*': info.varlist.add('const GstCaps', '*ret') copyval = 'TRUE' else: raise RuntimeError, "write_return not implemented for %s" % ptype info.codeafter.append(' ret...
cleanup=("Py_DECREF(py_%s);" % self.name))
cleanup=("gst_caps_ref(%s);\nPy_DECREF(py_%s);" % (self.name, self.name)))
def convert_c2py(self): self.wrapper.add_declaration("PyObject *py_%s = NULL;" % self.name) self.wrapper.write_code(code=("if (%s)\n" " py_%s = pyg_boxed_new (GST_TYPE_CAPS, %s, FALSE, TRUE);\n" "else {\n" " Py_INCREF(Py_None);\n" " py_%s = Py_None;\n" "}" % (self.name, self.name, self.name, self.name)), clean...
self.add_many(self.src, self.dbin)
self.add(self.src, self.dbin)
def __init__(self, filename): gobject.GObject.__init__(self)
print "query didn't work"
gst.warning("position query didn't work")
def _notify_caps_cb(self, pad, args): caps = pad.get_negotiated_caps()
if caps.is_fixed(): print "have negotiated caps", caps self.audiocaps = caps return
def _new_decoded_pad_cb(self, dbin, pad, is_last): # Does the file contain got audio or video ? caps = pad.get_caps()
if caps.is_fixed(): print "have negotiated caps", caps self.videocaps = caps return
def _new_decoded_pad_cb(self, dbin, pad, is_last): # Does the file contain got audio or video ? caps = pad.get_caps()
self.add_many(fakesink, queue)
self.add(fakesink, queue)
def _new_decoded_pad_cb(self, dbin, pad, is_last): # Does the file contain got audio or video ? caps = pad.get_caps()
print "
pad.warning("
def _new_decoded_pad_cb(self, dbin, pad, is_last): # Does the file contain got audio or video ? caps = pad.get_caps()
ret = self.player.query_position(gst.FORMAT_TIME)
position, format = self.player.query_position(gst.FORMAT_TIME)
def query_position(self): "Returns a (position, duration) tuple" try: ret = self.player.query_position(gst.FORMAT_TIME) except: position = gst.CLOCK_TIME_NONE else: position = ret[0]
else: position = ret[0]
def query_position(self): "Returns a (position, duration) tuple" try: ret = self.player.query_position(gst.FORMAT_TIME) except: position = gst.CLOCK_TIME_NONE else: position = ret[0]
ret = self.player.query_duration(gst.FORMAT_TIME)
duration, format = self.player.query_duration(gst.FORMAT_TIME)
def query_position(self): "Returns a (position, duration) tuple" try: ret = self.player.query_position(gst.FORMAT_TIME) except: position = gst.CLOCK_TIME_NONE else: position = ret[0]
else: duration = ret[0] return (position, duration, ret[1])
return (position, duration)
def query_position(self): "Returns a (position, duration) tuple" try: ret = self.player.query_position(gst.FORMAT_TIME) except: position = gst.CLOCK_TIME_NONE else: position = ret[0]
self.p_position, self.p_duration, format = self.player.query_position()
self.p_position, self.p_duration = self.player.query_position()
def update_scale_cb(self): self.p_position, self.p_duration, format = self.player.query_position() if self.p_position != gst.CLOCK_TIME_NONE: value = self.p_position * 100.0 / self.p_duration self.adjustment.set_value(value)
ret = self.player.query_position(gst.FORMAT_TIME) if not ret: return (gst.CLOCK_TIME_NONE, gst.CLOCK_TIME_NONE, gst.FORMAT_TIME) return ret
try: ret = self.player.query_position(gst.FORMAT_TIME) except: position = gst.CLOCK_TIME_NONE else: position = ret[0] try: ret = self.player.query_duration(gst.FORMAT_TIME) except: duration = gst.CLOCK_TIME_NONE else: duration = ret[0] return (position, duration, ret[1])
def query_position(self): "Returns a (position, duration) tuple" ret = self.player.query_position(gst.FORMAT_TIME) if not ret: return (gst.CLOCK_TIME_NONE, gst.CLOCK_TIME_NONE, gst.FORMAT_TIME)
def get_state(self, timeout=0.050):
def get_state(self, timeout=1):
def get_state(self, timeout=0.050): return self.player.get_state(timeout=timeout)
cur, pen, final = self.get_state(timeout=0.0)
cur, pen, final = self.get_state(timeout=0)
def is_in_state(self, state): gst.debug("checking if player is in state %r" % state) cur, pen, final = self.get_state(timeout=0.0) gst.debug("checked if player is in state %r" % state) if pen == gst.STATE_VOID_PENDING and cure == state: return True return False
vbox.pack_start(hbox)
vbox.pack_start(hbox, fill=False, expand=False)
def create_ui(self): vbox = gtk.VBox()
self.player.get_state(timeout=0.050)
self.player.get_state(timeout=50)
def scale_value_changed_cb(self, scale): # see seek.c:seek_cb real = long(scale.get_value() * self.p_duration / 100) # in ns gst.debug('value changed, perform seek to %r' % real) self.player.seek(real) # allow for a preroll self.player.get_state(timeout=0.050) # 50 ms
self.assertEqual(event.parse_seek(), [1.0, gst.FORMAT_BYTES, gst.SEEK_FLAG_FLUSH, gst.SEEK_TYPE_SET, 0, gst.SEEK_TYPE_NONE, 0])
self.assertEqual(event.parse_seek(), (1.0, gst.FORMAT_BYTES, gst.SEEK_FLAG_FLUSH, gst.SEEK_TYPE_SET, 0, gst.SEEK_TYPE_NONE, 0))
def testEventSeek(self): # this event only serves to change the rate of data transfer event = gst.event_new_seek(1.0, gst.FORMAT_BYTES, gst.SEEK_FLAG_FLUSH, gst.SEEK_TYPE_NONE, 0, gst.SEEK_TYPE_NONE, 0) # FIXME: but basesrc goes into an mmap/munmap spree, needs to be fixed
self.failUnless(self.event == self.events[0])
def testTrueProbe(self): probe_id = self.src.add_event_probe(self._probe_handler, True) self.event = gst.event_new_eos() gst.debug('created new eos %r, id %x' % ( self.event, id(self.event))) self.assertEquals(self.event.__grefcount__, 1) # a True probe lets it pass self.assertEquals(self.src.push_event(self.event), Tr...
control.set_interpolation_mode("volume", gst.INTERPOLATE_LINEAR)
control.set_interpolation_mode("freq", gst.INTERPOLATE_LINEAR)
def main(): pipeline = gst.Pipeline("audiocontroller") src = gst.element_factory_make("audiotestsrc", "src") sink = gst.element_factory_make("alsasink", "sink") pipeline.add(src, sink) src.link(sink) control = gst.Controller(src, "freq", "volume") control.set_interpolation_mode("volume", gst.INTERPOLATE_LINEAR) contro...
def setUp(self): self.gctrack() def tearDown(self): self.gccollect() self.gcverify()
def setUp(self): self.gctrack()
self.gctrack()
TestCase.setUp(self)
def setUp(self): self.gctrack() self.src = gst.Pad("src", gst.PAD_SRC) self.sink = gst.Pad("sink", gst.PAD_SINK)
self.gccollect() self.gcverify()
TestCase.tearDown(self)
def tearDown(self): self.assertEquals(sys.getrefcount(self.src), 3) self.assertEquals(self.src.__gstrefcount__, 1) del self.src self.assertEquals(sys.getrefcount(self.sink), 3) self.assertEquals(self.sink.__gstrefcount__, 1) del self.sink self.gccollect() self.gcverify()
self.gctrack()
TestCase.setUp(self)
def setUp(self): self.gctrack() self.src = gst.Pad("src", gst.PAD_SRC) self.sink = gst.Pad("sink", gst.PAD_SINK) caps = gst.caps_from_string("foo/bar") self.src.set_caps(caps) self.sink.set_caps(caps) self.sink.set_chain_function(self._chain_func) self.src.link(self.sink) self.buffers = []
self.gctrack()
TestCase.setUp(self)
def setUp(self): self.gctrack() self.src = gst.Pad("src", gst.PAD_SRC) self.sink = gst.Pad("sink", gst.PAD_SINK) caps = gst.caps_from_string("foo/bar") self.src.set_caps(caps) self.sink.set_caps(caps) self.sink.set_chain_function(self._chain_func) self.buffers = []
self.gctrack()
def setUp(self): self.pipeline = gst.parse_launch('fakesrc name=source ! fakesink') src = self.pipeline.get_by_name('source') self.srcpad = src.get_pad('src') self.gctrack()
self.gccollect() self.gcverify()
TestCase.tearDown(self)
def tearDown(self): del self.pipeline del self.srcpad self.gccollect() self.gcverify()
self.gctrack()
TestCase.setUp(self)
def setUp(self): self.gctrack() self.pipeline = gst.Pipeline() self.assertEquals(self.pipeline.__gstrefcount__, 1) self.assertEquals(sys.getrefcount(self.pipeline), 3)
self.gcverify()
TestCase.tearDown(self)
def tearDown(self): self.assertEquals(self.pipeline.__gstrefcount__, 1) self.assertEquals(sys.getrefcount(self.pipeline), 3) self.assertEquals(self.fakesrc.__gstrefcount__, 2) self.assertEquals(sys.getrefcount(self.fakesrc), 3) self.assertEquals(self.fakesink.__gstrefcount__, 2) self.assertEquals(sys.getrefcount(self.f...
pass
import time time.sleep(.0001)
def testFakeSrcProbeMany(self): self.fakesrc.set_property('num-buffers', 1000)
assert isinstance(queue, gst.Queue)
def testConstruct(self): queue = gst.element_factory_make('queue') assert isinstance(queue, gst.Queue) assert queue.get_name() == 'queue0' self.assertEquals(queue.__gstrefcount__, 1)
import DLFCN, sys
import sys
def __repr__(self): return '<gst.Fraction %d/%d>' % (self.num, self.denom)
sys.setdlopenflags(DLFCN.RTLD_LAZY | DLFCN.RTLD_GLOBAL)
try: from DLFCN import RTLD_GLOBAL, RTLD_LAZY except ImportError: RTLD_GLOBAL = -1 RTLD_LAZY = -1 import os osname = os.uname()[0] if osname == 'Linux' or osname == 'SunOS' or osname == 'FreeBSD': RTLD_GLOBAL = 0x100 RTLD_LAZY = 0x1 elif osname == 'Darwin': RTLD_GLOBAL = 0x8 RTLD_LAZY = 0x1 del os except: RTLD_GLOBAL =...
def __repr__(self): return '<gst.Fraction %d/%d>' % (self.num, self.denom)
from _gst import * import interfaces
if RTLD_GLOBAL != -1 and RTLD_LAZY != -1: sys.setdlopenflags(RTLD_LAZY | RTLD_GLOBAL) from _gst import * import interfaces
def __repr__(self): return '<gst.Fraction %d/%d>' % (self.num, self.denom)
del DLFCN, sys
del sys
def __repr__(self): return '<gst.Fraction %d/%d>' % (self.num, self.denom)
def testPerform(self):
def testPerformNoArg(self): probe = gst.Probe(True, self._probe_callback_no_arg) buffer = gst.Buffer() probe.perform(buffer) self.assertEqual(self._no_arg, None) def _probe_callback_no_arg(self, probe, data): self._no_arg = None def testPerformOneArg(self):
def testPerform(self): probe = gst.Probe(True, self._probe_callback, "yeeha") buffer = gst.Buffer() probe.perform(buffer) self.assertEqual(self._probe_result, "yeeha")
def testPerformTwoArgs(self): probe = gst.Probe(True, self._probe_callback_two, "yeeha", "works") buffer = gst.Buffer() probe.perform(buffer) self.assertEqual(self._probe_result1, "yeeha") self.assertEqual(self._probe_result2, "works") def _probe_callback_two(self, probe, data, result1, result2): self._probe_result1 =...
def _probe_callback(self, probe, data, result): self._probe_result = result return True
label.set_selectable(True)
def _create_ui(self, title, description, task): self.set_border_width(6) self.set_resizable(False) self.set_has_separator(False)
self.touri = touri self.src = gst.element_make_from_uri(gst.URI_SRC, fromuri) self.remuxbin = RemuxBin(start, stop) self.sink = gst.element_make_from_uri(gst.URI_SINK, touri)
self.touri = None self.start_time = start self.stop_time = stop self.src = self.remuxbin = self.sink = None
def __init__(self, fromuri, touri, start, stop): # HACK: should do Pipeline.__init__, but that doesn't do what we # want; there's a bug open aboooot that self.__gobject_init__()
self.sink.connect('allow-overwrite', self._allow_overwrite)
self.sink.connect('allow-overwrite', lambda *x: True)
def __init__(self, fromuri, touri, start, stop): # HACK: should do Pipeline.__init__, but that doesn't do what we # want; there's a bug open aboooot that self.__gobject_init__()
self.window = None self.pdialog = None self.start_time = start self.stop_time = stop self._query_id = -1 def _allow_overwrite(self, sink, uri): name = self.sink.get_uri() name = (gst.uri_has_protocol(name, 'file') and gst.uri_get_location(name) or name) m = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL|gtk.DIALOG_...
def do_get_touri(self): chooser = gtk.FileChooserDialog('Save as...', self.window, action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(gtk.STOCK_CANCEL, CANCELLED, gtk.STOCK_SAVE, SUCCESS)) chooser.set_uri(self.fromuri) chooser.unselect_all() chooser.set_do_overwrite_confirmation(True) name = self.fromuri.split('/')[-1][:-4]...
def __init__(self, fromuri, touri, start, stop): # HACK: should do Pipeline.__init__, but that doesn't do what we # want; there's a bug open aboooot that self.__gobject_init__()
self.window = main_window
def start(self, main_window): bus = self.get_bus() bus.add_signal_watch() bus.connect('message', self._bus_watch) self.window = main_window if self.window: # can be None if we are debugging... self.window.set_sensitive(False) fromname = self.fromuri.split('/')[-1] toname = self.touri.split('/')[-1] self.pdialog = Remux...
self.start(main_window) loop = gobject.MainLoop() self.connect('done', lambda *x: gobject.idle_add(loop.quit)) loop.run()
if self.start(main_window): loop = gobject.MainLoop() self.connect('done', lambda *x: gobject.idle_add(loop.quit)) loop.run() else: self.resolution = CANCELLED
def run(self, main_window): self.start(main_window) loop = gobject.MainLoop() self.connect('done', lambda *x: gobject.idle_add(loop.quit)) loop.run() return self.resolution
assert len(buffer) == 128
self.assertEquals(len(buffer), 128)
def testBufferCreateSub(self): s = '' for i in range(64): s += '%02d' % i buffer = gst.Buffer(s) assert len(buffer) == 128
assert sub.offset == gst.CLOCK_TIME_NONE, sub.offset
self.assertEquals(sub.size, 16) self.assertEquals(sub.offset, gst.CLOCK_TIME_NONE)
def testBufferCreateSub(self): s = '' for i in range(64): s += '%02d' % i buffer = gst.Buffer(s) assert len(buffer) == 128
i = pipeline.get_bus().connect('message::application', self.on_message) if pipeline.set_state(gst.STATE_PLAYING) == gst.STATE_CHANGE_SUCCESS: print "going into main" gtk.Dialog.run(self) else: self.error('Could not set state')
i = pipeline.get_bus().connect('message', self.on_message) pipeline.set_state(gst.STATE_PLAYING) gtk.Dialog.run(self)
def run(self): try: self.set_sensitive(False) s = 'alsasrc ! level message=true ! fakesink' pipeline = gst.parse_launch(s) self.set_sensitive(True) pipeline.get_bus().add_signal_watch() i = pipeline.get_bus().connect('message::application', self.on_message) if pipeline.set_state(gst.STATE_PLAYING) == gst.STATE_CHANGE_S...
pipeline = gst.parse_launch('fakesrc ! fakesink name=sink') self.sink = pipeline.get_by_name('sink') pipeline.set_state(gst.STATE_PLAYING)
def setUp(self): pipeline = gst.parse_launch('fakesrc ! fakesink name=sink') self.sink = pipeline.get_by_name('sink') pipeline.set_state(gst.STATE_PLAYING) TestCase.setUp(self)
' 0, /* tp_as_buffer */\n' \
' (PyBufferProcs*)%(tp_as_buffer)s, /* tp_as_buffer */\n' \
def resetline(self): '''resets line numbering to the original file''' self.setline(self.lineno + 1, self.filename)
'tp_call', 'tp_str', 'tp_richcompare', 'tp_iter',
'tp_call', 'tp_str', 'tp_as_buffer', 'tp_richcompare', 'tp_iter',
def resetline(self): '''resets line numbering to the original file''' self.setline(self.lineno + 1, self.filename)
cfg = distutils.sysconfig.get_config_var
cfg = sysconfig.get_config_var
def patch_makefile(source_dir, build_dir): makefile_name = os.path.join(build_dir, 'Local', 'Makefile') makefile = open(makefile_name, 'r').readlines() cfg = distutils.sysconfig.get_config_var cflags = '-I%s %s' % (cfg('INCLUDEPY'), cfg('CFLAGSFORSHARED')) lib = os.path.join(cfg('LIBPL'), cfg('LIBRARY')) extralibs = ...
lib = os.path.join(cfg('LIBPL'), cfg('LIBRARY')) extralibs = ' '.join([cfg('LIBM'), cfg('LIBS'), cfg('LDFLAGS'), lib, cfg('LINKFORSHARED')])
extralibs = '%s -lpython%s' % (cfg('LDFLAGS'), cfg('VERSION'))
def patch_makefile(source_dir, build_dir): makefile_name = os.path.join(build_dir, 'Local', 'Makefile') makefile = open(makefile_name, 'r').readlines() cfg = distutils.sysconfig.get_config_var cflags = '-I%s %s' % (cfg('INCLUDEPY'), cfg('CFLAGSFORSHARED')) lib = os.path.join(cfg('LIBPL'), cfg('LIBRARY')) extralibs = ...
has_options = 1
has_options = True
def patch_makefile(source_dir, build_dir): makefile_name = os.path.join(build_dir, 'Local', 'Makefile') makefile = open(makefile_name, 'r').readlines() cfg = distutils.sysconfig.get_config_var cflags = '-I%s %s' % (cfg('INCLUDEPY'), cfg('CFLAGSFORSHARED')) lib = os.path.join(cfg('LIBPL'), cfg('LIBRARY')) extralibs = ...
makefile[i] = makefile[i].rstrip() + ' ' + cflags + '\n'
makefile[i] = makefile[i].rstrip() + ' ' + cflags.strip() + '\n'
def patch_makefile(source_dir, build_dir): makefile_name = os.path.join(build_dir, 'Local', 'Makefile') makefile = open(makefile_name, 'r').readlines() cfg = distutils.sysconfig.get_config_var cflags = '-I%s %s' % (cfg('INCLUDEPY'), cfg('CFLAGSFORSHARED')) lib = os.path.join(cfg('LIBPL'), cfg('LIBRARY')) extralibs = ...
has_options = 0
has_options = False
def patch_makefile(source_dir, build_dir): makefile_name = os.path.join(build_dir, 'Local', 'Makefile') makefile = open(makefile_name, 'r').readlines() cfg = distutils.sysconfig.get_config_var cflags = '-I%s %s' % (cfg('INCLUDEPY'), cfg('CFLAGSFORSHARED')) lib = os.path.join(cfg('LIBPL'), cfg('LIBRARY')) extralibs = ...
print ' ', os.path.join(distutils.sysconfig.get_python_lib(), 'exim_local_scan.py')
print ' ', os.path.join(sysconfig.get_python_lib(), 'exim_local_scan.py')
def patch_makefile(source_dir, build_dir): makefile_name = os.path.join(build_dir, 'Local', 'Makefile') makefile = open(makefile_name, 'r').readlines() cfg = distutils.sysconfig.get_config_var cflags = '-I%s %s' % (cfg('INCLUDEPY'), cfg('CFLAGSFORSHARED')) lib = os.path.join(cfg('LIBPL'), cfg('LIBRARY')) extralibs = ...
def patch_makefile(old_makefile, new_makefile): makefile = open(old_makefile, 'r').readlines()
SOURCE_FILE = 'expy_local_scan.c' def patch_makefile(source_dir, build_dir): makefile_name = os.path.join(build_dir, 'Local', 'Makefile') makefile = open(makefile_name, 'r').readlines()
def patch_makefile(old_makefile, new_makefile): makefile = open(old_makefile, 'r').readlines() cfg = distutils.sysconfig.get_config_var cflags = '-I%s %s' % (cfg('INCLUDEPY'), cfg('CFLAGSFORSHARED')) lib = os.path.join(cfg('LIBPL'), cfg('LIBRARY')) extralibs = ' '.join([cfg('LIBM'), cfg('LIBS'), cfg('LDFLAGS'), lib, ...
source = 'Local/expy_local_scan.c'
source = os.path.join('Local', SOURCE_FILE)
def patch_makefile(old_makefile, new_makefile): makefile = open(old_makefile, 'r').readlines() cfg = distutils.sysconfig.get_config_var cflags = '-I%s %s' % (cfg('INCLUDEPY'), cfg('CFLAGSFORSHARED')) lib = os.path.join(cfg('LIBPL'), cfg('LIBRARY')) extralibs = ' '.join([cfg('LIBM'), cfg('LIBS'), cfg('LDFLAGS'), lib, ...
open(new_makefile, 'w').write(makefile)
open(makefile_name, 'w').write(makefile)
def patch_makefile(old_makefile, new_makefile): makefile = open(old_makefile, 'r').readlines() cfg = distutils.sysconfig.get_config_var cflags = '-I%s %s' % (cfg('INCLUDEPY'), cfg('CFLAGSFORSHARED')) lib = os.path.join(cfg('LIBPL'), cfg('LIBRARY')) extralibs = ' '.join([cfg('LIBM'), cfg('LIBS'), cfg('LDFLAGS'), lib, ...
if len(sys.argv) < 3:
if len(sys.argv) < 2:
def patch_makefile(old_makefile, new_makefile): makefile = open(old_makefile, 'r').readlines() cfg = distutils.sysconfig.get_config_var cflags = '-I%s %s' % (cfg('INCLUDEPY'), cfg('CFLAGSFORSHARED')) lib = os.path.join(cfg('LIBPL'), cfg('LIBRARY')) extralibs = ' '.join([cfg('LIBM'), cfg('LIBS'), cfg('LDFLAGS'), lib, ...
print ' Usage: %s <original-makefile> <new-makefile>' % sys.argv[0]
print ' Usage: %s <build_dir>' % sys.argv[0]
def patch_makefile(old_makefile, new_makefile): makefile = open(old_makefile, 'r').readlines() cfg = distutils.sysconfig.get_config_var cflags = '-I%s %s' % (cfg('INCLUDEPY'), cfg('CFLAGSFORSHARED')) lib = os.path.join(cfg('LIBPL'), cfg('LIBRARY')) extralibs = ' '.join([cfg('LIBM'), cfg('LIBS'), cfg('LDFLAGS'), lib, ...
patch_makefile(sys.argv[1], sys.argv[2])
build_dir = sys.argv[1] source_dir = os.path.abspath(os.path.dirname(sys.argv[0])) patch_makefile(source_dir, build_dir)
def patch_makefile(old_makefile, new_makefile): makefile = open(old_makefile, 'r').readlines() cfg = distutils.sysconfig.get_config_var cflags = '-I%s %s' % (cfg('INCLUDEPY'), cfg('CFLAGSFORSHARED')) lib = os.path.join(cfg('LIBPL'), cfg('LIBRARY')) extralibs = ' '.join([cfg('LIBM'), cfg('LIBS'), cfg('LDFLAGS'), lib, ...
print "'''~+%s+~'''\n" % x['title']
print "||||||||<tablestyle=\"border: 0\"style=\"border: 0; text-align: center\"> [[BR]]'''~+%s+~''' ||" % x['title']
def get_colors(artifact): style = '<style="background-color: %s; color: %s">' colors = {'Bad': ('red', 'black'), 'Open': ('yellow', 'black'), 'Pending': ('#11ff00', 'black'), 'Closed': ('#009900', 'white')} if artifact['status'] != 'Closed': if 'Nobody' in artifact['assigned_to']: return style % colors['Bad'] ...
print " '''%s'''[[BR]]" % category
print "||||||||<(> '''%s''' ||" % category
def get_colors(artifact): style = '<style="background-color: %s; color: %s">' colors = {'Bad': ('red', 'black'), 'Open': ('yellow', 'black'), 'Pending': ('#11ff00', 'black'), 'Closed': ('#009900', 'white')} if artifact['status'] != 'Closed': if 'Nobody' in artifact['assigned_to']: return style % colors['Bad'] ...
print ' ||%s %s ||<bgcolor=" print ''
print '||%s %s ||<bgcolor="
def get_colors(artifact): style = '<style="background-color: %s; color: %s">' colors = {'Bad': ('red', 'black'), 'Open': ('yellow', 'black'), 'Pending': ('#11ff00', 'black'), 'Closed': ('#009900', 'white')} if artifact['status'] != 'Closed': if 'Nobody' in artifact['assigned_to']: return style % colors['Bad'] ...
nothing is done.
nothing is done, unless the config options ('config' command) are changed.
def formvalue(formname, fieldname, value): """ >> formvalue <formname> <field> <value> Set value of a form field. There are some ambiguities in the way formvalue deals with lists: 'fv' will *add* the given value to a multilist. Formvalue ignores read-only fields completely; if they're readonly, nothing is done. Ava...
assert form
if form is None: if len(self._browser._forms) == 1: form = self._browser._forms[0] else: raise Exception("more than one form; you must select one (use 'fv') before submitting")
def submit(self, fieldname): form = self._browser.form assert form
r.nameservers = [_resolve_name(server)]
r.nameservers = [_resolve_name(server, None)]
def _resolve_name(name, server): """ Resolve the given name to an IP address. """ if is_ip_addr(name): return name r = dns.resolver.Resolver() if server: r.nameservers = [_resolve_name(server)] answers = r.query(name) answer = None for answer in answers: # @CTB !? break assert answer return str(answer)...
for command in commands.__all__: fn = getattr(commands, command) def do_cmd(self, rest_of_line, cmd=command): global_dict, local_dict = namespaces.get_twill_glocals() args = [] if rest_of_line.strip() != "": try: args = parse.arguments.parseString(rest_of_line)[0] args = parse.process_args(args, global_dict,local_dic...
return help_cmd class Singleton(object): def __new__(cls, *args, **kwds): it = cls.__dict__.get("__it__") if it is not None: return it cls.__it__ = it = object.__new__(cls) it.init(*args, **kwds) return it def init(self, *args, **kwds): pass
def __init__(cls, cls_name, cls_bases, cls_dict): super(_command_loop_metaclass, cls).__init__(cls_name, cls_bases, cls_dict)
class TwillCommandLoop(object, cmd.Cmd):
def get_command_shell(): return TwillCommandLoop.__it__ class TwillCommandLoop(Singleton, cmd.Cmd):
def help_cmd(self, message=fn.__doc__, cmd=command): print '=' * 15 print '\nHelp for command %s:\n' % (cmd,) print message.strip() print '' print '=' * 15 print ''
__metaclass__ = _command_loop_metaclass def __init__(self, **kw):
def init(self, **kw):
def help_cmd(self, message=fn.__doc__, cmd=command): print '=' * 15 print '\nHelp for command %s:\n' % (cmd,) print message.strip() print '' print '=' * 15 print ''
ctl = self.get_form_field(self._browser.form, fieldname)
ctl = self.get_form_field(form, fieldname)
def submit(self, fieldname): if not self._browser._forms: raise Exception("no forms on this page!") ctl = None form = self._browser.form if form is None: if len(self._browser._forms) == 1: form = self._browser._forms[0] else: raise Exception("more than one form; you must select one (use 'fv') before submitting")
globals_dict, locals_dict = parse.get_twill_glocals()
global_dict, local_dict = parse.get_twill_glocals()
def do_cmd(self, rest_of_line, cmd=command): globals_dict, locals_dict = parse.get_twill_glocals()
args = parse.process_args(args,globals_dict,locals_dict)
args = parse.process_args(args, global_dict, local_dict)
def do_cmd(self, rest_of_line, cmd=command): globals_dict, locals_dict = parse.get_twill_glocals()
parse.execute_command(cmd, args, globals_dict, locals_dict)
parse.execute_command(cmd, args, global_dict, local_dict)
def do_cmd(self, rest_of_line, cmd=command): globals_dict, locals_dict = parse.get_twill_glocals()
if line[0] == '
global_dict, local_dict = parse.get_twill_glocals() cmd, args = parse.parse_command(line, global_dict, local_dict) if cmd is None:
def default(self, line): "Called when unknown command is executed."