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


Python FSPath.isabsolute方法代码示例

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


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

示例1: do_build

# 需要导入模块: from unipath import FSPath [as 别名]
# 或者: from unipath.FSPath import isabsolute [as 别名]
    def do_build(self, arguments):
        # If no course arguments are given, build all the courses.
        if arguments['<course>']:
            try:
                courses = [self.library.courses[c] for c in arguments['<course>']]
            except KeyError:
                raise CLIError("No such course:", c)
        else:
            courses = self.library.courses.values()

        for course in courses:
            self.out.write(u'Building %s\n' % course.title)

            # Make the dest directory.
            dest = self.library.build_path.child(course.slug)
            if dest.exists():
                dest.rmtree()
            dest.mkdir(parents=True)

            # Create the sphinx support directories (_static, _templates) by
            # merging directories from the internal chucks-support directory
            # and from the library's theme if it exists. This has to happen
            # before building the handounts and Sphinx docs because both those
            # steps uses these components.
            for subdir in ('_static', '_templates'):
                chucksdir = self.support_path.child(subdir)
                themedir = self.library.theme_path.child(subdir)
                sources = [d for d in (chucksdir, themedir) if d.exists()]
                if not dest.child(subdir).exists():
                    dest.child(subdir).mkdir()
                fileutils.merge_trees(sources, dest.child(subdir))

            # Write out an auth.json for the deployment step. This should
            # probably actually become part of the deployment step at some point.
            if hasattr(course, 'auth'):
                json.dump(course.auth, open(dest.child('auth.json'), 'w'))

            # Handouts have to go first: Sphinx links to the handouts.
            self._build_handouts(course)
            self._build_sphinx(course)

            # Copy over any extra files to be downloaded. FIXME: This is a nasty
            # hack. Inject these into toc.html as download links?
            for fname in getattr(course, 'downloads', []):
                p = Path(fname)
                if p.isabsolute():
                    src = p
                else:
                    src = self.library.path.child(*p.components())
                shutil.copy(src, dest.child('html'))
开发者ID:jacobian,项目名称:chucks,代码行数:52,代码来源:cli.py


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