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


Python dep_util.newer方法代码示例

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


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

示例1: BuildTypelib

# 需要导入模块: from distutils import dep_util [as 别名]
# 或者: from distutils.dep_util import newer [as 别名]
def BuildTypelib():
    from distutils.dep_util import newer
    this_dir = os.path.dirname(__file__)
    idl = os.path.abspath(os.path.join(this_dir, "pippo.idl"))
    tlb=os.path.splitext(idl)[0] + '.tlb'
    if newer(idl, tlb):
        print "Compiling %s" % (idl,)
        rc = os.system ('midl "%s"' % (idl,))
        if rc:
            raise RuntimeError("Compiling MIDL failed!")
        # Can't work out how to prevent MIDL from generating the stubs.
        # just nuke them
        for fname in "dlldata.c pippo_i.c pippo_p.c pippo.h".split():
            os.remove(os.path.join(this_dir, fname))
    
    print "Registering %s" % (tlb,)
    tli=pythoncom.LoadTypeLib(tlb)
    pythoncom.RegisterTypeLib(tli,tlb) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:20,代码来源:pippo_server.py

示例2: test_newer

# 需要导入模块: from distutils import dep_util [as 别名]
# 或者: from distutils.dep_util import newer [as 别名]
def test_newer(self):

        tmpdir = self.mkdtemp()
        new_file = os.path.join(tmpdir, 'new')
        old_file = os.path.abspath(__file__)

        # Raise DistutilsFileError if 'new_file' does not exist.
        self.assertRaises(DistutilsFileError, newer, new_file, old_file)

        # Return true if 'new_file' exists and is more recently modified than
        # 'old_file', or if 'new_file' exists and 'old_file' doesn't.
        self.write_file(new_file)
        self.assertTrue(newer(new_file, 'I_dont_exist'))
        self.assertTrue(newer(new_file, old_file))

        # Return false if both exist and 'old_file' is the same age or younger
        # than 'new_file'.
        self.assertFalse(newer(old_file, new_file)) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:20,代码来源:test_dep_util.py

示例3: preprocess

# 需要导入模块: from distutils import dep_util [as 别名]
# 或者: from distutils.dep_util import newer [as 别名]
def preprocess(self, source, output_file=None, macros=None,
                   include_dirs=None, extra_preargs=None, extra_postargs=None):
        fixed_args = self._fix_compile_args(None, macros, include_dirs)
        ignore, macros, include_dirs = fixed_args
        pp_opts = gen_preprocess_options(macros, include_dirs)
        pp_args = self.preprocessor + pp_opts
        if output_file:
            pp_args.extend(['-o', output_file])
        if extra_preargs:
            pp_args[:0] = extra_preargs
        if extra_postargs:
            pp_args.extend(extra_postargs)
        pp_args.append(source)

        # We need to preprocess: either we're being forced to, or we're
        # generating output to stdout, or there's a target output file and
        # the source file is newer than the target (or the target doesn't
        # exist).
        if self.force or output_file is None or newer(source, output_file):
            if output_file:
                self.mkpath(os.path.dirname(output_file))
            try:
                self.spawn(pp_args)
            except DistutilsExecError as msg:
                raise CompileError(msg) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:27,代码来源:unixccompiler.py

示例4: copy_twisted_plugins

# 需要导入模块: from distutils import dep_util [as 别名]
# 或者: from distutils.dep_util import newer [as 别名]
def copy_twisted_plugins (self):
        """Copy each plugin listed in 'self.twisted_plugins'.
        """
        self.mkpath(self.build_dir)
        for plugin in self.twisted_plugins:
            adjust = 0
            plugin = convert_path(plugin)
            outfile = os.path.join(self.build_dir, plugin)
            if not self.force and not newer(plugin, outfile):
                self.announce("not copying %s (up-to-date)" % plugin)
                continue

            # Always open the file, but ignore failures in dry-run mode --
            # that way, we'll get accurate feedback if we can read the
            # plugin.
            try:
                f = open(plugin, "r")
            except IOError:
                if not self.dry_run:
                    raise
                f = None
            else:
                f.close()
                self.copy_file(plugin, outfile) 
开发者ID:jlachowski,项目名称:clonedigger,代码行数:26,代码来源:twisted_distutils.py

示例5: preprocess

