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


Python values.Values类代码示例

本文整理汇总了Python中conans.model.values.Values的典型用法代码示例。如果您正苦于以下问题:Python Values类的具体用法?Python Values怎么用?Python Values使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: settings_defaults

 def settings_defaults(self, settings):
     default_settings = self.get_conf("settings_defaults")
     values = Values.from_list(default_settings)
     settings.values = values
     mixed_settings = _mix_settings_with_env(default_settings)
     values = Values.from_list(mixed_settings)
     settings.values = values
开发者ID:nesono,项目名称:conan,代码行数:7,代码来源:__init__.py

示例2: loads

    def loads(text):
        parser = ConfigParser(text, ["settings", "full_settings", "options", "full_options",
                                     "requires", "full_requires"])

        result = ConanInfo()
        result.settings = Values.loads(parser.settings)
        result.full_settings = Values.loads(parser.full_settings)
        result.options = OptionsValues.loads(parser.options)
        result.full_options = OptionsValues.loads(parser.full_options)
        result.full_requires = RequirementsList.loads(parser.full_requires)
        result.requires = RequirementsInfo(result.full_requires)
        # TODO: Missing handling paring of requires, but not necessary now
        return result
开发者ID:KindDragon,项目名称:conan,代码行数:13,代码来源:info.py

示例3: from_list

 def from_list(data):
     result = OptionsValues()
     by_package = defaultdict(list)
     for k, v in data:
         tokens = k.split(":")
         if len(tokens) == 2:
             package, option = tokens
             by_package[package.strip()].append((option, v))
         else:
             by_package[None].append((k, v))
     result._options = Values.from_list(by_package[None])
     for k, v in by_package.items():
         if k is not None:
             result._reqs_options[k] = Values.from_list(v)
     return result
开发者ID:NoWiseMan,项目名称:conan,代码行数:15,代码来源:options.py

示例4: loads

    def loads(text):
        parser = ConfigParser(text, ["settings", "full_settings", "options", "full_options",
                                     "requires", "full_requires", "scope", "recipe_hash",
                                     "env"], raise_unexpected_field=False)
        result = ConanInfo()
        result.settings = Values.loads(parser.settings)
        result.full_settings = Values.loads(parser.full_settings)
        result.options = OptionsValues.loads(parser.options)
        result.full_options = OptionsValues.loads(parser.full_options)
        result.full_requires = RequirementsList.loads(parser.full_requires)
        result.requires = RequirementsInfo(result.full_requires)
        result.recipe_hash = parser.recipe_hash or None

        # TODO: Missing handling paring of requires, but not necessary now
        result.env_values = EnvValues.loads(parser.env)
        return result
开发者ID:19317362,项目名称:conan,代码行数:16,代码来源:info.py

示例5: _loader

    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,代码行数:29,代码来源:manager.py

示例6: simple_test

    def simple_test(self):
        v = Values()
        self.assertEqual(v.compiler, None)
        v.compiler = 3
        self.assertTrue(v.compiler == "3")

        self.assertEqual(v.compiler.version, None)
        v.compiler.version = "asfaf"
        self.assertEqual(v.compiler.version, "asfaf")

        my_list = v.as_list()
        self.assertEqual(my_list, [("compiler", "3"), ("compiler.version", "asfaf")])

        values = Values.from_list(my_list)
        self.assertEqual(values.dumps(), v.dumps())

        v.compiler = None
        self.assertEqual(v.as_list(), [("compiler", "None")])
        self.assertEqual(v.dumps(), "compiler=None")
开发者ID:davidsanfal,项目名称:conan,代码行数:19,代码来源:values_test.py

示例7: load_conan

    def load_conan(self, conanfile_path, output, consumer=False, reference=None, local=False):
        """ loads a ConanFile object from the given file
        """
        result = load_conanfile_class(conanfile_path)
        try:
            # Prepare the settings for the loaded conanfile
            # Mixing the global settings with the specified for that name if exist
            tmp_settings = self._settings.copy()
            if self._package_settings and result.name in self._package_settings:
                # Update the values, keeping old ones (confusing assign)
                values_tuple = self._package_settings[result.name]
                tmp_settings.values = Values.from_list(values_tuple)

            if reference:
                result.name = reference.name
                result.version = reference.version
                user, channel = reference.user, reference.channel
            else:
                user, channel = None, None

            # Instance the conanfile
            result = result(output, self._runner, tmp_settings, user, channel, local)

            # Assign environment
            result._env_values.update(self._env_values)

            if consumer:
                self._user_options.descope_options(result.name)
                result.options.initialize_upstream(self._user_options, local=local)
                self._user_options.clear_unscoped_options()
            else:
                result.in_local_cache = True

            if consumer or (self.dev_reference and self.dev_reference == reference):
                result.develop = True

            return result
        except Exception as e:  # re-raise with file name
            raise ConanException("%s: %s" % (conanfile_path, str(e)))
