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


Python errors.DistutilsExecError方法代码示例

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


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

示例1: _call_external_zip

# 需要导入模块: from distutils import errors [as 别名]
# 或者: from distutils.errors import DistutilsExecError [as 别名]
def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False):
    # XXX see if we want to keep an external call here
    if verbose:
        zipoptions = "-r"
    else:
        zipoptions = "-rq"
    from distutils.errors import DistutilsExecError
    from distutils.spawn import spawn
    try:
        spawn(["zip", zipoptions, zip_filename, base_dir], dry_run=dry_run)
    except DistutilsExecError:
        # XXX really should distinguish between "couldn't find
        # external 'zip' command" and "zip failed".
        raise ExecError("unable to create zip file '%s': "
            "could neither import the 'zipfile' module nor "
            "find a standalone zip utility") % zip_filename 
开发者ID:war-and-code,项目名称:jawfish,代码行数:18,代码来源:shutil.py

示例2: _call_external_zip

# 需要导入模块: from distutils import errors [as 别名]
# 或者: from distutils.errors import DistutilsExecError [as 别名]
def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False):
    # XXX see if we want to keep an external call here
    if verbose:
        zipoptions = "-r"
    else:
        zipoptions = "-rq"
    from distutils.errors import DistutilsExecError
    from distutils.spawn import spawn
    try:
        spawn(["zip", zipoptions, zip_filename, base_dir], dry_run=dry_run)
    except DistutilsExecError:
        # XXX really should distinguish between "couldn't find
        # external 'zip' command" and "zip failed".
        raise ExecError, \
            ("unable to create zip file '%s': "
            "could neither import the 'zipfile' module nor "
            "find a standalone zip utility") % zip_filename 
开发者ID:glmcdona,项目名称:meddle,代码行数:19,代码来源:shutil.py

示例3: try_run

# 需要导入模块: from distutils import errors [as 别名]
# 或者: from distutils.errors import DistutilsExecError [as 别名]
def try_run(self, body, headers=None, include_dirs=None, libraries=None,
                library_dirs=None, lang="c"):
        """Try to compile, link to an executable, and run a program
        built from 'body' and 'headers'.  Return true on success, false
        otherwise.
        """
        from distutils.ccompiler import CompileError, LinkError
        self._check_compiler()
        try:
            src, obj, exe = self._link(body, headers, include_dirs,
                                       libraries, library_dirs, lang)
            self.spawn([exe])
            ok = 1
        except (CompileError, LinkError, DistutilsExecError):
            ok = 0

        log.info(ok and "success!" or "failure.")
        self._clean()
        return ok


    # -- High-level methods --------------------------------------------
    # (these are the ones that are actually likely to be useful
    # when implementing a real-world config command!) 
开发者ID:glmcdona,项目名称:meddle,代码行数:26,代码来源:config.py

示例4: _spawn_nt

# 需要导入模块: from distutils import errors [as 别名]
# 或者: from distutils.errors import DistutilsExecError [as 别名]
def _spawn_nt(cmd, search_path=1, verbose=0, dry_run=0):
    executable = cmd[0]
    cmd = _nt_quote_args(cmd)
    if search_path:
        # either we find one or it stays the same
        executable = find_executable(executable) or executable
    log.info(' '.join([executable] + cmd[1:]))
    if not dry_run:
        # spawn for NT requires a full path to the .exe
        try:
            rc = os.spawnv(os.P_WAIT, executable, cmd)
        except OSError, exc:
            # this seems to happen when the command isn't found
            raise DistutilsExecError, \
                  "command '%s' failed: %s" % (cmd[0], exc[-1])
        if rc != 0:
            # and this reflects the command running but failing
            raise DistutilsExecError, \
                  "command '%s' failed with exit status %d" % (cmd[0], rc) 
开发者ID:glmcdona,项目名称:meddle,代码行数:21,代码来源:spawn.py

示例5: _spawn_os2

# 需要导入模块: from distutils import errors [as 别名]
# 或者: from distutils.errors import DistutilsExecError [as 别名]
def _spawn_os2(cmd, search_path=1, verbose=0, dry_run=0):
    executable = cmd[0]
    if search_path:
        # either we find one or it stays the same
        executable = find_executable(executable) or executable
    log.info(' '.join([executable] + cmd[1:]))
    if not dry_run:
        # spawnv for OS/2 EMX requires a full path to the .exe
        try:
            rc = os.spawnv(os.P_WAIT, executable, cmd)
        except OSError, exc:
            # this seems to happen when the command isn't found
            raise DistutilsExecError, \
                  "command '%s' failed: %s" % (cmd[0], exc[-1])
        if rc != 0:
            # and this reflects the command running but failing
            log.debug("command '%s' failed with exit status %d" % (cmd[0], rc))
            raise DistutilsExecError, \
                  "command '%s' failed with exit status %d" % (cmd[0], rc) 
开发者ID:glmcdona,项目名称:meddle,代码行数:21,代码来源:spawn.py

示例6: _spawn_nt

