示例#1
0
文件: cmd.py 项目: dgleich/dumbo
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)
示例#2
0
文件: cmd.py 项目: VickiFu/dumbo
def get(path1, path2, opts):
    opts += configopts('common')
    opts += configopts('get')
    return create_filesystem(opts).get(path1, path2, opts)
示例#3
0
文件: cmd.py 项目: VickiFu/dumbo
def put(path1, path2, opts):
    opts += configopts('common')
    opts += configopts('put')
    return create_filesystem(opts).put(path1, path2, opts)
示例#4
0
文件: cmd.py 项目: VickiFu/dumbo
def rm(path, opts):
    opts += configopts('common')
    opts += configopts('rm')
    return create_filesystem(opts).rm(path, opts)
示例#5
0
文件: cmd.py 项目: VickiFu/dumbo
def exists(path, opts):
    opts += configopts('common')
    opts += configopts('exists')
    return create_filesystem(opts).exists(path, opts)
示例#6
0
文件: cmd.py 项目: andrix/dumbo
def ls(path, opts):
    opts += Options(configopts('common'))
    opts += Options(configopts('ls'))
    return create_filesystem(opts).ls(path, opts)
示例#7
0
文件: cmd.py 项目: andrix/dumbo
def cat(path, opts):
    opts += Options(configopts('common'))
    opts += Options(configopts('cat'))
    return create_filesystem(opts).cat(path, opts)
示例#8
0
文件: cmd.py 项目: jso/dumbo
def cat(path, opts):
    opts = Options(opts)
    opts += Options(configopts('common'))
    opts += Options(configopts('cat'))
    return create_filesystem(opts).cat(path, opts)
示例#9
0
文件: cmd.py 项目: andrix/dumbo
def rm(path, opts):
    opts += Options(configopts('common'))
    opts += Options(configopts('rm'))
    return create_filesystem(opts).rm(path, opts)
示例#10
0
文件: cmd.py 项目: andrix/dumbo
def exists(path, opts):
    opts += Options(configopts('common'))
    opts += Options(configopts('exists'))
    return create_filesystem(opts).exists(path, opts)
示例#11
0
文件: cmd.py 项目: soxofaan/dumbo
def put(path1, path2, opts):
    opts = Options(opts)
    opts += Options(configopts('common'))
    opts += Options(configopts('put'))
    return create_filesystem(opts).put(path1, path2, opts)
示例#12
0
文件: cmd.py 项目: jso/dumbo
def get(path1, path2, opts):
    opts = Options(opts)
    opts += Options(configopts('common'))
    opts += Options(configopts('get'))
    return create_filesystem(opts).get(path1, path2, opts)
示例#13
0
文件: cmd.py 项目: jso/dumbo
def rm(path, opts):
    opts = Options(opts)
    opts += Options(configopts('common'))
    opts += Options(configopts('rm'))
    return create_filesystem(opts).rm(path, opts)
示例#14
0
文件: cmd.py 项目: jso/dumbo
def exists(path, opts):
    opts = Options(opts)
    opts += Options(configopts('common'))
    opts += Options(configopts('exists'))
    return create_filesystem(opts).exists(path, opts)
示例#15
0
文件: cmd.py 项目: VickiFu/dumbo
def cat(path, opts):
    opts += configopts('common')
    opts += configopts('cat')
    return create_filesystem(opts).cat(path, opts)
示例#16
0
文件: cmd.py 项目: VickiFu/dumbo
def ls(path, opts):
    opts += configopts('common')
    opts += configopts('ls')
    return create_filesystem(opts).ls(path, opts)
示例#17
0
文件: cmd.py 项目: andrix/dumbo
def get(path1, path2, opts):
    opts += Options(configopts('common'))
    opts += Options(configopts('get'))
    return create_filesystem(opts).get(path1, path2, opts)