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


Python exec_command.exec_command方法代码示例

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


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

示例1: test_exec_command_stdout

# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import exec_command [as 别名]
def test_exec_command_stdout():
    # Regression test for gh-2999 and gh-2915.
    # There are several packages (nose, scipy.weave.inline, Sage inline
    # Fortran) that replace stdout, in which case it doesn't have a fileno
    # method.  This is tested here, with a do-nothing command that fails if the
    # presence of fileno() is assumed in exec_command.

    # The code has a special case for posix systems, so if we are on posix test
    # both that the special case works and that the generic code works.

    # Test posix version:
    with redirect_stdout(StringIO()):
        with redirect_stderr(TemporaryFile()):
            exec_command.exec_command("cd '.'")

    if os.name == 'posix':
        # Test general (non-posix) version:
        with emulate_nonposix():
            with redirect_stdout(StringIO()):
                with redirect_stderr(TemporaryFile()):
                    exec_command.exec_command("cd '.'") 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:23,代码来源:test_exec_command.py

示例2: check_basic

# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import exec_command [as 别名]
def check_basic(self, *kws):
        s, o = exec_command.exec_command(
                     '"%s" -c "raise \'Ignore me.\'"' % self.pyexe, **kws)
        assert_(s != 0)
        assert_(o != '')

        s, o = exec_command.exec_command(
             '"%s" -c "import sys;sys.stderr.write(\'0\');'
             'sys.stderr.write(\'1\');sys.stderr.write(\'2\')"' %
             self.pyexe, **kws)
        assert_(s == 0)
        assert_(o == '012')

        s, o = exec_command.exec_command(
                 '"%s" -c "import sys;sys.exit(15)"' % self.pyexe, **kws)
        assert_(s == 15)
        assert_(o == '')

        s, o = exec_command.exec_command(
                     '"%s" -c "print(\'Heipa\'")' % self.pyexe, **kws)
        assert_(s == 0)
        assert_(o == 'Heipa') 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:24,代码来源:test_exec_command.py

示例3: get_libgfortran_dir

# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import exec_command [as 别名]
def get_libgfortran_dir(self):
        if sys.platform[:5] == 'linux':
            libgfortran_name = 'libgfortran.so'
        elif sys.platform == 'darwin':
            libgfortran_name = 'libgfortran.dylib'
        else:
            libgfortran_name = None

        libgfortran_dir = None
        if libgfortran_name:
            find_lib_arg = ['-print-file-name={0}'.format(libgfortran_name)]
            status, output = exec_command(
                self.compiler_f77 + find_lib_arg, use_tee=0)
            if not status:
                libgfortran_dir = os.path.dirname(output)
        return libgfortran_dir 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:18,代码来源:gnu.py

示例4: get_version

# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import exec_command [as 别名]
def get_version(self,*args,**kwds):
        version = FCompiler.get_version(self,*args,**kwds)

        if version is None and sys.platform.startswith('aix'):
            # use lslpp to find out xlf version
            lslpp = find_executable('lslpp')
            xlf = find_executable('xlf')
            if os.path.exists(xlf) and os.path.exists(lslpp):
                s, o = exec_command(lslpp + ' -Lc xlfcmp')
                m = re.search(r'xlfcmp:(?P<version>\d+([.]\d+)+)', o)
                if m: version = m.group('version')

        xlf_dir = '/etc/opt/ibmcmp/xlf'
        if version is None and os.path.isdir(xlf_dir):
            # linux:
            # If the output of xlf does not contain version info
            # (that's the case with xlf 8.1, for instance) then
            # let's try another method:
            l = sorted(os.listdir(xlf_dir))
            l.reverse()
            l = [d for d in l if os.path.isfile(os.path.join(xlf_dir, d, 'xlf.cfg'))]
            if l:
                from distutils.version import LooseVersion
                self.version = version = LooseVersion(l[0])
        return version 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:27,代码来源:ibm.py

示例5: get_version

# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import exec_command [as 别名]
def get_version(self,*args,**kwds):
        version = FCompiler.get_version(self,*args,**kwds)

        if version is None and sys.platform.startswith('aix'):
            # use lslpp to find out xlf version
            lslpp = find_executable('lslpp')
            xlf = find_executable('xlf')
            if os.path.exists(xlf) and os.path.exists(lslpp):
                s, o = exec_command(lslpp + ' -Lc xlfcmp')
                m = re.search('xlfcmp:(?P<version>\d+([.]\d+)+)', o)
                if m: version = m.group('version')

        xlf_dir = '/etc/opt/ibmcmp/xlf'
        if version is None and os.path.isdir(xlf_dir):
            # linux:
            # If the output of xlf does not contain version info
            # (that's the case with xlf 8.1, for instance) then
            # let's try another method:
            l = sorted(os.listdir(xlf_dir))
            l.reverse()
            l = [d for d in l if os.path.isfile(os.path.join(xlf_dir, d, 'xlf.cfg'))]
            if l:
                from distutils.version import LooseVersion
                self.version = version = LooseVersion(l[0])
        return version 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:27,代码来源:ibm.py

示例6: test_exec_command_stderr

# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import exec_command [as 别名]
def test_exec_command_stderr():
    # Test posix version:
    with redirect_stdout(TemporaryFile(mode='w+')):
        with redirect_stderr(StringIO()):
            exec_command.exec_command("cd '.'")

    if os.name == 'posix':
        # Test general (non-posix) version:
        with emulate_nonposix():
            with redirect_stdout(TemporaryFile()):
                with redirect_stderr(StringIO()):
                    exec_command.exec_command("cd '.'") 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:14,代码来源:test_exec_command.py

示例7: check_nt

# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import exec_command [as 别名]
def check_nt(self, **kws):
        s, o = exec_command.exec_command('cmd /C echo path=%path%')
        assert_(s == 0)
        assert_(o != '')

        s, o = exec_command.exec_command(
         '"%s" -c "import sys;sys.stderr.write(sys.platform)"' % self.pyexe)
        assert_(s == 0)
        assert_(o == 'win32') 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:11,代码来源:test_exec_command.py

示例8: CCompiler_spawn

# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import exec_command [as 别名]
def CCompiler_spawn(self, cmd, display=None):
    """
    Execute a command in a sub-process.

    Parameters
    ----------
    cmd : str
        The command to execute.
    display : str or sequence of str, optional
        The text to add to the log file kept by `numpy.distutils`.
        If not given, `display` is equal to `cmd`.

    Returns
    -------
    None

    Raises
    ------
    DistutilsExecError
        If the command failed, i.e. the exit status was not 0.

    """
    if display is None:
        display = cmd
        if is_sequence(display):
            display = ' '.join(list(display))
    log.info(display)
    s, o = exec_command(cmd)
    if s:
        if is_sequence(cmd):
            cmd = ' '.join(list(cmd))
        try:
            print(o)
        except UnicodeError:
            # When installing through pip, `o` can contain non-ascii chars
            pass
        if re.search('Too many open files', o):
            msg = '\nTry rerunning setup command until build succeeds.'
        else:
            msg = ''
        raise DistutilsExecError('Command "%s" failed with exit status %d%s' % (cmd, s, msg)) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:43,代码来源:ccompiler.py

示例9: get_libgcc_dir

# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import exec_command [as 别名]
def get_libgcc_dir(self):
        status, output = exec_command(
            self.compiler_f77 + ['-print-libgcc-file-name'], use_tee=0)
        if not status:
            return os.path.dirname(output)
        return None 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:8,代码来源:gnu.py

示例10: get_target

# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import exec_command [as 别名]
def get_target(self):
        status, output = exec_command(self.compiler_f77 + ['-v'], use_tee=0)
        if not status:
            m = TARGET_R.search(output)
            if m:
                return m.group(1)
        return "" 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:9,代码来源:gnu.py

示例11: get_libgcc_dir

# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import exec_command [as 别名]
def get_libgcc_dir(self):
        status, output = exec_command(self.compiler_f77 +
                                      ['-print-libgcc-file-name'],
                                      use_tee=0)
        if not status:
            return os.path.dirname(output)
        return None 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:9,代码来源:gnu.py

示例12: get_target

# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import exec_command [as 别名]
def get_target(self):
        status, output = exec_command(self.compiler_f77 +
                                      ['-v'],
                                      use_tee=0)
        if not status:
            m = TARGET_R.search(output)
            if m:
                return m.group(1)
        return "" 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:11,代码来源:gnu.py


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