# 需要导入模块: from distutils import errors [as 别名]
# 或者: from distutils.errors import DistutilsExecError [as 别名]
def _spawn_nt(cmd, search_path=1, verbose=0, dry_run=0):
    executable = cmd[0]
    cmd = _nt_quote_args(cmd)
    if search_path:
        # either we find one or it stays the same
        executable = find_executable(executable) or executable
    log.info(' '.join([executable] + cmd[1:]))
    if not dry_run:
        # spawn for NT requires a full path to the .exe
        try:
            rc = os.spawnv(os.P_WAIT, executable, cmd)
        except OSError, exc:
            # this seems to happen when the command isn't found
            if not DEBUG:
                cmd = executable
            raise DistutilsExecError, \
                  "command %r failed: %s" % (cmd, exc[-1])
        if rc != 0:
            # and this reflects the command running but failing
            if not DEBUG:
                cmd = executable
            raise DistutilsExecError, \
                  "command %r failed with exit status %d" % (cmd, rc) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:25,代码来源:spawn.py

示例7: _spawn_os2

# 需要导入模块: from distutils import errors [as 别名]
# 或者: from distutils.errors import DistutilsExecError [as 别名]
def _spawn_os2(cmd, search_path=1, verbose=0, dry_run=0):
    executable = cmd[0]
    if search_path:
        # either we find one or it stays the same
        executable = find_executable(executable) or executable
    log.info(' '.join([executable] + cmd[1:]))
    if not dry_run:
        # spawnv for OS/2 EMX requires a full path to the .exe
        try:
            rc = os.spawnv(os.P_WAIT, executable, cmd)
        except OSError, exc:
            # this seems to happen when the command isn't found
            if not DEBUG:
                cmd = executable
            raise DistutilsExecError, \
                  "command %r failed: %s" % (cmd, exc[-1])
        if rc != 0:
            # and this reflects the command running but failing
            if not DEBUG:
                cmd = executable
            log.debug("command %r failed with exit status %d" % (cmd, rc))
            raise DistutilsExecError, \
                  "command %r failed with exit status %d" % (cmd, rc) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:25,代码来源:spawn.py

示例8: _compile_cu

# 需要导入模块: from distutils import errors [as 别名]
# 或者: from distutils.errors import DistutilsExecError [as 别名]
def _compile_cu(self, sources, output_dir=None, macros=None,
                    include_dirs=None, debug=0, extra_preargs=None,
                    extra_postargs=None, depends=None):
        # Compile CUDA C files, mainly derived from UnixCCompiler._compile().
        macros, objects, extra_postargs, pp_opts, _build = \
            self._setup_compile(output_dir, macros, include_dirs, sources,
                                depends, extra_postargs)

        compiler_so = CUDA['nvcc']
        cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
        post_args = CUDA['post_args']

        for obj in objects:
            try:
                src, _ = _build[obj]
            except KeyError:
                continue
            try:
                self.spawn([compiler_so] + cc_args + [src, '-o', obj] + post_args)
            except errors.DistutilsExecError as e:
                raise errors.CompileError(str(e))

        return objects 
开发者ID:benfred,项目名称:implicit,代码行数:25,代码来源:cuda_setup.py

示例9: UnixCCompiler__compile

# 需要导入模块: from distutils import errors [as 别名]
# 或者: from distutils.errors import DistutilsExecError [as 别名]
def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
    """Compile a single source files with a Unix-style compiler."""
    # HP ad-hoc fix, see ticket 1383
    ccomp = self.compiler_so
    if ccomp[0] == 'aCC':
        # remove flags that will trigger ANSI-C mode for aCC
        if '-Ae' in ccomp:
            ccomp.remove('-Ae')
        if '-Aa' in ccomp:
            ccomp.remove('-Aa')
        # add flags for (almost) sane C++ handling
        ccomp += ['-AA']
        self.compiler_so = ccomp

    display = '%s: %s' % (os.path.basename(self.compiler_so[0]), src)
    try:
        self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
                   extra_postargs, display = display)
    except DistutilsExecError:
        msg = str(get_exception())
        raise CompileError(msg) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:23,代码来源:unixccompiler.py

示例10: spawn

# 需要导入模块: from distutils import errors [as 别名]
# 或者: from distutils.errors import DistutilsExecError [as 别名]
def spawn(cmd, search_path=1, verbose=0, dry_run=0):
    """Run another program, specified as a command list 'cmd', in a new process.

    'cmd' is just the argument list for the new process, ie.
    cmd[0] is the program to run and cmd[1:] are the rest of its arguments.
    There is no way to run a program with a name different from that of its
    executable.

    If 'search_path' is true (the default), the system's executable
    search path will be used to find the program; otherwise, cmd[0]
    must be the exact path to the executable.  If 'dry_run' is true,
    the command will not actually be run.

    Raise DistutilsExecError if running the program fails in any way; just
    return on success.
    """
    if os.name == 'posix':
        _spawn_posix(cmd, search_path, dry_run=dry_run)
    elif os.name == 'nt':
        _spawn_nt(cmd, search_path, dry_run=dry_run)
    elif os.name == 'os2':
        _spawn_os2(cmd, search_path, dry_run=dry_run)
    else:
        raise DistutilsPlatformError, \
              "don't know how to spawn programs on platform '%s'" % os.name 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:27,代码来源:spawn.py


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