예제 #1
0
파일: umdh.py 프로젝트: a-palchikov/pyumdh
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: