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


Python Utils.get_registry_app_path方法代码示例

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


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

示例1: find_program

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import get_registry_app_path [as 别名]
def find_program(self,filename,**kw):
	exts=kw.get('exts',Utils.is_win32 and'.exe,.com,.bat,.cmd'or',.sh,.pl,.py')
	environ=kw.get('environ',getattr(self,'environ',os.environ))
	ret=''
	filename=Utils.to_list(filename)
	msg=kw.get('msg',', '.join(filename))
	var=kw.get('var','')
	if not var:
		var=re.sub(r'[-.]','_',filename[0].upper())
	path_list=kw.get('path_list','')
	if path_list:
		path_list=Utils.to_list(path_list)
	else:
		path_list=environ.get('PATH','').split(os.pathsep)
	if var in environ:
		filename=environ[var]
		if os.path.isfile(filename):
			ret=[filename]
		else:
			ret=self.cmd_to_list(filename)
	elif self.env[var]:
		ret=self.env[var]
		ret=self.cmd_to_list(ret)
	else:
		if not ret:
			ret=self.find_binary(filename,exts.split(','),path_list)
		if not ret and Utils.winreg:
			ret=Utils.get_registry_app_path(Utils.winreg.HKEY_CURRENT_USER,filename)
		if not ret and Utils.winreg:
			ret=Utils.get_registry_app_path(Utils.winreg.HKEY_LOCAL_MACHINE,filename)
		ret=self.cmd_to_list(ret)
	if ret:
		if len(ret)==1:
			retmsg=ret[0]
		else:
			retmsg=ret
	else:
		retmsg=False
	self.msg("Checking for program '%s'"%msg,retmsg,**kw)
	if not kw.get('quiet',None):
		self.to_log('find program=%r paths=%r var=%r -> %r'%(filename,path_list,var,ret))
	if not ret:
		self.fatal(kw.get('errmsg','')or'Could not find the program %r'%filename)
	interpreter=kw.get('interpreter',None)
	if interpreter is None:
		if not Utils.check_exe(ret[0],env=environ):
			self.fatal('Program %r is not executable'%ret)
		self.env[var]=ret
	else:
		self.env[var]=self.env[interpreter]+ret
	return ret
开发者ID:raystubbs,项目名称:NMSU-BigData-REU-NDN-Access-Control-Simulation,代码行数:53,代码来源:Configure.py

示例2: find_program

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import get_registry_app_path [as 别名]
def find_program(self,filename,**kw):
	exts=kw.get('exts',Utils.is_win32 and'.exe,.com,.bat,.cmd'or',.sh,.pl,.py')
	environ=kw.get('environ',os.environ)
	ret=''
	filename=Utils.to_list(filename)
	var=kw.get('var','')
	if not var:
		var=filename[0].upper()
	if self.env[var]:
		ret=self.env[var]
	elif var in environ:
		ret=environ[var]
	path_list=kw.get('path_list','')
	if not ret:
		if path_list:
			path_list=Utils.to_list(path_list)
		else:
			path_list=environ.get('PATH','').split(os.pathsep)
		if not isinstance(filename,list):
			filename=[filename]
		for a in exts.split(','):
			if ret:
				break
			for b in filename:
				if ret:
					break
				for c in path_list:
					if ret:
						break
					x=os.path.expanduser(os.path.join(c,b+a))
					if os.path.isfile(x):
						ret=x
	if not ret and Utils.winreg:
		ret=Utils.get_registry_app_path(Utils.winreg.HKEY_CURRENT_USER,filename)
	if not ret and Utils.winreg:
		ret=Utils.get_registry_app_path(Utils.winreg.HKEY_LOCAL_MACHINE,filename)
	display_name=kw.get('display_name',', '.join(filename))
	self.msg('Checking for program %s'%display_name,ret or False)
	self.to_log('find program=%r paths=%r var=%r -> %r'%(filename,path_list,var,ret))
	if not ret:
		self.fatal(kw.get('errmsg','')or'Could not find the program %s'%','.join(filename))
	if var:
		self.env[var]=ret
	return ret
开发者ID:Easylovexjl,项目名称:ndn,代码行数:46,代码来源:Configure.py

