Пример #1
0
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
def get(path1, path2, opts):
    opts += configopts('common')
    opts += configopts('get')
    return create_filesystem(opts).get(path1, path2, opts)
Пример #3
0
def put(path1, path2, opts):
    opts += configopts('common')
    opts += configopts('put')
    return create_filesystem(opts).put(path1, path2, opts)
Пример #4
0
def rm(path, opts):
    opts += configopts('common')
    opts += configopts('rm')
    return create_filesystem(opts).rm(path, opts)
Пример #5
0
def exists(path, opts):
    opts += configopts('common')
    opts += configopts('exists')
    return create_filesystem(opts).exists(path, opts)
Пример #6
0
def ls(path, opts):
    opts += Options(configopts('common'))
    opts += Options(configopts('ls'))
    return create_filesystem(opts).ls(path, opts)
Пример #7
0
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
def rm(path, opts):
    opts += Options(configopts('common'))
    opts += Options(configopts('rm'))
    return create_filesystem(opts).rm(path, opts)
Пример #10
0
def exists(path, opts):
    opts += Options(configopts('common'))
    opts += Options(configopts('exists'))
    return create_filesystem(opts).exists(path, opts)
Пример #11
0
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
def cat(path, opts):
    opts += configopts('common')
    opts += configopts('cat')
    return create_filesystem(opts).cat(path, opts)
Пример #16
0
def ls(path, opts):
    opts += configopts('common')
    opts += configopts('ls')
    return create_filesystem(opts).ls(path, opts)
Пример #17
0
def get(path1, path2, opts):
    opts += Options(configopts('common'))
    opts += Options(configopts('get'))
    return create_filesystem(opts).get(path1, path2, opts)