本文整理汇总了Python中numpy.distutils.exec_command.find_executable函数的典型用法代码示例。如果您正苦于以下问题:Python find_executable函数的具体用法?Python find_executable怎么用?Python find_executable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find_executable函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: check_config
def check_config(self, logger):
"""
Perform optional error checks.
Parameters
----------
logger : object
The object that manages logging output.
"""
# check for the command
comp = self._comp
cmd = [c for c in comp.options['command'] if c.strip()]
if not cmd:
logger.error("The command cannot be empty")
else:
program_to_execute = comp.options['command'][0]
if sys.platform == 'win32':
if not find_executable(program_to_execute):
missing = self._check_for_files([program_to_execute])
if missing:
logger.error("The command to be executed, '%s', "
"cannot be found" % program_to_execute)
else:
if not find_executable(program_to_execute):
logger.error("The command to be executed, '%s', "
"cannot be found" % program_to_execute)
# Check for missing input files. This just generates a warning during
# setup, since these files may be generated later during execution.
missing = self._check_for_files(comp.options['external_input_files'])
if missing:
logger.warning("The following input files are missing at setup "
"time: %s" % missing)
开发者ID:johnjasa,项目名称:OpenMDAO,代码行数:34,代码来源:external_code_comp.py
示例2: get_version
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 = os.listdir(xlf_dir)
l.sort()
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:glimmercn,项目名称:numpy,代码行数:26,代码来源:ibm.py
示例3: _execute_local
def _execute_local(self, command):
"""
Run the command.
Parameters
----------
command : List
List containing OS command string.
Returns
-------
int
Return Code
str
Error Message
"""
# Check to make sure command exists
comp = self._comp
if isinstance(command, str):
program_to_execute = command
else:
program_to_execute = command[0]
# Suppress message from find_executable function, we'll handle it
numpy.distutils.log.set_verbosity(-1)
if sys.platform == 'win32':
if not find_executable(program_to_execute):
missing = self._check_for_files([program_to_execute])
if missing:
raise ValueError("The command to be executed, '%s', "
"cannot be found" % program_to_execute)
command_for_shell_proc = ['cmd.exe', '/c'] + command
else:
if not find_executable(program_to_execute):
raise ValueError("The command to be executed, '%s', "
"cannot be found" % program_to_execute)
command_for_shell_proc = command
comp._process = \
ShellProc(command_for_shell_proc, comp.stdin,
comp.stdout, comp.stderr, comp.options['env_vars'])
try:
return_code, error_msg = \
comp._process.wait(comp.options['poll_delay'], comp.options['timeout'])
finally:
comp._process.close_files()
comp._process = None
return (return_code, error_msg)
开发者ID:johnjasa,项目名称:OpenMDAO,代码行数:52,代码来源:external_code_comp.py
示例4: check_setup
def check_setup(self, out_stream=sys.stdout):
"""Write a report to the given stream indicating any potential problems found
with the current configuration of this ``Problem``.
Args
----
out_stream : a file-like object, optional
"""
# check for the command
if not self.options['command']:
out_stream.write( "The command cannot be empty")
else:
if isinstance(self.options['command'], str):
program_to_execute = self.options['command']
else:
program_to_execute = self.options['command'][0]
command_full_path = find_executable( program_to_execute )
if not command_full_path:
msg = "The command to be executed, '%s', cannot be found" % program_to_execute
out_stream.write(msg)
# Check for missing input files
missing_files = self._check_for_files(input=True)
for iotype, path in missing_files:
msg = "The %s file %s is missing" % ( iotype, path )
out_stream.write(msg)
开发者ID:cephdon,项目名称:OpenMDAO,代码行数:28,代码来源:external_code.py
示例5: _execute_local
def _execute_local(self):
""" Run command. """
# check to make sure command exists
if isinstance(self.options['command'], str):
program_to_execute = self.options['command']
else:
program_to_execute = self.options['command'][0]
# suppress message from find_executable function, we'll handle it
numpy.distutils.log.set_verbosity(-1)
command_full_path = find_executable( program_to_execute )
if not command_full_path:
raise ValueError("The command to be executed, '%s', cannot be found" % program_to_execute)
command_for_shell_proc = self.options['command']
if sys.platform == 'win32':
command_for_shell_proc = ['cmd.exe', '/c' ] + command_for_shell_proc
self._process = \
ShellProc(command_for_shell_proc, self.stdin,
self.stdout, self.stderr, self.options['env_vars'])
try:
return_code, error_msg = \
self._process.wait(self.options['poll_delay'], self.options['timeout'])
finally:
self._process.close_files()
self._process = None
return (return_code, error_msg)
开发者ID:Satadru-Roy,项目名称:OpenMDAO,代码行数:32,代码来源:external_code.py
示例6: check_setup
def check_setup(self, out_stream=sys.stdout):
"""Write a report to the given stream indicating any potential problems found
with the current configuration of this ``Problem``.
Args
----
out_stream : a file-like object, optional
"""
# check for the command
cmd = [c for c in self.options['command'] if c.strip()]
if not cmd:
out_stream.write( "The command cannot be empty")
else:
program_to_execute = self.options['command'][0]
command_full_path = find_executable( program_to_execute )
if not command_full_path:
out_stream.write("The command to be executed, '%s', "
"cannot be found" % program_to_execute)
# Check for missing input files
missing = self._check_for_files(self.options['external_input_files'])
if missing:
out_stream.write("The following input files are missing at setup "
" time: %s" % missing)
开发者ID:Satadru-Roy,项目名称:OpenMDAO,代码行数:26,代码来源:external_code.py
示例7: find_executables
def find_executables(self):
for fc_exe in [find_executable(c) for c in ['gfortran','f95']]:
if os.path.isfile(fc_exe):
break
for key in ['version_cmd', 'compiler_f77', 'compiler_f90',
'compiler_fix', 'linker_so', 'linker_exe']:
self.executables[key][0] = fc_exe
开发者ID:radical-software,项目名称:radicalspam,代码行数:7,代码来源:gnu.py
示例8: build_libraries
def build_libraries(self, libraries):
if parse_version(numpy.__version__) < parse_version('1.7'):
fcompiler = self.fcompiler
else:
fcompiler = self._f_compiler
if isinstance(fcompiler,
numpy.distutils.fcompiler.gnu.Gnu95FCompiler):
old_value = numpy.distutils.log.set_verbosity(-2)
exe = find_executable('gcc-ar')
if exe is None:
exe = find_executable('ar')
numpy.distutils.log.set_verbosity(old_value)
self.compiler.archiver[0] = exe
flags = F77_COMPILE_ARGS_GFORTRAN + F77_COMPILE_OPT_GFORTRAN
if self.debug:
flags += F77_COMPILE_DEBUG_GFORTRAN
if F77_OPENMP:
flags += ['-openmp']
fcompiler.executables['compiler_f77'] += flags
flags = F90_COMPILE_ARGS_GFORTRAN + F90_COMPILE_OPT_GFORTRAN
if self.debug:
flags += F90_COMPILE_DEBUG_GFORTRAN
if F90_OPENMP:
flags += ['-openmp']
fcompiler.executables['compiler_f90'] += flags
fcompiler.libraries += [LIBRARY_OPENMP_GFORTRAN]
elif isinstance(fcompiler,
numpy.distutils.fcompiler.intel.IntelFCompiler):
old_value = numpy.distutils.log.set_verbosity(-2)
self.compiler.archiver[0] = find_executable('xiar')
numpy.distutils.log.set_verbosity(old_value)
flags = F77_COMPILE_ARGS_IFORT + F77_COMPILE_OPT_IFORT
if self.debug:
flags += F77_COMPILE_DEBUG_IFORT
if F77_OPENMP:
flags += ['-openmp']
fcompiler.executables['compiler_f77'] += flags
flags = F90_COMPILE_ARGS_IFORT + F90_COMPILE_OPT_IFORT
if self.debug:
flags += F90_COMPILE_DEBUG_IFORT
if F90_OPENMP:
flags += ['-openmp']
fcompiler.executables['compiler_f90'] += flags
fcompiler.libraries += [LIBRARY_OPENMP_IFORT]
else:
raise RuntimeError("Unhandled compiler: '{}'.".format(fcompiler))
build_clib.build_libraries(self, libraries)
开发者ID:pchanial,项目名称:setuphooks,代码行数:47,代码来源:hooks.py
示例9: get_cxx_tool_path
def get_cxx_tool_path(compiler):
"""Given a distutils.ccompiler.CCompiler class, returns the path of the
toolset related to C compilation."""
fullpath_exec = find_executable(get_cxxcompiler_executable(compiler))
if fullpath_exec:
fullpath = pdirname(fullpath_exec)
else:
raise DistutilsSetupError("Could not find compiler executable info for scons")
return fullpath
开发者ID:illume,项目名称:numpy3k,代码行数:9,代码来源:scons.py
示例10: finalize_options
def finalize_options(self):
build.finalize_options(self)
self.help2man = find_executable('help2man')
if not self.help2man:
raise DistutilsSetupError('Building man pages requires help2man.')
开发者ID:marcopovitch,项目名称:obspy,代码行数:5,代码来源:setup.py
示例11: cached_find_executable
def cached_find_executable(exe):
if exe in exe_cache:
return exe_cache[exe]
fc_exe = find_executable(exe)
exe_cache[exe] = exe_cache[fc_exe] = fc_exe
return fc_exe
开发者ID:blitzmann,项目名称:Pyfa-skel,代码行数:6,代码来源:__init__.py
注:本文中的numpy.distutils.exec_command.find_executable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论