本文整理汇总了Python中conans.model.options.OptionsValues.from_list方法的典型用法代码示例。如果您正苦于以下问题:Python OptionsValues.from_list方法的具体用法?Python OptionsValues.from_list怎么用?Python OptionsValues.from_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类conans.model.options.OptionsValues
的用法示例。
在下文中一共展示了OptionsValues.from_list方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _loader
# 需要导入模块: from conans.model.options import OptionsValues [as 别名]
# 或者: from conans.model.options.OptionsValues import from_list [as 别名]
def _loader(self, current_path=None, user_settings_values=None, user_options_values=None,
scopes=None):
# The disk settings definition, already including the default disk values
settings = self._paths.settings
options = OptionsValues()
conaninfo_scopes = Scopes()
if current_path:
conan_info_path = os.path.join(current_path, CONANINFO)
if os.path.exists(conan_info_path):
existing_info = ConanInfo.load_file(conan_info_path)
settings.values = existing_info.full_settings
options = existing_info.full_options # Take existing options from conaninfo.txt
conaninfo_scopes = existing_info.scope
if user_settings_values:
aux_values = Values.from_list(user_settings_values)
settings.values = aux_values
if user_options_values is not None: # Install will pass an empty list []
# Install OVERWRITES options, existing options in CONANINFO are not taken
# into account, just those from CONANFILE + user command line
options = OptionsValues.from_list(user_options_values)
if scopes:
conaninfo_scopes.update_scope(scopes)
self._current_scopes = conaninfo_scopes
return ConanFileLoader(self._runner, settings, options=options, scopes=conaninfo_scopes)
示例2: create_options
# 需要导入模块: from conans.model.options import OptionsValues [as 别名]
# 或者: from conans.model.options.OptionsValues import from_list [as 别名]
def create_options(conanfile):
try:
package_options = PackageOptions(getattr(conanfile, "options", None))
options = Options(package_options)
default_options = getattr(conanfile, "default_options", None)
if default_options:
if isinstance(default_options, tuple):
default_values = OptionsValues.loads("\n".join(default_options))
elif isinstance(default_options, list):
default_values = OptionsValues.from_list(default_options)
elif isinstance(default_options, basestring):
default_values = OptionsValues.loads(default_options)
else:
raise ConanException("Please define your default_options as list or " "multiline string")
options.values = default_values
return options
except Exception as e:
raise ConanException("Error while initializing options. %s" % str(e))
示例3: load_virtual
# 需要导入模块: from conans.model.options import OptionsValues [as 别名]
# 或者: from conans.model.options.OptionsValues import from_list [as 别名]
def load_virtual(self, reference, path):
fixed_options = []
# If user don't specify namespace in options, assume that it's for the reference (keep compatibility)
for option_name, option_value in self._options.as_list():
if ":" not in option_name:
tmp = ("%s:%s" % (reference.name, option_name), option_value)
else:
tmp = (option_name, option_value)
fixed_options.append(tmp)
options = OptionsValues.from_list(fixed_options)
conanfile = ConanFile(None, self._runner, self._settings.copy(), path)
conanfile.requires.add(str(reference)) # Convert to string necessary
# conanfile.options.values = options
conanfile.options.initialize_upstream(options)
conanfile.generators = ["txt"]
conanfile.scope = self._scopes.package_scope()
return conanfile
示例4: test_from_list
# 需要导入模块: from conans.model.options import OptionsValues [as 别名]
# 或者: from conans.model.options.OptionsValues import from_list [as 别名]
def test_from_list(self):
option_values = OptionsValues.from_list(self.sut.as_list())
self.assertEqual(option_values.dumps(), self.sut.dumps())