开发者ID:19317362,项目名称:conan,代码行数:39,代码来源:loader.py

示例8: setUp

 def setUp(self):
     package_options = PackageOptions.loads("""{static: [True, False],
     optimized: [2, 3, 4],
     path: ANY}""")
     package_options.values = Values.loads("static=True\noptimized=3\npath=NOTDEF")
     self.sut = Options(package_options)
开发者ID:JustgeekDE,项目名称:conan,代码行数:6,代码来源:options_test.py

示例9: settings_defaults

 def settings_defaults(self):
     default_settings = self.get_conf("settings_defaults")
     values = Values.from_list(default_settings)
     return values
开发者ID:davidsanfal,项目名称:conan,代码行数:4,代码来源:__init__.py

示例10: values

 def values(self):
     result = OptionsValues()
     result._options = Values.from_list(self._options.values_list)
     for k, v in self._reqs_options.items():
         result._reqs_options[k] = v.copy()
     return result
开发者ID:NoWiseMan,项目名称:conan,代码行数:6,代码来源:options.py

示例11: deserialize

 def deserialize(data):
     result = OptionsValues()
     result._options = Values.deserialize(data["options"])
     for name, data_values in data["req_options"].items():
         result._reqs_options[name] = Values.deserialize(data_values)
     return result
开发者ID:NoWiseMan,项目名称:conan,代码行数:6,代码来源:options.py

示例12: __init__

 def __init__(self):
     self._options = Values()
     self._reqs_options = {}  # {name("Boost": Values}
开发者ID:NoWiseMan,项目名称:conan,代码行数:3,代码来源:options.py

示例13: OptionsValues

class OptionsValues(object):
    """ static= True,
    Boost.static = False,
    Poco.optimized = True
    """
    def __init__(self):
        self._options = Values()
        self._reqs_options = {}  # {name("Boost": Values}

    def __getitem__(self, item):
        return self._reqs_options.setdefault(item, Values())

    def pop(self, item):
        return self._reqs_options.pop(item, None)

    def __repr__(self):
        return self.dumps()

    def __getattr__(self, attr):
        return getattr(self._options, attr)

    def copy(self):
        result = OptionsValues()
        result._options = self._options.copy()
        for k, v in self._reqs_options.items():
            result._reqs_options[k] = v.copy()
        return result

    def __setattr__(self, attr, value):
        if attr[0] == "_":
            return super(OptionsValues, self).__setattr__(attr, value)
        return setattr(self._options, attr, value)

    def clear_indirect(self):
        for v in self._reqs_options.values():
            v.clear()

    def as_list(self):
        result = []
        options_list = self._options.as_list()
        if options_list:
            result.extend(options_list)
        for key in sorted(self._reqs_options.keys()):
            for line in self._reqs_options[key].as_list():
                line_key, line_value = line
                result.append(("%s:%s" % (key, line_key), line_value))
        return result

    @staticmethod
    def from_list(data):
        result = OptionsValues()
        by_package = defaultdict(list)
        for k, v in data:
            tokens = k.split(":")
            if len(tokens) == 2:
                package, option = tokens
                by_package[package.strip()].append((option, v))
            else:
                by_package[None].append((k, v))
        result._options = Values.from_list(by_package[None])
        for k, v in by_package.items():
            if k is not None:
                result._reqs_options[k] = Values.from_list(v)
        return result

    def dumps(self):
        result = []
        for key, value in self.as_list():
            result.append("%s=%s" % (key, value))
        return "\n".join(result)

    @staticmethod
    def loads(text):
        result = OptionsValues()
        for line in text.splitlines():
            line = line.strip()
            if not line:
                continue
            tokens = line.split(":")
            if len(tokens) == 2:
                package, option = tokens
                current = result._reqs_options.setdefault(package.strip(), Values())
            else:
                option = tokens[0].strip()
                current = result._options
            current.add(option)
        return result

    @property
    def sha(self):
        result = []
        result.append(self._options.sha)
        for key in sorted(list(self._reqs_options.keys())):
            result.append(self._reqs_options[key].sha)
        return sha1('\n'.join(result).encode())

    def serialize(self):
        ret = {}
        ret["options"] = self._options.serialize()
        ret["req_options"] = {}
#.........这里部分代码省略.........
开发者ID:NoWiseMan,项目名称:conan,代码行数:101,代码来源:options.py

示例14: generate_default_config_file

 def generate_default_config_file():
     default_settings = detect_defaults_settings(self._output)
     default_setting_values = Values.from_list(default_settings)
     client_conf = default_client_conf + default_setting_values.dumps()
     save(self.conan_conf_path, client_conf)
开发者ID:WimK,项目名称:conan,代码行数:5,代码来源:paths.py

示例15: values

 def values(self):
     return Values.from_list(self.values_list)
开发者ID:SteffenL,项目名称:conan,代码行数:2,代码来源:config_dict.py


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