/cli/src/

ect by scheme-to-class dispatch The url classes taken into consideration are the ones in this module whose names are full-caps. """ m = UrlRX.match(ustr) if not m: ustr = desugar(ustr) m = UrlRX.match(ustr) if not m: raise GsyncdError("malformed url") sch, path = m.groups() this = sys.modules[__name__] if not hasattr(this, sch.upper()): raise GsyncdError("unknown url scheme " + sch) return getattr(this, sch.upper())(path) class _MetaXattr(object): """singleton class, a lazy wrapper around the libcxattr module libcxattr (a heavy import due to ctypes) is loaded only when when the single instance is tried to be used. This reduces runtime for those invocations which do not need filesystem manipulation (eg. for config, url parsing) """ def __getattr__(self, meth): from libcxattr import Xattr as LXattr xmeth = [ m for m in dir(LXattr) if m[0] != '_' ] if not meth in xmeth: return for m in xmeth: setattr(self, m, getattr(LXattr, m)) return getattr(self, meth) class _MetaChangelog(object): def __getattr__(self, meth): from libgfchangelog import Changes as LChanges xmeth = [ m for m in dir(LChanges) if m[0] != '_' ] if not meth in xmeth: return for m in xmeth: setattr(self, m, getattr(LChanges, m)) return getattr(self, meth) Xattr = _MetaXattr() Changes = _MetaChangelog() class Popen(subprocess.Popen): """customized subcl