示例3: find_program

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import get_registry_app_path [as 别名]
def find_program(self, filename, **kw):
    exts = kw.get("exts", Utils.is_win32 and ".exe,.com,.bat,.cmd" or ",.sh,.pl,.py")
    environ = kw.get("environ", os.environ)
    ret = ""
    filename = Utils.to_list(filename)
    var = kw.get("var", "")
    if not var:
        var = filename[0].upper()
    if self.env[var]:
        ret = self.env[var]
    elif var in environ:
        ret = environ[var]
    path_list = kw.get("path_list", "")
    if not ret:
        if path_list:
            path_list = Utils.to_list(path_list)
        else:
            path_list = environ.get("PATH", "").split(os.pathsep)
        if not isinstance(filename, list):
            filename = [filename]
        for a in exts.split(","):
            if ret:
                break
            for b in filename:
                if ret:
                    break
                for c in path_list:
                    if ret:
                        break
                    x = os.path.expanduser(os.path.join(c, b + a))
                    if os.path.isfile(x):
                        ret = x
    if not ret and Utils.winreg:
        ret = Utils.get_registry_app_path(Utils.winreg.HKEY_CURRENT_USER, filename)
    if not ret and Utils.winreg:
        ret = Utils.get_registry_app_path(Utils.winreg.HKEY_LOCAL_MACHINE, filename)
    self.msg("Checking for program " + ",".join(filename), ret or False)
    self.to_log("find program=%r paths=%r var=%r -> %r" % (filename, path_list, var, ret))
    if not ret:
        self.fatal(kw.get("errmsg", "") or "Could not find the program %s" % ",".join(filename))
    if var:
        self.env[var] = ret
    return ret
开发者ID:RONNCC,项目名称:pysoy,代码行数:45,代码来源:Configure.py

示例4: find_program

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import get_registry_app_path [as 别名]
def find_program(self, filename, **kw):
	"""
	Search for a program on the operating system

	When var is used, you may set os.environ[var] to help find a specific program version, for example::

		$ VALAC=/usr/bin/valac_test waf configure

	:param path_list: paths to use for searching
	:type param_list: list of string
	:param var: store the result to conf.env[var], by default use filename.upper()
	:type var: string
	:param ext: list of extensions for the binary (do not add an extension for portability)
	:type ext: list of string
	"""

	exts = kw.get('exts', Utils.is_win32 and '.exe,.com,.bat,.cmd' or ',.sh,.pl,.py')

	environ = kw.get('environ', os.environ)

	ret = ''
	filename = Utils.to_list(filename)

	var = kw.get('var', '')
	if not var:
		var = filename[0].upper()

	if self.env[var]:
		ret = self.env[var]
	elif var in environ:
		ret = environ[var]

	path_list = kw.get('path_list', '')
	if not ret:
		if path_list:
			path_list = Utils.to_list(path_list)
		else:
			path_list = environ.get('PATH', '').split(os.pathsep)

		if not isinstance(filename, list):
			filename = [filename]

		for a in exts.split(','):
			if ret:
				break
			for b in filename:
				if ret:
					break
				for c in path_list:
					if ret:
						break
					x = os.path.expanduser(os.path.join(c, b + a))
					if os.path.isfile(x):
						ret = x

	if not ret and Utils.winreg:
		ret = Utils.get_registry_app_path(Utils.winreg.HKEY_CURRENT_USER, filename)
	if not ret and Utils.winreg:
		ret = Utils.get_registry_app_path(Utils.winreg.HKEY_LOCAL_MACHINE, filename)

	self.msg('Checking for program ' + ','.join(filename), ret or False)
	self.to_log('find program=%r paths=%r var=%r -> %r' % (filename, path_list, var, ret))

	if not ret:
		self.fatal(kw.get('errmsg', '') or 'Could not find the program %s' % ','.join(filename))

	if var:
		self.env[var] = ret
	return ret
开发者ID:Anastasia1302,项目名称:code-pile,代码行数:71,代码来源:Configure.py

