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


Python Utils.listdir方法代码示例

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


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

示例1: load_envs

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
	def load_envs(self):
		"""
		The configuration command creates files of the form ``build/c4che/NAMEcache.py``. This method
		creates a :py:class:`waflib.ConfigSet.ConfigSet` instance for each ``NAME`` by reading those
		files. The config sets are then stored in the dict :py:attr:`waflib.Build.BuildContext.allenvs`.
		"""
		try:
			lst = Utils.listdir(self.cache_dir)
		except OSError as e:
			if e.errno == errno.ENOENT:
				raise Errors.WafError('The project was not configured: run "waf configure" first!')
			else:
				raise

		if not lst:
			raise Errors.WafError('The cache directory is empty: reconfigure the project')

		for fname in lst:
			if fname.endswith(CACHE_SUFFIX):
				env = ConfigSet.ConfigSet(os.path.join(self.cache_dir, fname))
				name = fname[:-len(CACHE_SUFFIX)]
				self.all_envs[name] = env

				for f in env[CFG_FILES]:
					newnode = self.root.find_resource(f)
					try:
						h = Utils.h_file(newnode.abspath())
					except (IOError, AttributeError):
						Logs.error('cannot find %r' % f)
						h = Utils.SIG_NIL
					newnode.sig = h
开发者ID:SjB,项目名称:waf,代码行数:33,代码来源:Build.py

示例2: set_qt5_libs_to_check

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
def set_qt5_libs_to_check(self):
	self.qt5_vars = Utils.to_list(getattr(self, 'qt5_vars', []))
	if not self.qt5_vars:
		dirlst = Utils.listdir(self.env.QTLIBS)

		pat = self.env.cxxshlib_PATTERN
		if Utils.is_win32:
			pat = pat.replace('.dll', '.lib')
		if self.environ.get('QT5_FORCE_STATIC'):
			pat = self.env.cxxstlib_PATTERN
		if Utils.unversioned_sys_platform() == 'darwin':
			pat = "%s\.framework"
		re_qt = re.compile(pat%'Qt5?(?P<name>.*)'+'$')
		for x in dirlst:
			m = re_qt.match(x)
			if m:
				self.qt5_vars.append("Qt5%s" % m.group('name'))
		if not self.qt5_vars:
			self.fatal('cannot find any Qt5 library (%r)' % self.env.QTLIBS)

	qtextralibs = getattr(Options.options, 'qtextralibs', None)
	if qtextralibs:
		self.qt5_vars.extend(qtextralibs.split(','))

	if not hasattr(self, 'qt5_vars_debug'):
		self.qt5_vars_debug = [a + '_DEBUG' for a in self.qt5_vars]
	self.qt5_vars_debug = Utils.to_list(self.qt5_vars_debug)
开发者ID:JodyGoldberg,项目名称:waf,代码行数:29,代码来源:qt5.py

示例3: load_envs

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
	def load_envs(self):
		"""load the data from the project directory into self.allenvs"""
		try:
			lst = Utils.listdir(self.cache_dir)
		except OSError as e:
			if e.errno == errno.ENOENT:
				raise Errors.WafError('The project was not configured: run "waf configure" first!')
			else:
				raise

		if not lst:
			raise Errors.WafError('The cache directory is empty: reconfigure the project')

		for fname in lst:
			if fname.endswith(CACHE_SUFFIX):
				env = ConfigSet.ConfigSet(os.path.join(self.cache_dir, fname))
				name = fname[:-len(CACHE_SUFFIX)]
				self.all_envs[name] = env

				for f in env[CFG_FILES]:
					newnode = self.path.find_or_declare(f)
					try:
						h = Utils.h_file(newnode.abspath())
					except (IOError, AttributeError):
						Logs.error('cannot find %r' % f)
						h = Utils.SIG_NIL
					newnode.sig = h
开发者ID:zsx,项目名称:waf,代码行数:29,代码来源:Build.py

