当前位置: 首页>>代码示例>>Python>>正文


Python Path.addroot方法代码示例

本文整理汇总了Python中fbuild.path.Path.addroot方法的典型用法代码示例。如果您正苦于以下问题:Python Path.addroot方法的具体用法?Python Path.addroot怎么用?Python Path.addroot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fbuild.path.Path的用法示例。


在下文中一共展示了Path.addroot方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __call__

# 需要导入模块: from fbuild.path import Path [as 别名]
# 或者: from fbuild.path.Path import addroot [as 别名]
    def __call__(self, src:fbuild.db.SRC, dst=None, *,
            suffix=None,
            verbose=False,
            name_prefix=None,
            defines=False,
            flags=[],
            buildroot=None) -> fbuild.db.DST:
        buildroot = buildroot or self.ctx.buildroot
        suffix = suffix or self.suffix
        dst = Path.addroot(dst or src, buildroot).replaceext(suffix)
        dst.parent.makedirs()

        cmd = [self.exe]

        if verbose:
            cmd.append('-v')

        if name_prefix is not None:
            cmd.extend(('-p', name_prefix))

        if defines:
            cmd.append('-d')

        cmd.extend(self.flags)
        cmd.extend(flags)
        cmd.extend(('-o', dst))
        cmd.append(src)

        self.ctx.execute(cmd, self.exe, '%s -> %s' % (src, dst), color='yellow')

        return dst
开发者ID:felix-lang,项目名称:fbuild,代码行数:33,代码来源:bison.py

示例2: __call__

# 需要导入模块: from fbuild.path import Path [as 别名]
# 或者: from fbuild.path.Path import addroot [as 别名]
    def __call__(self, src: fbuild.db.SRC, header, dst=None) -> fbuild.db.DSTS:
        dst = Path.addroot(dst or src, self.ctx.buildroot).replaceext(self.suffix)
        dst.parent.makedirs()
        header = Path.addroot(header, self.ctx.buildroot)
        header.parent.makedirs()

        cmd = [self.exe]
        cmd.extend(self.flags)
        if self.debug: cmd.append('-d')
        cmd.extend(('-o', dst))
        cmd.append('--header='+header)
        cmd.append(src)

        self.ctx.execute(cmd, self.exe, '%s -> %s %s' % (src, dst, header),
            color='yellow')

        return [dst, header]
开发者ID:kirbyfan64,项目名称:blaze,代码行数:19,代码来源:fbuildroot.py

示例3: translate

# 需要导入模块: from fbuild.path import Path [as 别名]
# 或者: from fbuild.path.Path import addroot [as 别名]
 def translate(self, src: fbuild.db.SRC, dst) -> fbuild.db.DST:
     dst = Path.addroot(dst, self.ctx.buildroot)
     dst.parent.makedirs()
     cmd = [self.exe, 'dynasm/dynasm.lua']
     for d in self.defs:
         cmd.extend(('-D', d))
     cmd.extend(('-o', dst))
     cmd.append(src)
     self.ctx.execute(cmd, 'dynasm', '%s -> %s' % (src, dst), color='yellow')
     return dst
开发者ID:MariadeAnton,项目名称:rejit,代码行数:12,代码来源:fbuildroot.py

示例4: foo

# 需要导入模块: from fbuild.path import Path [as 别名]
# 或者: from fbuild.path.Path import addroot [as 别名]
def foo(ctx, src:fbuild.db.SRC, dst, *, buildroot=None) -> fbuild.db.DST:
    dst = Path.addroot(dst, buildroot or ctx.buildroot)

    ctx.logger.log(' * foo: %s %s' % (src, dst), color='cyan')

    with open(src) as f:
        x = f.read().strip()

    with open(dst, 'w') as f:
        print(src, dst, x, file=f)

    return dst
开发者ID:DawidvC,项目名称:felix,代码行数:14,代码来源:fbuildroot.py

示例5: __call__

# 需要导入模块: from fbuild.path import Path [as 别名]
# 或者: from fbuild.path.Path import addroot [as 别名]
    def __call__(self, src, dst, *, buildroot=None):
        buildroot = buildroot or self.ctx.buildroot
        dst = Path.addroot(dst, buildroot).addprefix(self.prefix) + self.suffix

        self.ctx.logger.log(' * Builder.__call__: %s %s' % (src, dst),
            color='cyan')

        with open(src) as f:
            x = f.read().strip()

        with open(dst, 'w') as f:
            print(src, dst, x, file=f)

        return dst
开发者ID:DawidvC,项目名称:felix,代码行数:16,代码来源:fbuildroot.py

示例6: check_fluid