示例5: find_program

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import get_registry_app_path [as 别名]
def find_program(self, filename, **kw):
	"""
	Search for a program on the operating system

	When var is used, you may set os.environ[var] to help find a specific program version, for example::

		$ CC='ccache gcc' waf configure

	:param path_list: paths to use for searching
	:type param_list: list of string
	:param var: store the result to conf.env[var], by default use filename.upper()
	:type var: string
	:param ext: list of extensions for the binary (do not add an extension for portability)
	:type ext: list of string
	:param msg: name to display in the log, by default filename is used
	:type msg: string
	:param interpreter: interpreter for the program
	:type interpreter: ConfigSet variable key
	"""

	exts = kw.get('exts', Utils.is_win32 and '.exe,.com,.bat,.cmd' or ',.sh,.pl,.py')

	environ = kw.get('environ', getattr(self, 'environ', os.environ))

	ret = ''

	filename = Utils.to_list(filename)
	msg = kw.get('msg', ', '.join(filename))

	var = kw.get('var', '')
	if not var:
		var = re.sub(r'[-.]', '_', filename[0].upper())

	path_list = kw.get('path_list', '')
	if path_list:
		path_list = Utils.to_list(path_list)
	else:
		path_list = environ.get('PATH', '').split(os.pathsep)

	if var in environ:
		filename = environ[var]
		if os.path.isfile(filename):
			# typical CC=/usr/bin/gcc waf configure build
			ret = [filename]
		else:
			# case  CC='ccache gcc' waf configure build
			ret = self.cmd_to_list(filename)
	elif self.env[var]:
		# set by the user in the wscript file
		ret = self.env[var]
		ret = self.cmd_to_list(ret)
	else:
		if not ret:
			ret = self.find_binary(filename, exts.split(','), path_list)
		if not ret and Utils.winreg:
			ret = Utils.get_registry_app_path(Utils.winreg.HKEY_CURRENT_USER, filename)
		if not ret and Utils.winreg:
			ret = Utils.get_registry_app_path(Utils.winreg.HKEY_LOCAL_MACHINE, filename)
		ret = self.cmd_to_list(ret)


	if ret:
		if len(ret) == 1:
			retmsg = ret[0]
		else:
			retmsg = ret
	else:
		retmsg = False

	self.msg("Checking for program '%s'" % msg, retmsg, **kw)
	if not kw.get('quiet', None):
		self.to_log('find program=%r paths=%r var=%r -> %r' % (filename, path_list, var, ret))

	if not ret:
		self.fatal(kw.get('errmsg', '') or 'Could not find the program %r' % filename)

	interpreter = kw.get('interpreter', None)
	if interpreter is None:
		if not Utils.check_exe(ret[0], env=environ):
			self.fatal('Program %r is not executable' % ret)
		self.env[var] = ret
	else:
		self.env[var] = self.env[interpreter] + ret

	return ret
开发者ID:BigPigg,项目名称:waf,代码行数:87,代码来源:Configure.py

示例6: find_program

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import get_registry_app_path [as 别名]
def find_program(self, filename, **kw):
	"""
	Search for a program on the operating system

	When var is used, you may set os.environ[var] to help find a specific program version, for example::

		$ CC='ccache gcc' waf configure

	:param path_list: paths to use for searching
	:type param_list: list of string
	:param var: store the result to conf.env[var] where var defaults to filename.upper() if not provided; the result is stored as a list of strings
	:type var: string
	:param value: obtain the program from the value passed exclusively
	:type value: list or string (list is preferred)
	:param ext: list of extensions for the binary (do not add an extension for portability)
	:type ext: list of string
	:param msg: name to display in the log, by default filename is used
	:type msg: string
	:param interpreter: interpreter for the program
	:type interpreter: ConfigSet variable key
	"""

	exts = kw.get('exts', Utils.is_win32 and '.exe,.com,.bat,.cmd' or ',.sh,.pl,.py')

	environ = kw.get('environ', getattr(self, 'environ', os.environ))

	ret = ''

	filename = Utils.to_list(filename)
	msg = kw.get('msg', ', '.join(filename))

	var = kw.get('var', '')
	if not var:
		var = re.sub(r'[-.]', '_', filename[0].upper())

	path_list = kw.get('path_list', '')
	if path_list:
		path_list = Utils.to_list(path_list)
	else:
		path_list = environ.get('PATH', '').split(os.pathsep)

	if kw.get('value'):
		# user-provided in command-line options and passed to find_program
		ret = self.cmd_to_list(kw['value'])
	elif var in environ:
		# user-provided in the os environment
		ret = self.cmd_to_list(environ[var])
	elif self.env[var]:
		# a default option in the wscript file
		ret = self.cmd_to_list(self.env[var])
	else:
		if not ret:
			ret = self.find_binary(filename, exts.split(','), path_list)
		if not ret and Utils.winreg:
			ret = Utils.get_registry_app_path(Utils.winreg.HKEY_CURRENT_USER, filename)
		if not ret and Utils.winreg:
			ret = Utils.get_registry_app_path(Utils.winreg.HKEY_LOCAL_MACHINE, filename)
		ret = self.cmd_to_list(ret)

	if ret:
		if len(ret) == 1:
			retmsg = ret[0]
		else:
			retmsg = ret
	else:
		retmsg = False

	self.msg('Checking for program %r' % msg, retmsg, **kw)
	if not kw.get('quiet'):
		self.to_log('find program=%r paths=%r var=%r -> %r' % (filename, path_list, var, ret))

	if not ret:
		self.fatal(kw.get('errmsg', '') or 'Could not find the program %r' % filename)

	interpreter = kw.get('interpreter')
	if interpreter is None:
		if not Utils.check_exe(ret[0], env=environ):
			self.fatal('Program %r is not executable' % ret)
		self.env[var] = ret
	else:
		self.env[var] = self.env[interpreter] + ret

	return ret
开发者ID:Tiksagol,项目名称:waf,代码行数:85,代码来源:Configure.py


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