示例4: load_envs

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
 def load_envs(self):
     try:
         lst = Utils.listdir(self.cache_dir)
     except OSError, e:
         if e.errno == errno.ENOENT:
             raise Errors.WafError('The project was not configured: run "waf configure" first!')
         else:
             raise
开发者ID:asivakum,项目名称:EE563Project,代码行数:10,代码来源:Build.py

示例5: listdir

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
	def listdir(self):
		"""
		Lists the folder contents

		:returns: list of file/folder names ordered alphabetically
		:rtype: list of string
		"""
		lst = Utils.listdir(self.abspath())
		lst.sort()
		return lst
开发者ID:Tiksagol,项目名称:waf,代码行数:12,代码来源:Node.py

示例6: update

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
def update(ctx):
	lst=Options.options.files.split(',')
	if not lst:
		lst=[x for x in Utils.listdir(Context.waf_dir+'/waflib/extras')if x.endswith('.py')]
	for x in lst:
		tool=x.replace('.py','')
		try:
			Configure.download_tool(tool,force=True,ctx=ctx)
		except Errors.WafError:
			Logs.error('Could not find the tool %s in the remote repository'%x)
开发者ID:PseudoSky,项目名称:voodoo,代码行数:12,代码来源:Scripting.py

示例7: update

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
def update(ctx):
    """updates the plugins from the *waflib/extras* directory"""
    lst = Options.options.files.split(",")
    if not lst:
        lst = [x for x in Utils.listdir(Context.waf_dir + "/waflib/extras") if x.endswith(".py")]
    for x in lst:
        tool = x.replace(".py", "")
        try:
            Configure.download_tool(tool, force=True, ctx=ctx)
        except Errors.WafError:
            Logs.error("Could not find the tool %s in the remote repository" % x)
开发者ID:jsternberg,项目名称:waf,代码行数:13,代码来源:Scripting.py

示例8: post_run

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
	def post_run(self):
		"""record the inner class files created (Class$Foo) - for cleaning the folders mostly
		it is not possible to know which inner classes in advance"""

		lst = set([x.parent for x in self.outputs])

		inner = []
		for k in lst:
			lst = Utils.listdir(k.abspath())
			for u in lst:
				if u.find('$') >= 0:
					node = k.find_or_declare(u)
					inner.append(node)

		to_add = set(inner) - set(self.outputs)
		self.outputs.extend(list(to_add))
		return super(javac, self).post_run()
开发者ID:zsx,项目名称:waf,代码行数:19,代码来源:javaw.py

示例9: update

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
def update(ctx):
	lst = Options.options.files
	if lst:
		lst = lst.split(',')
	else:
		path = os.path.join(Context.waf_dir, 'waflib', 'extras')
		lst = [x for x in Utils.listdir(path) if x.endswith('.py')]
	for x in lst:
		tool = x.replace('.py', '')
		if not tool:
			continue
		try:
			dl = Configure.download_tool
		except AttributeError:
			ctx.fatal('The command "update" is dangerous; include the tool "use_config" in your project!')
		try:
			dl(tool, force=True, ctx=ctx)
		except Errors.WafError:
			Logs.error('Could not find the tool %r in the remote repository' % x)
		else:
			Logs.warn('Updated %r' % tool)
开发者ID:XNerv,项目名称:waf,代码行数:23,代码来源:Scripting.py

