示例#1
0
def _data_file(fn, config, curdir=None):
    datapath = utils.data_dir(config.get('WORK_DIR', curdir))
    return os.path.join(datapath, fn)
示例#2
0
def _data_file(fn, config, curdir=None):
    datapath = utils.data_dir(config.get('WORK_DIR', curdir))
    return os.path.join(datapath, fn)
示例#3
0
文件: differ.py 项目: jenix21/pyumdh
        sys.exit(1)

    (opts, args) = parser.parse_args()
    sys.argv[:] = args

    log = logging.getLogger('umdh')
    log.addHandler(logging.StreamHandler())
    if opts.verbose:
        log.setLevel(logging.DEBUG)

    if args:
        log.debug('unqualified files=%s' % args)
    if os.path.exists(configpath):
        log.debug('using local config.py')

    datadir = utils.data_dir(config.get('WORK_DIR', binpath))
    cachefiles = [fn for fn in os.listdir(datadir) if fnmatch(fn, '.cache.py')]
    if cachefiles:
        cachefile = cachefiles.pop()
        log.debug('using cached config: %s' % cachefile)
        cachedconfig = imp.load_source('config', \
                                os.path.join(datadir, cachefile))
        cachedopts = utils.Attributify(cachedconfig)
        config.update(cachedopts)
    # in case we receive ids for log files on the command line
    # guess them by probing files in the configured working directory
    # given options from the cached config
    files = opts.logs or args
    try:
        _ids = map(int, files)
    except ValueError: