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


Python OptionsValues.from_list方法代码示例

本文整理汇总了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)
开发者ID:JustgeekDE,项目名称:conan,代码行数:31,代码来源:manager.py

示例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))
开发者ID:zaitrarrio,项目名称:conan,代码行数:21,代码来源:conan_file.py

示例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
开发者ID:JustgeekDE,项目名称:conan,代码行数:23,代码来源:loader.py

示例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())
开发者ID:JustgeekDE,项目名称:conan,代码行数:5,代码来源:options_test.py


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