Esempio n. 1
0
    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
Esempio n. 2
0
    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
Esempio n. 3
0
    def loads(text):
        # This is used for search functionality, search prints info from this file
        # Other use is from the BinariesAnalyzer, to get the recipe_hash and know
        # if package is outdated
        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 = _PackageReferenceList.loads(
            parser.full_requires)
        # Requires after load are not used for any purpose, CAN'T be used, they are not correct
        result.requires = RequirementsInfo(result.full_requires,
                                           "semver_direct_mode")
        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
Esempio n. 4
0
    def _loader(self, current_path=None, user_settings_values=None, user_options_values=None):
        # The disk settings definition, already including the default disk values
        settings = self._paths.settings
        options = OptionsValues()
        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

        if user_settings_values:
            # FIXME: CHapuza
            aux_values = Values.loads("\n".join(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.loads("\n".join(user_options_values))

        return ConanFileLoader(self._user_io.out, self._runner, settings, options=options)
Esempio n. 5
0
 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)
Esempio n. 6
0
 def setUp(self):
     package_options = PackageOptions.loads("""{static: [True, False],
     optimized: [2, 3, 4]}""")
     package_options.values = Values.loads("static=True\noptimized=3")
     self.sut = Options(package_options)