本文整理汇总了Python中numpy.distutils.log.warn函数的典型用法代码示例。如果您正苦于以下问题:Python warn函数的具体用法?Python warn怎么用?Python warn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _find_existing_fcompiler
def _find_existing_fcompiler(compiler_types, osname=None, platform=None, requiref90=False, c_compiler=None):
from numpy.distutils.core import get_distribution
dist = get_distribution(always=True)
for compiler_type in compiler_types:
v = None
try:
c = new_fcompiler(plat=platform, compiler=compiler_type, c_compiler=c_compiler)
c.customize(dist)
v = c.get_version()
if requiref90 and c.compiler_f90 is None:
v = None
new_compiler = c.suggested_f90_compiler
if new_compiler:
log.warn(
"Trying %r compiler as suggested by %r "
"compiler for f90 support." % (compiler_type, new_compiler)
)
c = new_fcompiler(plat=platform, compiler=new_compiler, c_compiler=c_compiler)
c.customize(dist)
v = c.get_version()
if v is not None:
compiler_type = new_compiler
if requiref90 and c.compiler_f90 is None:
raise ValueError("%s does not support compiling f90 codes, " "skipping." % (c.__class__.__name__))
except DistutilsModuleError:
log.debug("_find_existing_fcompiler: compiler_type='%s' raised DistutilsModuleError", compiler_type)
except CompilerNotFound:
log.debug("_find_existing_fcompiler: compiler_type='%s' not found", compiler_type)
if v is not None:
return compiler_type
return None
开发者ID:hitej,项目名称:meta-core,代码行数:32,代码来源:__init__.py
示例2: CCompiler_get_version
def CCompiler_get_version(self, force=0, ok_status=[0]):
""" Compiler version. Returns None if compiler is not available. """
if not force and hasattr(self,'version'):
return self.version
try:
version_cmd = self.version_cmd
except AttributeError:
return None
cmd = ' '.join(version_cmd)
try:
matcher = self.version_match
except AttributeError:
try:
pat = self.version_pattern
except AttributeError:
return None
def matcher(version_string):
m = re.match(pat, version_string)
if not m:
return None
version = m.group('version')
return version
status, output = exec_command(cmd,use_tee=0)
version = None
if status in ok_status:
version = matcher(output)
if not version:
log.warn("Couldn't match compiler version for %r" % (output,))
else:
version = LooseVersion(version)
self.version = version
return version
开发者ID:jackygrahamez,项目名称:DrugDiscovery-Home,代码行数:33,代码来源:ccompiler.py
示例3: CCompiler_customize
def CCompiler_customize(self, dist, need_cxx=0):
"""
Do any platform-specific customization of a compiler instance.
This method calls `distutils.sysconfig.customize_compiler` for
platform-specific customization, as well as optionally remove a flag
to suppress spurious warnings in case C++ code is being compiled.
Parameters
----------
dist : object
This parameter is not used for anything.
need_cxx : bool, optional
Whether or not C++ has to be compiled. If so (True), the
``"-Wstrict-prototypes"`` option is removed to prevent spurious
warnings. Default is False.
Returns
-------
None
Notes
-----
All the default options used by distutils can be extracted with::
from distutils import sysconfig
sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'BASECFLAGS',
'CCSHARED', 'LDSHARED', 'SO')
"""
# See FCompiler.customize for suggested usage.
log.info('customize %s' % (self.__class__.__name__))
customize_compiler(self)
if need_cxx:
# In general, distutils uses -Wstrict-prototypes, but this option is
# not valid for C++ code, only for C. Remove it if it's there to
# avoid a spurious warning on every compilation. All the default
# options used by distutils can be extracted with:
# from distutils import sysconfig
# sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'BASECFLAGS',
# 'CCSHARED', 'LDSHARED', 'SO')
try:
self.compiler_so.remove('-Wstrict-prototypes')
except (AttributeError, ValueError):
pass
if hasattr(self,'compiler') and 'cc' in self.compiler[0]:
if not self.compiler_cxx:
if self.compiler[0].startswith('gcc'):
a, b = 'gcc', 'g++'
else:
a, b = 'cc', 'c++'
self.compiler_cxx = [self.compiler[0].replace(a,b)]\
+ self.compiler[1:]
else:
if hasattr(self,'compiler'):
log.warn("#### %s #######" % (self.compiler,))
log.warn('Missing compiler_cxx fix for '+self.__class__.__name__)
return
开发者ID:plaes,项目名称:numpy,代码行数:60,代码来源:ccompiler.py
示例4: finalize_options
def finalize_options(self):
log.info("unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options")
build_clib = self.get_finalized_command("build_clib")
build_ext = self.get_finalized_command("build_ext")
config = self.get_finalized_command("config")
build = self.get_finalized_command("build")
cmd_list = [self, config, build_clib, build_ext, build]
for a in ["fcompiler"]:
l = []
for c in cmd_list:
v = getattr(c, a)
if v is not None:
if not isinstance(v, str):
v = v.compiler_type
if v not in l:
l.append(v)
if not l:
v1 = None
else:
v1 = l[0]
if len(l) > 1:
log.warn(" commands have different --%s options: %s" ", using first in list as default" % (a, l))
if v1:
for c in cmd_list:
if getattr(c, a) is None:
setattr(c, a, v1)
开发者ID:beiko-lab,项目名称:gengis,代码行数:26,代码来源:config_compiler.py
示例5: generate_a_cython_source
def generate_a_cython_source(self, base, ext_name, source, extension):
if self.inplace or not have_cython():
target_dir = os.path.dirname(base)
else:
target_dir = appendpath(self.build_src, os.path.dirname(base))
target_file = os.path.join(target_dir, ext_name + '.c')
depends = [source] + extension.depends
if self.force or newer_group(depends, target_file, 'newer'):
if have_cython():
import Cython.Compiler.Main
log.info("cythonc:> %s: %s " % (target_dir, target_file))
log.info("cwd %s " % (os.getcwd()))
self.mkpath(target_dir)
options = Cython.Compiler.Main.CompilationOptions(
defaults=Cython.Compiler.Main.default_options,
include_path=extension.include_dirs,
output_file=target_file
)
#log.info('\n'.join([s + ' ' + str(getattr(options, s)) for s in dir(options)]))
# avoid calling compile_single, because it will give wrong module names.
cython_result = Cython.Compiler.Main.compile([source],
options=options)
if cython_result.num_errors != 0:
raise DistutilsError("%d errors while compiling %r with Cython" \
% (cython_result.num_errors, source))
elif os.path.isfile(target_file):
log.warn("Cython required for compiling %r but not available,"\
" using old target %r"\
% (source, target_file))
else:
raise DistutilsError("Cython required for compiling %r"\
" but notavailable" % (source,))
return target_file
开发者ID:rainwoodman,项目名称:gaepsi,代码行数:33,代码来源:monkey.py
示例6: _find_existing_fcompiler
def _find_existing_fcompiler(compilers, osname=None, platform=None, requiref90=None):
for compiler in compilers:
v = None
try:
c = new_fcompiler(plat=platform, compiler=compiler)
c.customize()
v = c.get_version()
if requiref90 and c.compiler_f90 is None:
v = None
new_compiler = c.suggested_f90_compiler
if new_compiler:
log.warn('Trying %r compiler as suggested by %r compiler for f90 support.' % (compiler, new_compiler))
c = new_fcompiler(plat=platform, compiler=new_compiler)
c.customize()
v = c.get_version()
if v is not None:
compiler = new_compiler
if requiref90 and c.compiler_f90 is None:
raise ValueError,'%s does not support compiling f90 codes, skipping.' \
% (c.__class__.__name__)
except DistutilsModuleError:
pass
except Exception, msg:
log.warn(msg)
if v is not None:
return compiler
开发者ID:radical-software,项目名称:radicalspam,代码行数:26,代码来源:__init__.py
示例7: new_fcompiler
def new_fcompiler(plat=None,
compiler=None,
verbose=0,
dry_run=0,
force=0,
requiref90=False,
c_compiler = None):
"""Generate an instance of some FCompiler subclass for the supplied
platform/compiler combination.
"""
load_all_fcompiler_classes()
if plat is None:
plat = os.name
if compiler is None:
compiler = get_default_fcompiler(plat, requiref90=requiref90,
c_compiler=c_compiler)
if compiler in fcompiler_class:
module_name, klass, long_description = fcompiler_class[compiler]
elif compiler in fcompiler_aliases:
module_name, klass, long_description = fcompiler_aliases[compiler]
else:
msg = "don't know how to compile Fortran code on platform '%s'" % plat
if compiler is not None:
msg = msg + " with '%s' compiler." % compiler
msg = msg + " Supported compilers are: %s)" \
% (','.join(fcompiler_class.keys()))
log.warn(msg)
return None
compiler = klass(verbose=verbose, dry_run=dry_run, force=force)
compiler.c_compiler = c_compiler
return compiler
开发者ID:mre,项目名称:DrawRoom,代码行数:32,代码来源:__init__.py
示例8: generate_a_pyrex_source
def generate_a_pyrex_source(self, base, ext_name, source, extension):
if self.inplace or not have_pyrex():
target_dir = os.path.dirname(base)
else:
target_dir = appendpath(self.build_src, os.path.dirname(base))
target_file = os.path.join(target_dir, ext_name + ".c")
depends = [source] + extension.depends
if self.force or newer_group(depends, target_file, "newer"):
if have_pyrex():
import Pyrex.Compiler.Main
log.info("pyrexc:> %s" % (target_file))
self.mkpath(target_dir)
options = Pyrex.Compiler.Main.CompilationOptions(
defaults=Pyrex.Compiler.Main.default_options,
include_path=extension.include_dirs,
output_file=target_file,
)
pyrex_result = Pyrex.Compiler.Main.compile(source, options=options)
if pyrex_result.num_errors != 0:
raise DistutilsError("%d errors while compiling %r with Pyrex" % (pyrex_result.num_errors, source))
elif os.path.isfile(target_file):
log.warn(
"Pyrex required for compiling %r but not available," " using old target %r" % (source, target_file)
)
else:
raise DistutilsError("Pyrex required for compiling %r" " but notavailable" % (source,))
return target_file
开发者ID:themiwi,项目名称:numpy,代码行数:28,代码来源:build_src.py
示例9: generate_def
def generate_def(dll, dfile):
"""Given a dll file location, get all its exported symbols and dump them
into the given def file.
The .def file will be overwritten"""
dump = dump_table(dll)
for i in range(len(dump)):
if _START.match(dump[i].decode()):
break
else:
raise ValueError("Symbol table not found")
syms = []
for j in range(i+1, len(dump)):
m = _TABLE.match(dump[j].decode())
if m:
syms.append((int(m.group(1).strip()), m.group(2)))
else:
break
if len(syms) == 0:
log.warn('No symbols found in %s' % dll)
d = open(dfile, 'w')
d.write('LIBRARY %s\n' % os.path.basename(dll))
d.write(';CODE PRELOAD MOVEABLE DISCARDABLE\n')
d.write(';DATA PRELOAD SINGLE\n')
d.write('\nEXPORTS\n')
for s in syms:
#d.write('@%d %s\n' % (s[0], s[1]))
d.write('%s\n' % s[1])
d.close()
开发者ID:8ballbb,项目名称:ProjectRothar,代码行数:32,代码来源:mingw32ccompiler.py
示例10: _build_import_library_x86
def _build_import_library_x86():
""" Build the import libraries for Mingw32-gcc on Windows
"""
lib_name = "python%d%d.lib" % tuple(sys.version_info[:2])
lib_file = os.path.join(sys.prefix, 'libs', lib_name)
out_name = "libpython%d%d.a" % tuple(sys.version_info[:2])
out_file = os.path.join(sys.prefix, 'libs', out_name)
if not os.path.isfile(lib_file):
log.warn('Cannot build import library: "%s" not found' % (lib_file))
return
if os.path.isfile(out_file):
log.debug('Skip building import library: "%s" exists' % (out_file))
return
log.info('Building import library (ARCH=x86): "%s"' % (out_file))
from numpy.distutils import lib2def
def_name = "python%d%d.def" % tuple(sys.version_info[:2])
def_file = os.path.join(sys.prefix, 'libs', def_name)
nm_cmd = '%s %s' % (lib2def.DEFAULT_NM, lib_file)
nm_output = lib2def.getnm(nm_cmd)
dlist, flist = lib2def.parse_nm(nm_output)
lib2def.output_def(dlist, flist, lib2def.DEF_HEADER, open(def_file, 'w'))
dll_name = "python%d%d.dll" % tuple(sys.version_info[:2])
args = (dll_name, def_file, out_file)
cmd = 'dlltool --dllname %s --def %s --output-lib %s' % args
status = os.system(cmd)
# for now, fail silently
if status:
log.warn('Failed to build import library for gcc. Linking will fail.')
return
开发者ID:8ballbb,项目名称:ProjectRothar,代码行数:32,代码来源:mingw32ccompiler.py
示例11: package_check
def package_check(pkg_name, version=None,
optional=False,
checker=LooseVersion,
version_getter=None,
):
''' Check if package `pkg_name` is present, and correct version
Parameters
----------
pkg_name : str
name of package as imported into python
version : {None, str}, optional
minimum version of the package that we require. If None, we don't
check the version. Default is None
optional : {False, True}, optional
If False, raise error for absent package or wrong version;
otherwise warn
checker : callable, optional
callable with which to return comparable thing from version
string. Default is ``distutils.version.LooseVersion``
version_getter : {None, callable}:
Callable that takes `pkg_name` as argument, and returns the
package version string - as in::
``version = version_getter(pkg_name)``
If None, equivalent to::
mod = __import__(pkg_name); version = mod.__version__``
'''
if version_getter is None:
def version_getter(pkg_name):
mod = __import__(pkg_name)
return mod.__version__
try:
mod = __import__(pkg_name)
except ImportError:
if not optional:
raise RuntimeError('Cannot import package "%s" '
'- is it installed?' % pkg_name)
log.warn('Missing optional package "%s"; '
'you may get run-time errors' % pkg_name)
return
if not version:
return
try:
have_version = version_getter(pkg_name)
except AttributeError:
raise RuntimeError('Cannot find version for %s' % pkg_name)
if checker(have_version) < checker(version):
v_msg = 'You have version %s of package "%s"' \
' but we need version >= %s' % (
have_version,
pkg_name,
version,
)
if optional:
log.warn(v_msg + '; you may get run-time errors')
else:
raise RuntimeError(v_msg)
开发者ID:151706061,项目名称:connectomeviewer,代码行数:60,代码来源:build_helpers.py
示例12: _libs_with_msvc_and_fortran
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)
开发者ID:anntzer,项目名称:numpy,代码行数:60,代码来源:build_ext.py
示例13: CCompiler_customize
def CCompiler_customize(self, dist, need_cxx=0):
# See FCompiler.customize for suggested usage.
log.info('customize %s' % (self.__class__.__name__))
customize_compiler(self)
if need_cxx:
# In general, distutils uses -Wstrict-prototypes, but this option is
# not valid for C++ code, only for C. Remove it if it's there to
# avoid a spurious warning on every compilation. All the default
# options used by distutils can be extracted with:
# from distutils import sysconfig
# sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'BASECFLAGS',
# 'CCSHARED', 'LDSHARED', 'SO')
print "compiler options1:", self.compiler_so
try:
self.compiler_so.remove('-Wstrict-prototypes')
except (AttributeError, ValueError):
pass
print "compiler options2:", self.compiler_so
if hasattr(self,'compiler') and self.compiler[0].find('cc')>=0:
if not self.compiler_cxx:
if self.compiler[0].startswith('gcc'):
a, b = 'gcc', 'g++'
else:
a, b = 'cc', 'c++'
self.compiler_cxx = [self.compiler[0].replace(a,b)]\
+ self.compiler[1:]
else:
if hasattr(self,'compiler'):
log.warn("#### %s #######" % (self.compiler,))
log.warn('Missing compiler_cxx fix for '+self.__class__.__name__)
return
开发者ID:jackygrahamez,项目名称:DrugDiscovery-Home,代码行数:32,代码来源:ccompiler.py
示例14: build_msvcr_library
def build_msvcr_library(debug=False):
if os.name != 'nt':
return False
# If the version number is None, then we couldn't find the MSVC runtime at
# all, because we are running on a Python distribution which is customed
# compiled; trust that the compiler is the same as the one available to us
# now, and that it is capable of linking with the correct runtime without
# any extra options.
msvcr_ver = msvc_runtime_major()
if msvcr_ver is None:
log.debug('Skip building import library: '
'Runtime is not compiled with MSVC')
return False
# Skip using a custom library for versions < MSVC 8.0
if msvcr_ver < 80:
log.debug('Skip building msvcr library:'
' custom functionality not present')
return False
msvcr_name = msvc_runtime_library()
if debug:
msvcr_name += 'd'
# Skip if custom library already exists
out_name = "lib%s.a" % msvcr_name
out_file = os.path.join(sys.prefix, 'libs', out_name)
if os.path.isfile(out_file):
log.debug('Skip building msvcr library: "%s" exists' %
(out_file,))
return True
# Find the msvcr dll
msvcr_dll_name = msvcr_name + '.dll'
dll_file = find_dll(msvcr_dll_name)
if not dll_file:
log.warn('Cannot build msvcr library: "%s" not found' %
msvcr_dll_name)
return False
def_name = "lib%s.def" % msvcr_name
def_file = os.path.join(sys.prefix, 'libs', def_name)
log.info('Building msvcr library: "%s" (from %s)' \
% (out_file, dll_file))
# Generate a symbol definition file from the msvcr dll
generate_def(dll_file, def_file)
# Create a custom mingw library for the given symbol definitions
cmd = ['dlltool', '-d', def_file, '-l', out_file]
retcode = subprocess.call(cmd)
# Clean up symbol definitions
os.remove(def_file)
return (not retcode)
开发者ID:giraffegzy,项目名称:flaskdemo01,代码行数:58,代码来源:mingw32ccompiler.py
示例15: _libs_with_msvc_and_fortran
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"):
s, o = exec_command(["cygpath", "-w", dir], use_tee=False)
if not s:
dir = o
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)
开发者ID:beiko-lab,项目名称:gengis,代码行数:55,代码来源:build_ext.py
示例16: _exec_command_posix
def _exec_command_posix( command,
use_shell = None,
use_tee = None,
**env ):
log.debug('_exec_command_posix(...)')
if is_sequence(command):
command_str = ' '.join(list(command))
else:
command_str = command
tmpfile = temp_file_name()
stsfile = None
if use_tee:
stsfile = temp_file_name()
filter = ''
if use_tee == 2:
filter = r'| tr -cd "\n" | tr "\n" "."; echo'
command_posix = '( %s ; echo $? > %s ) 2>&1 | tee %s %s'\
% (command_str, stsfile, tmpfile, filter)
else:
stsfile = temp_file_name()
command_posix = '( %s ; echo $? > %s ) > %s 2>&1'\
% (command_str, stsfile, tmpfile)
#command_posix = '( %s ) > %s 2>&1' % (command_str,tmpfile)
log.debug('Running os.system(%r)' % (command_posix))
status = os.system(command_posix)
if use_tee:
if status:
# if command_tee fails then fall back to robust exec_command
log.warn('_exec_command_posix failed (status=%s)' % status)
return _exec_command(command, use_shell=use_shell, **env)
if stsfile is not None:
f = open_latin1(stsfile, 'r')
status_text = f.read()
status = int(status_text)
f.close()
os.remove(stsfile)
f = open_latin1(tmpfile, 'r')
text = f.read()
f.close()
os.remove(tmpfile)
if text[-1:]=='\n':
text = text[:-1]
return status, text
开发者ID:dimasad,项目名称:numpy,代码行数:51,代码来源:exec_command.py
示例17: build_msvcr_library
def build_msvcr_library(debug=False):
if os.name != 'nt':
return False
msvcr_name = msvc_runtime_library()
# Skip using a custom library for versions < MSVC 8.0
msvcr_ver = msvc_runtime_major()
if msvcr_ver and msvcr_ver < 80:
log.debug('Skip building msvcr library:'
' custom functionality not present')
return False
if debug:
msvcr_name += 'd'
# Skip if custom library already exists
out_name = "lib%s.a" % msvcr_name
out_file = os.path.join(sys.prefix, 'libs', out_name)
if os.path.isfile(out_file):
log.debug('Skip building msvcr library: "%s" exists' %
(out_file,))
return True
# Find the msvcr dll
msvcr_dll_name = msvcr_name + '.dll'
dll_file = find_dll(msvcr_dll_name)
if not dll_file:
log.warn('Cannot build msvcr library: "%s" not found' %
msvcr_dll_name)
return False
def_name = "lib%s.def" % msvcr_name
def_file = os.path.join(sys.prefix, 'libs', def_name)
log.info('Building msvcr library: "%s" (from %s)' \
% (out_file, dll_file))
# Generate a symbol definition file from the msvcr dll
generate_def(dll_file, def_file)
# Create a custom mingw library for the given symbol definitions
cmd = ['dlltool', '-d', def_file, '-l', out_file]
retcode = subprocess.call(cmd)
# Clean up symbol definitions
os.remove(def_file)
return (not retcode)
开发者ID:rlamy,项目名称:numpy,代码行数:49,代码来源:mingw32ccompiler.py
示例18: generate_a_script
def generate_a_script(build_dir, script=script, config=config):
dist = config.get_distribution()
install_lib = dist.get_command_obj('install_lib')
if not install_lib.finalized:
install_lib.finalize_options()
script_replace_text = ''
install_lib = install_lib.install_dir
if install_lib is not None:
script_replace_text = '''
import sys
if %(d)r not in sys.path:
sys.path.insert(0, %(d)r)
''' % dict(d=install_lib)
if multiprocessing is not None:
mp_install_lib = dirname(dirname(multiprocessing.__file__))
script_replace_text += '''
if %(d)r not in sys.path:
sys.path.insert(0, %(d)r)
''' % dict(d=mp_install_lib)
start_mark = '### START UPDATE SYS.PATH ###'
end_mark = '### END UPDATE SYS.PATH ###'
name = basename(script)
if name.startswith (script_prefix):
target_name = name
elif wininst:
target_name = script_prefix + '_' + name
else:
target_name = script_prefix + '.' + splitext(name)[0]
target = join(build_dir, target_name)
if newer(script, target) or 1:
log.info('Creating %r', target)
f = open (script, 'r')
text = f.read()
f.close()
i = text.find(start_mark)
if i != -1:
j = text.find (end_mark)
if j == -1:
log.warn ("%r missing %r line", script, start_mark)
new_text = text[:i+len (start_mark)] + script_replace_text + text[j:]
else:
new_text = text
f = open(target, 'w')
f.write(new_text)
f.close()
开发者ID:18padx08,项目名称:pylibnidaqmx,代码行数:49,代码来源:setup.py
示例19: find_executable
def find_executable(exe, path=None, _cache={}):
"""Return full path of a executable or None.
Symbolic links are not followed.
"""
key = exe, path
try:
return _cache[key]
except KeyError:
pass
log.debug("find_executable(%r)" % exe)
orig_exe = exe
if path is None:
path = os.environ.get("PATH", os.defpath)
if os.name == "posix":
realpath = os.path.realpath
else:
realpath = lambda a: a
if exe.startswith('"'):
exe = exe[1:-1]
suffixes = [""]
if os.name in ["nt", "dos", "os2"]:
fn, ext = os.path.splitext(exe)
extra_suffixes = [".exe", ".com", ".bat"]
if ext.lower() not in extra_suffixes:
suffixes = extra_suffixes
if os.path.isabs(exe):
paths = [""]
else:
paths = [os.path.abspath(p) for p in path.split(os.pathsep)]
for path in paths:
fn = os.path.join(path, exe)
for s in suffixes:
f_ext = fn + s
if not os.path.islink(f_ext):
f_ext = realpath(f_ext)
if os.path.isfile(f_ext) and os.access(f_ext, os.X_OK):
log.good("Found executable %s" % f_ext)
_cache[key] = f_ext
return f_ext
log.warn("Could not locate executable %s" % orig_exe)
return None
开发者ID:rlamy,项目名称:numpy,代码行数:48,代码来源:exec_command.py
示例20: find_executable
def find_executable(exe, path=None, _cache={}):
"""Return full path of a executable or None.
Symbolic links are not followed.
"""
key = exe, path
try:
return _cache[key]
except KeyError:
pass
log.debug('find_executable(%r)' % exe)
orig_exe = exe
if path is None:
path = os.environ.get('PATH', os.defpath)
if os.name=='posix':
realpath = os.path.realpath
else:
realpath = lambda a:a
if exe.startswith('"'):
exe = exe[1:-1]
suffixes = ['']
if os.name in ['nt', 'dos', 'os2']:
fn, ext = os.path.splitext(exe)
extra_suffixes = ['.exe', '.com', '.bat']
if ext.lower() not in extra_suffixes:
suffixes = extra_suffixes
if os.path.isabs(exe):
paths = ['']
else:
paths = [ os.path.abspath(p) for p in path.split(os.pathsep) ]
for path in paths:
fn = os.path.join(path, exe)
for s in suffixes:
f_ext = fn+s
if not os.path.islink(f_ext):
f_ext = realpath(f_ext)
if os.path.isfile(f_ext) and os.access(f_ext, os.X_OK):
log.info('Found executable %s' % f_ext)
_cache[key] = f_ext
return f_ext
log.warn('Could not locate executable %s' % orig_exe)
return None
开发者ID:dimasad,项目名称:numpy,代码行数:48,代码来源:exec_command.py
注:本文中的numpy.distutils.log.warn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论