示例10: check_boost

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
def check_boost(self, *k, **kw):
    """
	Initialize boost libraries to be used.

	Keywords: you can pass the same parameters as with the command line (without "--boost-").
	Note that the command line has the priority, and should preferably be used.
	"""
    if not self.env["CXX"]:
        self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')

    params = {"lib": k and k[0] or kw.get("lib", None)}
    for key, value in self.options.__dict__.items():
        if not key.startswith("boost_"):
            continue
        key = key[len("boost_") :]
        params[key] = value and value or kw.get(key, "")

    var = kw.get("uselib_store", "BOOST")

    self.start_msg("Checking boost includes")
    try:
        self.env["INCLUDES_%s" % var] = self.boost_get_includes(**params)
        self.env.BOOST_VERSION = self.boost_get_version(self.env["INCLUDES_%s" % var])
    except WafError:
        self.end_msg("not found", "YELLOW")
        raise
        # self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
        # self.env.BOOST_VERSION = self.boost_get_version(inc)
    self.end_msg(self.env.BOOST_VERSION)
    if Logs.verbose:
        Logs.pprint("CYAN", "	path : %s" % self.env["INCLUDES_%s" % var])

    if not params["lib"]:
        return
    self.start_msg("Checking boost libs")
    try:
        suffix = params.get("static", "ST") or ""
        path, libs = self.boost_get_libs(**params)
    except WafError:
        self.end_msg("not found", "YELLOW")
        raise
        # suffix = params.get('static', None) and 'ST' or ''
        # path, libs = self.boost_get_libs(**params)
    self.env["%sLIBPATH_%s" % (suffix, var)] = [path]
    self.env["%sLIB_%s" % (suffix, var)] = libs
    self.end_msg("ok")
    if Logs.verbose:
        Logs.pprint("CYAN", "	path : %s" % path)
        Logs.pprint("CYAN", "	libs : %s" % libs)

    def try_link():
        if "system" in params["lib"]:
            self.check_cxx(
                fragment="\n".join(
                    ["#include <boost/system/error_code.hpp>", "int main() { boost::system::error_code c; }"]
                ),
                use=var,
                execute=False,
            )
        if "thread" in params["lib"]:
            self.check_cxx(
                fragment="\n".join(["#include <boost/thread.hpp>", "int main() { boost::thread t; }"]),
                use=var,
                execute=False,
            )

    if params.get("linkage_autodetect", False):
        self.start_msg("Attempting to detect boost linkage flags")
        toolset = self.boost_get_toolset(kw.get("toolset", ""))
        if toolset in ["vc"]:
            # disable auto-linking feature, causing error LNK1181
            # because the code wants to be linked against
            self.env["DEFINES_%s" % var] += ["BOOST_ALL_NO_LIB"]

            # if no dlls are present, we guess the .lib files are not stubs
            has_dlls = False
            for x in Utils.listdir(path):
                if x.endswith(self.env.cxxshlib_PATTERN % ""):
                    has_dlls = True
                    break
            if not has_dlls:
                self.env["STLIBPATH_%s" % var] = [path]
                self.env["STLIB_%s" % var] = libs
                del self.env["LIB_%s" % var]
                del self.env["LIBPATH_%s" % var]

                # we attempt to play with some known-to-work CXXFLAGS combinations
            for cxxflags in (["/MD", "/EHsc"], []):
                self.env.stash()
                self.env["CXXFLAGS_%s" % var] += cxxflags
                try:
                    try_link()
                    self.end_msg("ok: winning cxxflags combination: %s" % (self.env["CXXFLAGS_%s" % var]))
                    e = None
                    break
                except Errors.ConfigurationError, exc:
                    self.env.revert()
                    e = exc

            if e is not None:
#.........这里部分代码省略.........
开发者ID:ioannisntokas,项目名称:ns3_team_2A,代码行数:103,代码来源:boost.py

示例11: listdir

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
	def listdir(self):
		lst=Utils.listdir(self.abspath())
		lst.sort()
		return lst
开发者ID:DunamisEric,项目名称:RepSys_Manets_NS-3.17,代码行数:6,代码来源:Node.py