# 需要导入模块: from fbuild.path import Path [as 别名]
# 或者: from fbuild.path.Path import addroot [as 别名]
def check_fluid(linker):
    fluidsynth = Path(linker.prefix + 'fluidsynth' + linker.suffix)
    fluidsynth = fluidsynth.addroot(Path('fluidsynth') / 'fluidsynth' / 'src')

    message = textwrap.dedent('''
    You need to build Fluidsynth separately first!
    Try runnung 'cd fluidsynth/fluidsynth; cmake'.
    (See http://sourceforge.net/p/fluidsynth/wiki/BuildingWithCMake/ for info.)
    '''.rstrip().lstrip('\n')).replace('\n', ' ', 1)

    if not fluidsynth.exists():
        raise fbuild.ConfigFailed(message)

    return fluidsynth
开发者ID:midifi,项目名称:midifi,代码行数:16,代码来源:fbuildroot.py

示例7: uncached_compile

# 需要导入模块: from fbuild.path import Path [as 别名]
# 或者: from fbuild.path.Path import addroot [as 别名]
    def uncached_compile(self, src, *,
            static=None,
            includes=[],
            flags=[],
            buildroot=None,
            **kwargs):
        """Compile a felix file without caching the results.  This is needed
        when compiling temporary files."""
        print("Uncached compile " + src)
        src = Path(src)
        buildroot = buildroot or self.ctx.buildroot
        src_buildroot = src.addroot(buildroot)

        if static is None:
            static = self.static

        if static:
            dst = src_buildroot.replaceext(self.exe_suffix)
        else:
            dst = src_buildroot.replaceext(self.lib_suffix)

        if src != src_buildroot:
            src_buildroot.parent.makedirs()
            src.copy(src_buildroot)
            src = src_buildroot

        includes = set(includes)
        includes.update(self.includes)
        includes.add(src.parent)

        cmd_flags = ['-c']
        cmd_flags.extend(self.flags)
        cmd_flags.extend(flags)

        self.flx(src, self.flx, '%s -> %s' % (src, dst),
            includes=includes,
            static=static,
            flags=cmd_flags,
            color='compile',
            **kwargs)

        return dst
开发者ID:alexkross,项目名称:felix,代码行数:44,代码来源:felix.py

示例8: __call__

# 需要导入模块: from fbuild.path import Path [as 别名]
# 或者: from fbuild.path.Path import addroot [as 别名]
    def __call__(self, src, *args, flags=[], buildroot=None, **kwargs):
        """Run a scala script."""

        src = Path(src)
        buildroot = buildroot or self.ctx.buildroot
        src_buildroot = src.addroot(buildroot)
        dst = src.replaceext('.jar')

        # We need to copy the src into the buildroot so we don't pollute our
        # tree.
        if src != src_buildroot:
            src_buildroot.parent.makedirs()
            src.copy(src_buildroot)
            src = src_buildroot

        # Always save the compilation results.
        flags = list(flags)
        flags.append('-savecompiled')

        stdout, stderr = self._run([src], *args, flags=flags, **kwargs)
        return dst, stdout, stderr
开发者ID:felix-lang,项目名称:fbuild,代码行数:23,代码来源:scala.py

示例9: find_font

# 需要导入模块: from fbuild.path import Path [as 别名]
# 或者: from fbuild.path.Path import addroot [as 别名]
def find_font(ctx) -> fbuild.db.DST:
    ctx.logger.check('locating arial font')
    font = None

    if sys.platform == 'win32':
        font = Path(os.environ['SYSTEMROOT']) / 'Fonts' / 'Arial.ttf'
        if not font.exists():
            font = None
    elif sys.platform.startswith('linux'):
        # Check /etc/fonts/fonts.conf.
        font_dirs = []
        fonts = Path('/etc/fonts/fonts.conf')
        if not fonts.exists():
            ctx.logger.failed()
            raise fbuild.ConfigFailed('cannot locate fonts.conf')

        tree = etree.parse(str(fonts))
        for element in tree.findall('dir'):
            path = Path(element.text)
            if element.attrib.get('prefix') == 'xdg' and \
                'XDG_DATA_HOME' in os.environ:
                path = path.addroot(os.environ['XDG_DATA_HOME'])

            try:
                font = Path(next(path.find('Arial.ttf', include_dirs=False)))
            except StopIteration:
                pass
            else:
                break

    if font is None:
        ctx.logger.failed()
        raise fbuild.ConfigFailed('cannot locate arial font')
    else:
        ctx.logger.passed('ok %s' % font)
        return font
开发者ID:midifi,项目名称:midifi,代码行数:38,代码来源:fbuildroot.py

示例10: crystal

# 需要导入模块: from fbuild.path import Path [as 别名]
# 或者: from fbuild.path.Path import addroot [as 别名]
def crystal(ctx, srcs: fbuild.db.SRCS, dst) -> fbuild.db.DST:
    dst = Path.addroot(dst, ctx.buildroot)
    ctx.execute(['crystal', 'build', '-o', dst, srcs[0]], 'crystal',
        '%s -> %s' % (' '.join(srcs), dst), color='yellow')
    return dst
开发者ID:kirbyfan64,项目名称:wit,代码行数:7,代码来源:ildroot.py


注:本文中的fbuild.path.Path.addroot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。