# 需要导入模块: from distutils import dep_util [as 别名]
# 或者: from distutils.dep_util import newer [as 别名]
def preprocess(self, source,
                   output_file=None, macros=None, include_dirs=None,
                   extra_preargs=None, extra_postargs=None):
        ignore, macros, include_dirs = \
            self._fix_compile_args(None, macros, include_dirs)
        pp_opts = gen_preprocess_options(macros, include_dirs)
        pp_args = self.preprocessor + pp_opts
        if output_file:
            pp_args.extend(['-o', output_file])
        if extra_preargs:
            pp_args[:0] = extra_preargs
        if extra_postargs:
            pp_args.extend(extra_postargs)
        pp_args.append(source)

        # We need to preprocess: either we're being forced to, or we're
        # generating output to stdout, or there's a target output file and
        # the source file is newer than the target (or the target doesn't
        # exist).
        if self.force or output_file is None or newer(source, output_file):
            if output_file:
                self.mkpath(os.path.dirname(output_file))
            try:
                self.spawn(pp_args)
            except DistutilsExecError, msg:
                raise CompileError, msg 
开发者ID:glmcdona,项目名称:meddle,代码行数:28,代码来源:unixccompiler.py

示例6: preprocess

# 需要导入模块: from distutils import dep_util [as 别名]
# 或者: from distutils.dep_util import newer [as 别名]
def preprocess (self,
                    source,
                    output_file=None,
                    macros=None,
                    include_dirs=None,
                    extra_preargs=None,
                    extra_postargs=None):

        (_, macros, include_dirs) = \
            self._fix_compile_args(None, macros, include_dirs)
        pp_opts = gen_preprocess_options(macros, include_dirs)
        pp_args = ['cpp32.exe'] + pp_opts
        if output_file is not None:
            pp_args.append('-o' + output_file)
        if extra_preargs:
            pp_args[:0] = extra_preargs
        if extra_postargs:
            pp_args.extend(extra_postargs)
        pp_args.append(source)

        # We need to preprocess: either we're being forced to, or the
        # source file is newer than the target (or the target doesn't
        # exist).
        if self.force or output_file is None or newer(source, output_file):
            if output_file:
                self.mkpath(os.path.dirname(output_file))
            try:
                self.spawn(pp_args)
            except DistutilsExecError, msg:
                print msg
                raise CompileError, msg

    # preprocess() 
开发者ID:glmcdona,项目名称:meddle,代码行数:35,代码来源:bcppcompiler.py

示例7: configuration

# 需要导入模块: from distutils import dep_util [as 别名]
# 或者: from distutils.dep_util import newer [as 别名]
def configuration(parent_package='', top_path=None):
    config = Configuration('f2py', parent_package, top_path)

    config.add_data_dir('tests')

    config.add_data_files('src/fortranobject.c',
                          'src/fortranobject.h',
                          )

    config.make_svn_version_py()

    def generate_f2py_py(build_dir):
        f2py_exe = 'f2py' + os.path.basename(sys.executable)[6:]
        if f2py_exe[-4:] == '.exe':
            f2py_exe = f2py_exe[:-4] + '.py'
        if 'bdist_wininst' in sys.argv and f2py_exe[-3:] != '.py':
            f2py_exe = f2py_exe + '.py'
        target = os.path.join(build_dir, f2py_exe)
        if newer(__file__, target):
            log.info('Creating %s', target)
            f = open(target, 'w')
            f.write(_get_f2py_shebang() + '\n')
            mainloc = os.path.join(os.path.dirname(__file__), "__main__.py")
            with open(mainloc) as mf:
                f.write(mf.read())
            f.close()
        return target

    config.add_scripts(generate_f2py_py)

    log.info('F2PY Version %s', config.get_version())

    return config 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:35,代码来源:setup.py

示例8: all_newer

# 需要导入模块: from distutils import dep_util [as 别名]
# 或者: from distutils.dep_util import newer [as 别名]
def all_newer(src_files, dst_files):
    from distutils.dep_util import newer
    return all(os.path.exists(dst) and newer(dst, src)
               for dst in dst_files for src in src_files) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:6,代码来源:_generate_pyx.py

示例9: test_newer_group

# 需要导入模块: from distutils import dep_util [as 别名]
# 或者: from distutils.dep_util import newer [as 别名]
def test_newer_group(self):
        tmpdir = self.mkdtemp()
        sources = os.path.join(tmpdir, 'sources')
        os.mkdir(sources)
        one = os.path.join(sources, 'one')
        two = os.path.join(sources, 'two')
        three = os.path.join(sources, 'three')
        old_file = os.path.abspath(__file__)

        # return true if 'old_file' is out-of-date with respect to any file
        # listed in 'sources'.
        self.write_file(one)
        self.write_file(two)
        self.write_file(three)
        self.assertTrue(newer_group([one, two, three], old_file))
        self.assertFalse(newer_group([one, two, old_file], three))

        # missing handling
        os.remove(one)
        self.assertRaises(OSError, newer_group, [one, two, old_file], three)

        self.assertFalse(newer_group([one, two, old_file], three,
                                     missing='ignore'))

        self.assertTrue(newer_group([one, two, old_file], three,
                                    missing='newer')) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:28,代码来源:test_dep_util.py


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