コード例 #1
0
ファイル: mk.py プロジェクト: t0mac0/libmysqlpp
def __recordDeps(mod):
    import dependencies
    modfile = '/%s.py' % mod
    for path in sys.path:
        if os.path.isfile(path+modfile):
            dependencies.addDependency(vars['INPUT_FILE'], config.format,
                                       path+modfile)
            return
コード例 #2
0
ファイル: writer.py プロジェクト: t0mac0/libmysqlpp
def __findWriter(writer):
    found = 0
    for p in config.searchPath:
        template = os.path.join(p, writer)
        if os.path.isfile(template):
            found = 1
            rulesdir = p
            if config.track_deps:
                dependencies.addDependency(mk.vars['INPUT_FILE'],
                                           config.format,
                                           os.path.abspath(template))
            break
    if not found:
        raise errors.Error("can't find output writer '%s'" % writer)
    return (rulesdir, template)
コード例 #3
0
ファイル: writer.py プロジェクト: Distrotech/bakefile
def __findWriter(writer):
    found = 0
    for p in config.searchPath:
        template = os.path.join(p, writer)
        if os.path.isfile(template):
            found = 1
            rulesdir = p
            if config.track_deps:
                dependencies.addDependency(
                    mk.vars['INPUT_FILE'], config.format,
                    os.path.abspath(template))
            break
    if not found:        
        raise errors.Error("can't find output writer '%s'" % writer)
    return (rulesdir, template)
コード例 #4
0
ファイル: reader.py プロジェクト: aponxi/libmysqlpp
def handleFragment(e, target=None, add_dict=None):
    if e.props['format'] == config.format:
        if 'file' in e.props:
            filename = os.path.join(os.path.dirname(e.filename), e.props['file'])
            f = open(filename)
            content = f.read()
            f.close()
            if config.track_deps:
                dependencies.addDependency(mk.vars['INPUT_FILE'],
                                           config.format,
                                           os.path.abspath(filename))
        else:
            content = e.value
        if 'location' in e.props:
            loc = evalConstExpr(e, e.props['location'], target, add_dict)
        else:
            loc = None
        mk.addFragment(mk.Fragment(content, loc))
コード例 #5
0
ファイル: reader.py プロジェクト: aponxi/libmysqlpp
def processFile(filename, onlyOnce=False):
    if not os.path.isfile(filename):
        raise ReaderError(None, "file '%s' doesn't exist" % filename)
    filename = os.path.abspath(filename)
    if onlyOnce and filename in includedFiles:
        if config.verbose:
            print "file %s already included, skipping..." % filename
        return
    includedFiles.append(filename)
    if config.verbose:
        print 'loading %s...' % filename
    if config.track_deps:
        dependencies.addDependency(mk.vars['INPUT_FILE'], config.format,
                                   filename)
    newdir = os.path.dirname(filename)
    if newdir not in sys.path:
        sys.path.append(newdir)
    __doProcess(file=filename)
コード例 #6
0
ファイル: reader.py プロジェクト: t0mac0/libmysqlpp
def processFile(filename, onlyOnce=False):
    if not os.path.isfile(filename):
        raise ReaderError(None, "file '%s' doesn't exist" % filename)
    filename = os.path.abspath(filename)
    if onlyOnce and filename in includedFiles:
        if config.verbose:
            print "file %s already included, skipping..." % filename
        return
    includedFiles.append(filename)
    if config.verbose:
        print 'loading %s...' % filename
    if config.track_deps:
        dependencies.addDependency(mk.vars['INPUT_FILE'], config.format,
                                   filename)
    newdir = os.path.dirname(filename)
    if newdir not in sys.path:
        sys.path.append(newdir)
    __doProcess(file=filename)
コード例 #7
0
ファイル: reader.py プロジェクト: t0mac0/libmysqlpp
def handleFragment(e, target=None, add_dict=None):
    if e.props['format'] == config.format:
        if 'file' in e.props:
            filename = os.path.join(os.path.dirname(e.filename),
                                    e.props['file'])
            f = open(filename)
            content = f.read()
            f.close()
            if config.track_deps:
                dependencies.addDependency(mk.vars['INPUT_FILE'],
                                           config.format,
                                           os.path.abspath(filename))
        else:
            content = e.value
        if 'location' in e.props:
            loc = evalConstExpr(e, e.props['location'], target, add_dict)
        else:
            loc = None
        mk.addFragment(mk.Fragment(content, loc))