示例12: check_boost

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
def check_boost(self, *k, **kw):
	"""
	Initialize boost libraries to be used.

	Keywords: you can pass the same parameters as with the command line (without "--boost-").
	Note that the command line has the priority, and should preferably be used.
	"""
	if not self.env['CXX']:
		self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')

	params = {
		'lib': k and k[0] or kw.get('lib'),
		'stlib': kw.get('stlib')
	}
	for key, value in self.options.__dict__.items():
		if not key.startswith('boost_'):
			continue
		key = key[len('boost_'):]
		params[key] = value and value or kw.get(key, '')

	var = kw.get('uselib_store', 'BOOST')

	self.start_msg('Checking boost includes')
	self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
	versions = self.boost_get_version(inc)
	self.env.BOOST_VERSION = versions[0]
	self.env.BOOST_VERSION_NUMBER = int(versions[1])
	self.end_msg("%d.%d.%d" % (int(versions[1]) / 100000,
							   int(versions[1]) / 100 % 1000,
							   int(versions[1]) % 100))
	if Logs.verbose:
		Logs.pprint('CYAN', '	path : %s' % self.env['INCLUDES_%s' % var])

	if not params['lib'] and not params['stlib']:
		return
	if 'static' in kw or 'static' in params:
		Logs.warn('boost: static parameter is deprecated, use stlib instead.')
	self.start_msg('Checking boost libs')
	path, libs, stlibs = self.boost_get_libs(**params)
	self.env['LIBPATH_%s' % var] = [path]
	self.env['STLIBPATH_%s' % var] = [path]
	self.env['LIB_%s' % var] = libs
	self.env['STLIB_%s' % var] = stlibs
	self.end_msg('ok')
	if Logs.verbose:
		Logs.pprint('CYAN', '	path : %s' % path)
		Logs.pprint('CYAN', '	shared libs : %s' % libs)
		Logs.pprint('CYAN', '	static libs : %s' % stlibs)


	def try_link():
		if (params['lib'] and 'system' in params['lib']) or \
			params['stlib'] and 'system' in params['stlib']:
			self.check_cxx(fragment=BOOST_ERROR_CODE, use=var, execute=False)
		if (params['lib'] and 'thread' in params['lib']) or \
			params['stlib'] and 'thread' in params['stlib']:
			self.check_cxx(fragment=BOOST_THREAD_CODE, use=var, execute=False)

		def is_log_mt():
			'''Check if found boost_log library is multithread-safe'''
			for lib in libs:
				if lib.startswith('boost_log'):
					lib_log = lib
					break
			return '-mt' in lib_log

		if params['lib'] and 'log' in params['lib']:
			self.env['DEFINES_%s' % var] += ['BOOST_LOG_DYN_LINK']
			if not is_log_mt():
				self.env['DEFINES_%s' % var] += ['BOOST_LOG_NO_THREADS']
			self.check_cxx(fragment=BOOST_LOG_CODE, use=var, execute=False)
		if params['stlib'] and 'log' in params['stlib']:
			# Static linking is assumed by default
			if not is_log_mt():
				self.env['DEFINES_%s' % var] += ['BOOST_LOG_NO_THREADS']
			self.check_cxx(fragment=BOOST_LOG_CODE, use=var, execute=False)

	if params.get('linkage_autodetect', False):
		self.start_msg("Attempting to detect boost linkage flags")
		toolset = self.boost_get_toolset(kw.get('toolset', ''))
		if toolset in ('vc',):
			# disable auto-linking feature, causing error LNK1181
			# because the code wants to be linked against
			self.env['DEFINES_%s' % var] += ['BOOST_ALL_NO_LIB']

			# if no dlls are present, we guess the .lib files are not stubs
			has_dlls = False
			for x in Utils.listdir(path):
				if x.endswith(self.env.cxxshlib_PATTERN % ''):
					has_dlls = True
					break
			if not has_dlls:
				self.env['STLIBPATH_%s' % var] = [path]
				self.env['STLIB_%s' % var] = libs
				del self.env['LIB_%s' % var]
				del self.env['LIBPATH_%s' % var]

			# we attempt to play with some known-to-work CXXFLAGS combinations
			for cxxflags in (['/MD', '/EHsc'], []):
				self.env.stash()
