本文整理汇总了Python中numpy.distutils.exec_command.filepath_from_subprocess_output方法的典型用法代码示例。如果您正苦于以下问题:Python exec_command.filepath_from_subprocess_output方法的具体用法?Python exec_command.filepath_from_subprocess_output怎么用?Python exec_command.filepath_from_subprocess_output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类numpy.distutils.exec_command
的用法示例。
在下文中一共展示了exec_command.filepath_from_subprocess_output方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_libgfortran_dir
# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import filepath_from_subprocess_output [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)]
try:
output = subprocess.check_output(
self.compiler_f77 + find_lib_arg)
except (OSError, subprocess.CalledProcessError):
pass
else:
output = filepath_from_subprocess_output(output)
libgfortran_dir = os.path.dirname(output)
return libgfortran_dir
示例2: get_libgcc_dir
# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import filepath_from_subprocess_output [as 别名]
def get_libgcc_dir(self):
try:
output = subprocess.check_output(self.compiler_f77 +
['-print-libgcc-file-name'])
except (OSError, subprocess.CalledProcessError):
pass
else:
output = filepath_from_subprocess_output(output)
return os.path.dirname(output)
return None
示例3: get_target
# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import filepath_from_subprocess_output [as 别名]
def get_target(self):
try:
output = subprocess.check_output(self.compiler_f77 + ['-v'])
except (OSError, subprocess.CalledProcessError):
pass
else:
output = filepath_from_subprocess_output(output)
m = TARGET_R.search(output)
if m:
return m.group(1)
return ""
示例4: _libs_with_msvc_and_fortran
# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import filepath_from_subprocess_output [as 别名]
def _libs_with_msvc_and_fortran(self, fcompiler, c_libraries,
c_library_dirs):
if fcompiler is None:
return
for libname in c_libraries:
if libname.startswith('msvc'):
continue
fileexists = False
for libdir in c_library_dirs or []:
libfile = os.path.join(libdir, '%s.lib' % (libname))
if os.path.isfile(libfile):
fileexists = True
break
if fileexists:
continue
# make g77-compiled static libs available to MSVC
fileexists = False
for libdir in c_library_dirs:
libfile = os.path.join(libdir, 'lib%s.a' % (libname))
if os.path.isfile(libfile):
# copy libname.a file to name.lib so that MSVC linker
# can find it
libfile2 = os.path.join(self.build_temp, libname + '.lib')
copy_file(libfile, libfile2)
if self.build_temp not in c_library_dirs:
c_library_dirs.append(self.build_temp)
fileexists = True
break
if fileexists:
continue
log.warn('could not find library %r in directories %s'
% (libname, c_library_dirs))
# Always use system linker when using MSVC compiler.
f_lib_dirs = []
for dir in fcompiler.library_dirs:
# correct path when compiling in Cygwin but with normal Win
# Python
if dir.startswith('/usr/lib'):
try:
dir = subprocess.check_output(['cygpath', '-w', dir])
except (OSError, subprocess.CalledProcessError):
pass
else:
dir = filepath_from_subprocess_output(dir)
f_lib_dirs.append(dir)
c_library_dirs.extend(f_lib_dirs)
# make g77-compiled static libs available to MSVC
for lib in fcompiler.libraries:
if not lib.startswith('msvc'):
c_libraries.append(lib)
p = combine_paths(f_lib_dirs, 'lib' + lib + '.a')
if p:
dst_name = os.path.join(self.build_temp, lib + '.lib')
if not os.path.isfile(dst_name):
copy_file(p[0], dst_name)
if self.build_temp not in c_library_dirs:
c_library_dirs.append(self.build_temp)
示例5: _link
# 需要导入模块: from numpy.distutils import exec_command [as 别名]
# 或者: from numpy.distutils.exec_command import filepath_from_subprocess_output [as 别名]
def _link (self, body,
headers, include_dirs,
libraries, library_dirs, lang):
if self.compiler.compiler_type=='msvc':
libraries = (libraries or [])[:]
library_dirs = (library_dirs or [])[:]
if lang in ['f77', 'f90']:
lang = 'c' # always use system linker when using MSVC compiler
if self.fcompiler:
for d in self.fcompiler.library_dirs or []:
# correct path when compiling in Cygwin but with
# normal Win Python
if d.startswith('/usr/lib'):
try:
d = subprocess.check_output(['cygpath',
'-w', d])
except (OSError, subprocess.CalledProcessError):
pass
else:
d = filepath_from_subprocess_output(d)
library_dirs.append(d)
for libname in self.fcompiler.libraries or []:
if libname not in libraries:
libraries.append(libname)
for libname in libraries:
if libname.startswith('msvc'): continue
fileexists = False
for libdir in library_dirs or []:
libfile = os.path.join(libdir, '%s.lib' % (libname))
if os.path.isfile(libfile):
fileexists = True
break
if fileexists: continue
# make g77-compiled static libs available to MSVC
fileexists = False
for libdir in library_dirs:
libfile = os.path.join(libdir, 'lib%s.a' % (libname))
if os.path.isfile(libfile):
# copy libname.a file to name.lib so that MSVC linker
# can find it
libfile2 = os.path.join(libdir, '%s.lib' % (libname))
copy_file(libfile, libfile2)
self.temp_files.append(libfile2)
fileexists = True
break
if fileexists: continue
log.warn('could not find library %r in directories %s' \
% (libname, library_dirs))
elif self.compiler.compiler_type == 'mingw32':
generate_manifest(self)
return self._wrap_method(old_config._link, lang,
(body, headers, include_dirs,
libraries, library_dirs, lang))