def convert(prog, path, opts): opts += configopts('common') opts += configopts('convert') addedopts = getopts(opts, ['libegg'], delete=False) pyenv = envdef('PYTHONPATH', addedopts['libegg'], shortcuts=dict(configopts('eggs', prog)), extrapaths=sys.path) # add eggs to path newpath = resolved_files(addedopts['libegg'], shortcuts=dict(configopts('eggs',prog))) newpath.extend(sys.path) sys.path = newpath if not getopt(opts, 'prog', delete=False): opts.append(('prog', prog)) # try importing this as a module import imp try: module = imp.load_source('dumbo.converter',prog) except ImportError: if not os.path.exists(prog): print >> sys.stderr, 'ERROR:', prog, 'does not exist' else: print >> sys.stderr, 'ERROR: cannot import', prog return 1 try: conv = module.Converter(opts) except AttributeError: print >> sys.stderr, 'ERROR:', prog, 'does not have a converter class' return 1 return create_filesystem(opts).convert(path, opts, conv)
def get(path1, path2, opts): opts += configopts('common') opts += configopts('get') return create_filesystem(opts).get(path1, path2, opts)
def put(path1, path2, opts): opts += configopts('common') opts += configopts('put') return create_filesystem(opts).put(path1, path2, opts)
def rm(path, opts): opts += configopts('common') opts += configopts('rm') return create_filesystem(opts).rm(path, opts)
def exists(path, opts): opts += configopts('common') opts += configopts('exists') return create_filesystem(opts).exists(path, opts)
def ls(path, opts): opts += Options(configopts('common')) opts += Options(configopts('ls')) return create_filesystem(opts).ls(path, opts)
def cat(path, opts): opts += Options(configopts('common')) opts += Options(configopts('cat')) return create_filesystem(opts).cat(path, opts)
def cat(path, opts): opts = Options(opts) opts += Options(configopts('common')) opts += Options(configopts('cat')) return create_filesystem(opts).cat(path, opts)
def rm(path, opts): opts += Options(configopts('common')) opts += Options(configopts('rm')) return create_filesystem(opts).rm(path, opts)
def exists(path, opts): opts += Options(configopts('common')) opts += Options(configopts('exists')) return create_filesystem(opts).exists(path, opts)
def put(path1, path2, opts): opts = Options(opts) opts += Options(configopts('common')) opts += Options(configopts('put')) return create_filesystem(opts).put(path1, path2, opts)
def get(path1, path2, opts): opts = Options(opts) opts += Options(configopts('common')) opts += Options(configopts('get')) return create_filesystem(opts).get(path1, path2, opts)
def rm(path, opts): opts = Options(opts) opts += Options(configopts('common')) opts += Options(configopts('rm')) return create_filesystem(opts).rm(path, opts)
def exists(path, opts): opts = Options(opts) opts += Options(configopts('common')) opts += Options(configopts('exists')) return create_filesystem(opts).exists(path, opts)
def cat(path, opts): opts += configopts('common') opts += configopts('cat') return create_filesystem(opts).cat(path, opts)
def ls(path, opts): opts += configopts('common') opts += configopts('ls') return create_filesystem(opts).ls(path, opts)
def get(path1, path2, opts): opts += Options(configopts('common')) opts += Options(configopts('get')) return create_filesystem(opts).get(path1, path2, opts)