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


Python file_util.write_file方法代码示例

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


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

示例1: run

# 需要导入模块: from distutils import file_util [as 别名]
# 或者: from distutils.file_util import write_file [as 别名]
def run(self):
        if not have_setuptools:
            r = old_install.run(self)
        else:
            r = self.setuptools_run()
        if self.record:
            # bdist_rpm fails when INSTALLED_FILES contains
            # paths with spaces. Such paths must be enclosed
            # with double-quotes.
            f = open(self.record, 'r')
            lines = []
            need_rewrite = False
            for l in f:
                l = l.rstrip()
                if ' ' in l:
                    need_rewrite = True
                    l = '"%s"' % (l)
                lines.append(l)
            f.close()
            if need_rewrite:
                self.execute(write_file,
                             (self.record, lines),
                             "re-writing list of installed files to '%s'" %
                             self.record)
        return r 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:27,代码来源:install.py

示例2: run

# 需要导入模块: from distutils import file_util [as 别名]
# 或者: from distutils.file_util import write_file [as 别名]
def run(self):
        if self.verbose != self.distribution.verbose:
            log.set_verbosity(self.verbose)
        try:
            for spec in self.args:
                self.easy_install(spec, not self.no_deps)
            if self.record:
                outputs = self.outputs
                if self.root:  # strip any package prefix
                    root_len = len(self.root)
                    for counter in range(len(outputs)):
                        outputs[counter] = outputs[counter][root_len:]
                from distutils import file_util

                self.execute(
                    file_util.write_file, (self.record, outputs),
                    "writing list of installed files to '%s'" %
                    self.record
                )
            self.warn_deprecated_options()
        finally:
            log.set_verbosity(self.distribution.verbose) 
开发者ID:jpush,项目名称:jbox,代码行数:24,代码来源:easy_install.py

示例3: run

# 需要导入模块: from distutils import file_util [as 别名]
# 或者: from distutils.file_util import write_file [as 别名]
def run(self):
        if self.verbose != self.distribution.verbose:
            log.set_verbosity(self.verbose)
        try:
            for spec in self.args:
                self.easy_install(spec, not self.no_deps)
            if self.record:
                outputs = list(sorted(self.outputs))
                if self.root:  # strip any package prefix
                    root_len = len(self.root)
                    for counter in range(len(outputs)):
                        outputs[counter] = outputs[counter][root_len:]
                from distutils import file_util

                self.execute(
                    file_util.write_file, (self.record, outputs),
                    "writing list of installed files to '%s'" %
                    self.record
                )
            self.warn_deprecated_options()
        finally:
            log.set_verbosity(self.distribution.verbose) 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:24,代码来源:easy_install.py

示例4: write_manifest

# 需要导入模块: from distutils import file_util [as 别名]
# 或者: from distutils.file_util import write_file [as 别名]
def write_manifest(self):
        """Write the file list in 'self.filelist' (presumably as filled in
        by 'add_defaults()' and 'read_template()') to the manifest file
        named by 'self.manifest'.
        """
        if os.path.isfile(self.manifest):
            fp = open(self.manifest)
            try:
                first_line = fp.readline()
            finally:
                fp.close()

            if first_line != '# file GENERATED by distutils, do NOT edit\n':
                log.info("not writing to manually maintained "
                         "manifest file '%s'" % self.manifest)
                return

        content = self.filelist.files[:]
        content.insert(0, '# file GENERATED by distutils, do NOT edit')
        self.execute(file_util.write_file, (self.manifest, content),
                     "writing manifest file '%s'" % self.manifest) 
开发者ID:glmcdona,项目名称:meddle,代码行数:23,代码来源:sdist.py

示例5: run

# 需要导入模块: from distutils import file_util [as 别名]
# 或者: from distutils.file_util import write_file [as 别名]
def run(self):
        if self.verbose != self.distribution.verbose:
            log.set_verbosity(self.verbose)
        try:
            for spec in self.args:
                self.easy_install(spec, not self.no_deps)
            if self.record:
                outputs = self.outputs
                if self.root:               # strip any package prefix
                    root_len = len(self.root)
                    for counter in range(len(outputs)):
                        outputs[counter] = outputs[counter][root_len:]
                from distutils import file_util
                self.execute(
                    file_util.write_file, (self.record, outputs),
                    "writing list of installed files to '%s'" %
                    self.record
                )
            self.warn_deprecated_options()
        finally:
            log.set_verbosity(self.distribution.verbose) 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:23,代码来源:easy_install.py


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