#.........这里部分代码省略.........
开发者ID:Rob3rtS,项目名称:waf-stage,代码行数:103,代码来源:boost.py

示例13: find_qt5_binaries

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
def find_qt5_binaries(self):
	env = self.env
	opt = Options.options

	qtdir = getattr(opt, 'qtdir', '')
	qtbin = getattr(opt, 'qtbin', '')

	paths = []

	if qtdir:
		qtbin = os.path.join(qtdir, 'bin')

	# the qt directory has been given from QT5_ROOT - deduce the qt binary path
	if not qtdir:
		qtdir = os.environ.get('QT5_ROOT', '')
		qtbin = os.environ.get('QT5_BIN', None) or os.path.join(qtdir, 'bin')

	if qtbin:
		paths = [qtbin]

	# no qtdir, look in the path and in /usr/local/Trolltech
	if not qtdir:
		paths = os.environ.get('PATH', '').split(os.pathsep)
		paths.append('/usr/share/qt5/bin/')
		try:
			lst = Utils.listdir('/usr/local/Trolltech/')
		except OSError:
			pass
		else:
			if lst:
				lst.sort()
				lst.reverse()

				# keep the highest version
				qtdir = '/usr/local/Trolltech/%s/' % lst[0]
				qtbin = os.path.join(qtdir, 'bin')
				paths.append(qtbin)

	# at the end, try to find qmake in the paths given
	# keep the one with the highest version
	cand = None
	prev_ver = ['5', '0', '0']
	for qmk in ('qmake-qt5', 'qmake5', 'qmake'):
		try:
			qmake = self.find_program(qmk, path_list=paths)
		except self.errors.ConfigurationError:
			pass
		else:
			try:
				version = self.cmd_and_log(qmake + ['-query', 'QT_VERSION']).strip()
			except self.errors.WafError:
				pass
			else:
				if version:
					new_ver = version.split('.')
					if new_ver > prev_ver:
						cand = qmake
						prev_ver = new_ver

	# qmake could not be found easily, rely on qtchooser
	if not cand:
		try:
			self.find_program('qtchooser')
		except self.errors.ConfigurationError:
			pass
		else:
			cmd = self.env.QTCHOOSER + ['-qt=5', '-run-tool=qmake']
			try:
				version = self.cmd_and_log(cmd + ['-query', 'QT_VERSION'])
			except self.errors.WafError:
				pass
			else:
				cand = cmd

	if cand:
		self.env.QMAKE = cand
	else:
		self.fatal('Could not find qmake for qt5')

	self.env.QT_INSTALL_BINS = qtbin = self.cmd_and_log(self.env.QMAKE + ['-query', 'QT_INSTALL_BINS']).strip() + os.sep
	paths.insert(0, qtbin)

	def find_bin(lst, var):
		if var in env:
			return
		for f in lst:
			try:
				ret = self.find_program(f, path_list=paths)
			except self.errors.ConfigurationError:
				pass
			else:
				env[var]=ret
				break

	find_bin(['uic-qt5', 'uic'], 'QT_UIC')
	if not env.QT_UIC:
		self.fatal('cannot find the uic compiler for qt5')

	self.start_msg('Checking for uic version')
	uicver = self.cmd_and_log(env.QT_UIC + ['-version'], output=Context.BOTH)
#.........这里部分代码省略.........
开发者ID:Niko3,项目名称:waf-stage,代码行数:103,代码来源:qt5.py

示例14: check_boost

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
def check_boost(self, *k, **kw):
	"""
	Initialize boost libraries to be used.

	Keywords: you can pass the same parameters as with the command line (without "--boost-").
	Note that the command line has the priority, and should preferably be used.
	"""
	if not self.env['CXX']:
		self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')

	params = {
		'lib': k and k[0] or kw.get('lib', None),
		'stlib': kw.get('stlib', None)
	}
	for key, value in self.options.__dict__.items():
		if not key.startswith('boost_'):
			continue
		key = key[len('boost_'):]
		params[key] = value and value or kw.get(key, '')

	var = kw.get('uselib_store', 'BOOST')

	if not self.env.DONE_FIND_BOOST_COMMON:
		self.find_program('dpkg-architecture', var='DPKG_ARCHITECTURE', mandatory=False)
		if self.env.DPKG_ARCHITECTURE:
			deb_host_multiarch = self.cmd_and_log([self.env.DPKG_ARCHITECTURE[0], '-qDEB_HOST_MULTIARCH'])
			BOOST_LIBS.insert(0, '/usr/lib/%s' % deb_host_multiarch.strip())

		self.start_msg('Checking boost includes')
		self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
		versions = self.boost_get_version(inc)
		self.env.BOOST_VERSION = versions[0]
		self.env.BOOST_VERSION_NUMBER = int(versions[1])
		self.end_msg('%d.%d.%d' % (int(versions[1]) / 100000,
								   int(versions[1]) / 100 % 1000,
								   int(versions[1]) % 100))
		if Logs.verbose:
			Logs.pprint('CYAN', '	path : %s' % self.env['INCLUDES_%s' % var])

		self.env.DONE_FIND_BOOST_COMMON = True

	if not params['lib'] and not params['stlib']:
		return
	if 'static' in kw or 'static' in params:
		Logs.warn('boost: static parameter is deprecated, use stlib instead.')
	self.start_msg('Checking boost libs')
	path, libs, stlibs = self.boost_get_libs(**params)
	self.env['LIBPATH_%s' % var] = [path]
	self.env['STLIBPATH_%s' % var] = [path]
	self.env['LIB_%s' % var] = libs
	self.env['STLIB_%s' % var] = stlibs
	self.end_msg(' '.join(libs + stlibs))
	if Logs.verbose:
		Logs.pprint('CYAN', '	path : %s' % path)
		Logs.pprint('CYAN', '	shared libs : %s' % libs)
		Logs.pprint('CYAN', '	static libs : %s' % stlibs)

	def has_shlib(lib):
		return params['lib'] and lib in params['lib']
	def has_stlib(lib):
		return params['stlib'] and lib in params['stlib']
	def has_lib(lib):
		return has_shlib(lib) or has_stlib(lib)
	if has_lib('thread'):
		# not inside try_link to make check visible in the output
		self._check_pthread_flag(k, kw)

	def try_link():
		if has_lib('system'):
			self.check_cxx(fragment=BOOST_ERROR_CODE, use=var, execute=False)
		if has_lib('thread'):
			self.check_cxx(fragment=BOOST_THREAD_CODE, use=var, execute=False)
		if has_lib('log') or has_lib('log_setup'):
			if not has_lib('thread'):
				self.env['DEFINES_%s' % var] += ['BOOST_LOG_NO_THREADS']
			if has_shlib('log') or has_shlib('log_setup'):
				self.env['DEFINES_%s' % var] += ['BOOST_LOG_DYN_LINK']
			if has_lib('log_setup'):
				self.check_cxx(fragment=BOOST_LOG_SETUP_CODE, use=var, execute=False)
			else:
				self.check_cxx(fragment=BOOST_LOG_CODE, use=var, execute=False)

	if params.get('linkage_autodetect', False):
		self.start_msg('Attempting to detect boost linkage flags')
		toolset = self.boost_get_toolset(kw.get('toolset', ''))
		if toolset in ('vc',):
			# disable auto-linking feature, causing error LNK1181
			# because the code wants to be linked against
			self.env['DEFINES_%s' % var] += ['BOOST_ALL_NO_LIB']

			# if no dlls are present, we guess the .lib files are not stubs
			has_dlls = False
			for x in Utils.listdir(path):
				if x.endswith(self.env.cxxshlib_PATTERN % ''):
					has_dlls = True
					break
			if not has_dlls:
				self.env['STLIBPATH_%s' % var] = [path]
				self.env['STLIB_%s' % var] = libs
				del self.env['LIB_%s' % var]
