diff -Nru wmii-hg-2757~lucid/alternative_wmiircs/python/pygmi/fs.py wmii-hg-2758~lucid/alternative_wmiircs/python/pygmi/fs.py --- wmii-hg-2757~lucid/alternative_wmiircs/python/pygmi/fs.py 2010-07-07 04:26:01.000000000 +0100 +++ wmii-hg-2758~lucid/alternative_wmiircs/python/pygmi/fs.py 2010-07-08 02:49:26.000000000 +0100 @@ -13,11 +13,6 @@ spacere = re.compile(r'\s') sentinel = {} -def tounicode(obj): - if isinstance(obj, str): - return obj.decode('UTF-8') - return unicode(obj) - class utf8(object): def __str__(self): return unicode(self).encode('utf-8') @@ -90,10 +85,12 @@ """ Arguments are joined by ascii spaces and written to the ctl file. """ - def next(file): + def next(file, exc=None, tb=None): + if exc: + print exc if file: self.ctl_file = file - file.awrite(u' '.join(map(tounicode, args))) + file.awrite(u' '.join(map(unicode, args))) if self.ctl_file: return next(self.ctl_file) getattr(client, self.ctl_open)(self.ctl_path, callback=next, mode=OWRITE) @@ -690,7 +687,7 @@ if val is False: return "off" if val in (Toggle, Always, Never): return unicode(val).lower() - return tounicode(val) + return unicode(val) def __get__(self, obj, cls): return self diff -Nru wmii-hg-2757~lucid/alternative_wmiircs/python/pygmi/menu.py wmii-hg-2758~lucid/alternative_wmiircs/python/pygmi/menu.py --- wmii-hg-2757~lucid/alternative_wmiircs/python/pygmi/menu.py 2010-07-07 04:26:01.000000000 +0100 +++ wmii-hg-2758~lucid/alternative_wmiircs/python/pygmi/menu.py 2010-07-08 02:49:26.000000000 +0100 @@ -3,12 +3,11 @@ __all__ = 'Menu', 'ClickMenu' -def inthread(name, args, action, **kwargs): +def inthread(args, action, **kwargs): fn = lambda: call(*args, **kwargs) if not action: return fn() t = Thread(target=lambda: action(fn())) - t.name += '-%s' % name t.daemon = True t.start() @@ -30,7 +29,7 @@ args += ['-h', self.histfile] if self.nhist: args += ['-n', self.nhist] - return inthread('Menu', map(str, args), self.action, input='\n'.join(choices)) + return inthread(map(str, args), self.action, input='\n'.join(choices)) call = __call__ class ClickMenu(object): @@ -49,7 +48,7 @@ if self.prev: args += ['-i', self.prev] args += ['--'] + list(choices) - return inthread('ClickMenu', map(str, args), self.action) + return inthread(map(str, args), self.action) call = __call__ # vim:se sts=4 sw=4 et: diff -Nru wmii-hg-2757~lucid/alternative_wmiircs/python/pygmi/monitor.py wmii-hg-2758~lucid/alternative_wmiircs/python/pygmi/monitor.py --- wmii-hg-2757~lucid/alternative_wmiircs/python/pygmi/monitor.py 2010-07-07 04:26:01.000000000 +0100 +++ wmii-hg-2758~lucid/alternative_wmiircs/python/pygmi/monitor.py 2010-07-08 02:49:26.000000000 +0100 @@ -51,8 +51,6 @@ side = 'right' interval = 1.0 - define = classmethod(defmonitor) - def __init__(self, name=None, interval=None, side=None, action=None, colors=None, label=None): """ @@ -95,7 +93,6 @@ self.button.create(*label) self.timer = Timer(self.interval, self.tick) - self.timer.name = 'Monitor-Timer-%s' % self.name self.timer.daemon = True self.timer.start() diff -Nru wmii-hg-2757~lucid/alternative_wmiircs/python/pyxp/asyncclient.py wmii-hg-2758~lucid/alternative_wmiircs/python/pyxp/asyncclient.py --- wmii-hg-2757~lucid/alternative_wmiircs/python/pyxp/asyncclient.py 2010-07-07 04:26:01.000000000 +0100 +++ wmii-hg-2758~lucid/alternative_wmiircs/python/pyxp/asyncclient.py 2010-07-08 02:49:26.000000000 +0100 @@ -1,17 +1,14 @@ from pyxp import client, fcall from pyxp.client import * -from functools import wraps def awithfile(*oargs, **okwargs): def wrapper(fn): - @wraps(fn) def next(self, path, *args, **kwargs): def next(file, exc, tb): fn(self, (file, exc, tb), *args, **kwargs) self.aopen(path, next, *oargs, **okwargs) return next return wrapper - def wrap_callback(fn, file): def callback(data, exc, tb): file.close() @@ -22,7 +19,6 @@ ROOT_FID = 0 def _awalk(self, path, callback, fail=None): - path = self._splitpath(path) ctxt = dict(path=path, fid=self._getfid(), ofid=ROOT_FID) def next(resp=None, exc=None, tb=None): if exc and ctxt['ofid'] != ROOT_FID: @@ -39,63 +35,65 @@ self._dorpc(fcall.Twalk(fid=ofid, newfid=ctxt['fid'], wname=wname), - next) + next) next() _file = property(lambda self: File) - def _aopen(self, path, mode, fcall, callback, fail=None, origpath=None): - path = self._splitpath(path) + def _aopen(self, path, mode, open, callback, fail=None, origpath=None): resp = None def next(fid, exc, tb): def next(resp, exc, tb): - file = self._file(self, origpath or '/'.join(path), resp, fid, mode, - cleanup=lambda: self._clunk(fid)) + def cleanup(): + self._clunk(fid) + file = self._file(self, origpath or '/'.join(path), resp, fid, mode, cleanup) self.respond(callback, file) - fcall.fid = fid - self._dorpc(fcall, next, fail or callback) + self._dorpc(open(fid), next, fail or callback) self._awalk(path, next, fail or callback) def aopen(self, path, callback=True, fail=None, mode=OREAD): assert callable(callback) - return self._aopen(path, mode, fcall.Topen(mode=mode), - callback, fail) + path = self._splitpath(path) + def open(fid): + return fcall.Topen(fid=fid, mode=mode) + return self._aopen(path, mode, open, fail or callback) def acreate(self, path, callback=True, fail=None, mode=OREAD, perm=0): path = self._splitpath(path) name = path.pop() - + def open(fid): + return fcall.Tcreate(fid=fid, mode=mode, name=name, perm=perm) if not callable(callback): - callback = lambda resp: resp and resp.close() - - return self._aopen(path, mode, fcall.Tcreate(mode=mode, name=name, perm=perm), - callback, fail, origpath='/'.join(path + [name])) + def callback(resp, exc, tb): + if resp: + resp.close() + return self._aopen(path, mode, open, callback, fail, + origpath='/'.join(path + [name])) def aremove(self, path, callback=True, fail=None): - def next(fid): + path = self._splitpath(path) + def next(fid, exc, tb): self._dorpc(fcall.Tremove(fid=fid), callback, fail) - self._awalk(path, next, fail or callback) + self._awalk(path, next, callback, fail) - def astat(self, path, callback, fail=None): - def next(fid): - def next(resp): - self.respond(callback, resp.stat) - self._dorpc(fcall.Tstat(fid=fid), next, fail or callback) - self._awalk(self, next, fail or callback) + def astat(self, path, callback, fail = None): + path = self._splitpath(path) + def next(fid, exc, tb): + def next(resp, exc, tb): + callback(resp.stat, exc, tb) + self._dorpc(fcall.Tstat(fid=fid), next, callback) @awithfile() def aread(self, (file, exc, tb), callback, *args, **kwargs): if exc: - self.respond(callback, file, exc, tb) + callback(file, exc, tb) else: file.aread(wrap_callback(callback, file), *args, **kwargs) - @awithfile(mode=OWRITE) def awrite(self, (file, exc, tb), data, callback=True, *args, **kwargs): if exc: self.respond(callback, file, exc, tb) else: file.awrite(data, wrap_callback(callback, file), *args, **kwargs) - @awithfile() def areadlines(self, (file, exc, tb), fn): def callback(resp): @@ -110,35 +108,36 @@ file.sreadlines(callback) class File(client.File): + @staticmethod + def respond(callback, data, exc=None, tb=None): + if callable(callback): + callback(data, exc, tb) def stat(self, callback): def next(resp, exc, tb): - Client.respond(callback, resp.stat, exc, tb) + callback(resp.stat, exc, tb) resp = self._dorpc(fcall.Tstat(), next, callback) def aread(self, callback, fail=None, count=None, offset=None, buf=''): ctxt = dict(res=[], count=self.iounit, offset=self.offset) - if count is not None: ctxt['count'] = count if offset is not None: ctxt['offset'] = offset - def next(resp=None, exc=None, tb=None): if resp and resp.data: ctxt['res'].append(resp.data) ctxt['offset'] += len(resp.data) - if ctxt['count'] == 0: if offset is None: self.offset = ctxt['offset'] - return Client.respond(callback, ''.join(ctxt['res']), exc, tb) + return callback(''.join(ctxt['res']), exc, tb) n = min(ctxt['count'], self.iounit) ctxt['count'] -= n self._dorpc(fcall.Tread(offset=ctxt['offset'], count=n), - next, fail or callback) + next, fail or callback) next() def areadlines(self, callback): @@ -166,7 +165,6 @@ ctxt = dict(offset=self.offset, off=0) if offset is not None: ctxt['offset'] = offset - def next(resp=None, exc=None, tb=None): if resp: ctxt['off'] += resp.count @@ -175,21 +173,21 @@ n = min(len(data), self.iounit) self._dorpc(fcall.Twrite(offset=ctxt['offset'], - data=data[ctxt['off']:ctxt['off']+n]), - next, fail or callback) + data=data[ctxt['off']:ctxt['off']+n]), + next, fail or callback) else: if offset is None: self.offset = ctxt['offset'] - Client.respond(callback, ctxt['off'], exc, tb) + self.respond(callback, ctxt['off'], exc, tb) next() def aremove(self, callback=True, fail=None): def next(resp, exc, tb): self.close() if exc and fail: - Client.respond(fail, resp and True, exc, tb) + self.respond(fail, resp and True, exc, tb) else: - Client.respond(callback, resp and True, exc, tb) + self.respond(callback, resp and True, exc, tb) self._dorpc(fcall.Tremove(), next) # vim:se sts=4 sw=4 et: diff -Nru wmii-hg-2757~lucid/alternative_wmiircs/python/pyxp/client.py wmii-hg-2758~lucid/alternative_wmiircs/python/pyxp/client.py --- wmii-hg-2757~lucid/alternative_wmiircs/python/pyxp/client.py 2010-07-07 04:26:01.000000000 +0100 +++ wmii-hg-2758~lucid/alternative_wmiircs/python/pyxp/client.py 2010-07-08 02:49:26.000000000 +0100 @@ -46,7 +46,8 @@ @staticmethod def respond(callback, data, exc=None, tb=None): if callable(callback): - callback(*(data, exc, tb)[0:callback.func_code.co_argcount]) + callback(data, exc, tb) + def __enter__(self): return self @@ -76,13 +77,13 @@ if root: path = self._splitpath(root) resp = self._dorpc(fcall.Twalk(fid=ROOT_FID, - newfid=ROOT_FID, - wname=path)) - except Exception: + newfid=ROOT_FID, + wname=path)) + except Exception, e: traceback.print_exc(sys.stdout) if getattr(self, 'mux', None): self.mux.fd.close() - raise + raise e def _cleanup(self): try: @@ -101,22 +102,21 @@ raise ProtocolException, "Missmatched RPC message types: %s => %s" % ( req.__class__.__name__, resp.__class__.__name__) return resp - def next(mux, resp): try: res = doresp(resp) except Exception, e: - self.respond(error or callback, None, e, None) + if error: + self.respond(error, None, e, None) + else: + self.respond(callback, None, e, None) else: self.respond(callback, res) - if not callback: return doresp(self.mux.rpc(req)) self.mux.rpc(req, next) def _splitpath(self, path): - if isinstance(path, list): - return path return [v for v in path.split('/') if v != ''] def _getfid(self): @@ -163,13 +163,12 @@ return Res _file = property(lambda self: File) - def _open(self, path, mode, fcall, origpath=None): + def _open(self, path, mode, open, origpath=None): resp = None with self._walk(path) as nfid: fid = nfid - fcall.fid = fid - resp = self._dorpc(fcall) + resp = self._dorpc(open(fid)) def cleanup(): self._aclunk(fid) @@ -179,14 +178,17 @@ def open(self, path, mode=OREAD): path = self._splitpath(path) - return self._open(path, mode, fcall.Topen(mode=mode)) + def open(fid): + return fcall.Topen(fid=fid, mode=mode) + return self._open(path, mode, open) def create(self, path, mode=OREAD, perm=0): path = self._splitpath(path) name = path.pop() - return self._open(path, mode, fcall.Tcreate(mode=mode, name=name, perm=perm), - origpath='/'.join(path + [name])) + def open(fid): + return fcall.Tcreate(fid=fid, mode=mode, name=name, perm=perm) + return self._open(path, mode, open, origpath='/'.join(path + [name])) def remove(self, path): path = self._splitpath(path) diff -Nru wmii-hg-2757~lucid/alternative_wmiircs/python/pyxp/messages.py wmii-hg-2758~lucid/alternative_wmiircs/python/pyxp/messages.py --- wmii-hg-2757~lucid/alternative_wmiircs/python/pyxp/messages.py 2010-07-07 04:26:01.000000000 +0100 +++ wmii-hg-2758~lucid/alternative_wmiircs/python/pyxp/messages.py 2010-07-08 02:49:26.000000000 +0100 @@ -28,7 +28,7 @@ __metaclass__ = MessageBase def __init__(self, *args, **kwargs): if args: - args = dict(zip((f.name for f in self.fields), args)) + args = dict(zip([f.name for f in self.fields], args)) args.update(kwargs) kwargs = args; for k, v in kwargs.iteritems(): diff -Nru wmii-hg-2757~lucid/alternative_wmiircs/python/pyxp/mux.py wmii-hg-2758~lucid/alternative_wmiircs/python/pyxp/mux.py --- wmii-hg-2757~lucid/alternative_wmiircs/python/pyxp/mux.py 2010-07-07 04:26:01.000000000 +0100 +++ wmii-hg-2758~lucid/alternative_wmiircs/python/pyxp/mux.py 2010-07-08 02:49:26.000000000 +0100 @@ -14,7 +14,6 @@ # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -import os import sys import traceback @@ -29,7 +28,7 @@ def __init__(self, con, process, flush=None, mintag=0, maxtag=1<<16 - 1): self.queue = set() self.lock = RLock() - self.tagcond = Condition(self.lock) + self.rendez = Condition(self.lock) self.outlock = RLock() self.inlock = RLock() self.process = process @@ -91,6 +90,7 @@ return self.mux(rpc) def async_dispatch(self, rpc): + self.async_mux.pop(rpc) rpc.async(self, rpc.data) def electmuxer(self): @@ -117,7 +117,7 @@ tag = 0 while not self.free: - self.tagcond.wait() + self.rendez.wait() tag = self.free.pop() @@ -134,33 +134,21 @@ if rpc.tag in self.wait: del self.wait[rpc.tag] self.free.add(rpc.tag) - self.tagcond.notify() + self.rendez.notify() def send(self, dat): data = ''.join(dat.marshall()) n = self.fd.send(data) return n == len(data) def recv(self): - def readn(fd, n): - data = '' - while len(data) < n: - try: - data += fd.recv(n - len(data)) - except os.error, e: - if e.errno != os.errno.EINTR: - raise e - return data - try: with self.inlock: - data = readn(self.fd, 4) + data = self.fd.recv(4) if data: - nmsg = fields.Int.decoders[4](data, 0) - data += readn(self.fd, nmsg - 4) + len = fields.Int.decoders[4](data, 0) + data += self.fd.recv(len - 4) return self.process(data) except Exception, e: - print e.__class__.__name__ - print repr(e) traceback.print_exc(sys.stderr) return None @@ -188,9 +176,6 @@ self.async = async self.waiting = False - def __repr__(self): - return '' % tuple(map(repr, (self.tag, self.orig, self.data, self.async, self.waiting))) - def dispatch(self, data=None): self.data = data self.notify() @@ -198,11 +183,8 @@ self.mux.async_dispatch(self) class Queue(Thread): - _id = 1 - def __init__(self, op): - super(Queue, self).__init__(name='Queue-%d-%s' % (Queue._id, repr(op))) - Queue._id += 1 + super(Queue, self).__init__() self.cond = Condition() self.op = op self.queue = [] diff -Nru wmii-hg-2757~lucid/debian/changelog wmii-hg-2758~lucid/debian/changelog --- wmii-hg-2757~lucid/debian/changelog 2010-07-07 04:27:13.000000000 +0100 +++ wmii-hg-2758~lucid/debian/changelog 2010-07-08 03:01:53.000000000 +0100 @@ -1,12 +1,11 @@ -wmii-hg (2757~lucid) lucid; urgency=low +wmii-hg (2758~lucid) lucid; urgency=low - * Snapshot release for 2010/07/06 + * [arch] Fix pkgdesc for pyxp/pygmi. - -- Kris Maglione Tue, 06 Jul 2010 23:26:02 -0400 + -- Kris Maglione Wed, 07 Jul 2010 21:49:31 -0400 -wmii-hg (hg2756~lucid) lucid; urgency=low +wmii-hg (2757~lucid) lucid; urgency=low * Snapshot release for 2010/07/06 - -- Kris Maglione Tue, 06 Jul 2010 22:23:52 -0400 - + -- Kris Maglione Tue, 06 Jul 2010 23:26:02 -0400 diff -Nru wmii-hg-2757~lucid/mk/wmii.mk wmii-hg-2758~lucid/mk/wmii.mk --- wmii-hg-2757~lucid/mk/wmii.mk 2010-07-07 04:26:03.000000000 +0100 +++ wmii-hg-2758~lucid/mk/wmii.mk 2010-07-08 02:49:32.000000000 +0100 @@ -1,4 +1,4 @@ -VERSION = 2757 +VERSION = 2758 CONFVERSION = -hg COPYRIGHT = ©2010 Kris Maglione diff -Nru wmii-hg-2757~lucid/PKGBUILD wmii-hg-2758~lucid/PKGBUILD --- wmii-hg-2757~lucid/PKGBUILD 2010-07-07 04:26:03.000000000 +0100 +++ wmii-hg-2758~lucid/PKGBUILD 2010-07-08 02:49:32.000000000 +0100 @@ -1,6 +1,6 @@ pkgname=(wmii-hg python-pyxp-hg python-pygmi-hg) -pkgver=2757 +pkgver=2758 pkgrel=1 pkgdesc="A lightweight, dynamic window manager for X11" url="http://wmii.suckless.org" @@ -26,7 +26,7 @@ package_wmii-hg() { depends=(libx11 libxinerama libxrandr) optdepends=("plan9port: for use of the alternative plan9port wmiirc" \ - "${pkgname[2]}: for use of the alternative Python wmiirc" \ + "${pkgname[2]}: for use of the alternative Python wmiirc" \ "ruby-rumai: for use of the alternative Ruby wmiirc" \ "libxft: for anti-aliased font support") provides=(wmii) @@ -38,12 +38,14 @@ } package_python-pyxp-hg() { + pkgdesc="Python 9P client library" arch=(any) depends=(python) _make -C alternative_wmiircs/python pyclean pyxp.install } package_python-pygmi-hg() { + pkgdesc="Python wmii interaction library" arch=(any) depends=(python-pyxp-hg) _make -C alternative_wmiircs/python pyclean pygmi.install