#.........这里部分代码省略.........
开发者ID:JonnyKong,项目名称:scenario-PSync,代码行数:103,代码来源:boost.py

示例15: check_boost

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import listdir [as 别名]
def check_boost(self,*k,**kw):
	if not self.env['CXX']:
		self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')
	params={'lib':k and k[0]or kw.get('lib',None)}
	for key,value in list(self.options.__dict__.items()):
		if not key.startswith('boost_'):
			continue
		key=key[len('boost_'):]
		params[key]=value and value or kw.get(key,'')
	var=kw.get('uselib_store','BOOST')
	self.start_msg('Checking boost includes')
	self.env['INCLUDES_%s'%var]=inc=self.boost_get_includes(**params)
	self.env.BOOST_VERSION=self.boost_get_version(inc)
	self.end_msg(self.env.BOOST_VERSION)
	if Logs.verbose:
		Logs.pprint('CYAN','	path : %s'%self.env['INCLUDES_%s'%var])
	if not params['lib']:
		return
	self.start_msg('Checking boost libs')
	suffix=params.get('static',None)and'ST'or''
	path,libs=self.boost_get_libs(**params)
	self.env['%sLIBPATH_%s'%(suffix,var)]=[path]
	self.env['%sLIB_%s'%(suffix,var)]=libs
	self.end_msg('ok')
	if Logs.verbose:
		Logs.pprint('CYAN','	path : %s'%path)
		Logs.pprint('CYAN','	libs : %s'%libs)
	def try_link():
		if'system'in params['lib']:
			self.check_cxx(fragment="\n".join(['#include <boost/system/error_code.hpp>','int main() { boost::system::error_code c; }',]),use=var,execute=False,)
		if'thread'in params['lib']:
			self.check_cxx(fragment="\n".join(['#include <boost/thread.hpp>','int main() { boost::thread t; }',]),use=var,execute=False,)
	if params.get('linkage_autodetect',False):
		self.start_msg("Attempting to detect boost linkage flags")
		toolset=self.boost_get_toolset(kw.get('toolset',''))
		if toolset in['vc']:
			self.env['DEFINES_%s'%var]+=['BOOST_ALL_NO_LIB']
			has_dlls=False
			for x in Utils.listdir(path):
				if x.endswith(self.env.cxxshlib_PATTERN%''):
					has_dlls=True
					break
			if not has_dlls:
				self.env['STLIBPATH_%s'%var]=[path]
				self.env['STLIB_%s'%var]=libs
				del self.env['LIB_%s'%var]
				del self.env['LIBPATH_%s'%var]
			for cxxflags in(['/MD','/EHsc'],[]):
				self.env.stash()
				self.env["CXXFLAGS_%s"%var]+=cxxflags
				try:
					try_link()
					self.end_msg("ok: winning cxxflags combination: %s"%(self.env["CXXFLAGS_%s"%var]))
					exc=None
					break
				except Errors.ConfigurationError as e:
					self.env.revert()
					exc=e
			if exc is not None:
				self.end_msg("Could not auto-detect boost linking flags combination, you may report it to boost.py author",ex=exc)
				self.fatal('The configuration failed')
		else:
			self.end_msg("Boost linkage flags auto-detection not implemented (needed ?) for this toolchain")
			self.fatal('The configuration failed')
	else:
		self.start_msg('Checking for boost linkage')
		try:
			try_link()
		except Errors.ConfigurationError as e:
			self.end_msg("Could not link against boost libraries using supplied options")
			self.fatal('The configuration failed')
		self.end_msg('ok')
开发者ID:Emantor,项目名称:core,代码行数:74,代码来源:boost.py


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