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


Python ConanInfo.load_file方法代码示例

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


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

示例1: inverse_upper_option_test

# 需要导入模块: from conans.model.info import ConanInfo [as 别名]
# 或者: from conans.model.info.ConanInfo import load_file [as 别名]
    def inverse_upper_option_test(self):
        self._create("Hello0", "0.1", no_config=True)
        self._create("Hello1", "0.1", ["Hello0/[email protected]/stable"], no_config=True)
        self._create("Hello2", "0.1", ["Hello1/[email protected]/stable"], export=False, no_config=True)

        self.client.run("install -o language=0 -o Hello1:language=1 -o Hello0:language=0 %s "
                        "--build missing" % self.settings)
        info_path = os.path.join(self.client.current_folder, CONANINFO)

        conan_info = ConanInfo.load_file(info_path)

        self.assertEqual("language=0\nstatic=True", conan_info.options.dumps())
        conan_ref = ConanFileReference.loads("Hello0/[email protected]/stable")

        hello0 = self.client.paths.package(PackageReference(conan_ref,
                                           "2e38bbc2c3ef1425197c8e2ffa8532894c347d26"))
        hello0_info = os.path.join(hello0, CONANINFO)
        hello0_conan_info = ConanInfo.load_file(hello0_info)
        self.assertEqual("language=0\nstatic=True", hello0_conan_info.options.dumps())

        package_ref1 = PackageReference(ConanFileReference.loads("Hello1/[email protected]/stable"),
                                        "3eeab577a3134fa3afdcd82881751789ec48e08f")
        hello1 = self.client.paths.package(package_ref1)
        hello1_info = os.path.join(hello1, CONANINFO)
        hello1_conan_info = ConanInfo.load_file(hello1_info)
        self.assertEqual("language=1\nstatic=True", hello1_conan_info.options.dumps())
开发者ID:JustgeekDE,项目名称:conan,代码行数:28,代码来源:install_test.py

示例2: reuse_test

# 需要导入模块: from conans.model.info import ConanInfo [as 别名]
# 或者: from conans.model.info.ConanInfo import load_file [as 别名]
    def reuse_test(self):
        self._create("Hello0", "0.1")
        self._create("Hello1", "0.1", ["Hello0/[email protected]/stable"])
        self._create("Hello2", "0.1", ["Hello1/[email protected]/stable"], export=False)

        for lang, id0, id1 in [(0, "2e38bbc2c3ef1425197c8e2ffa8532894c347d26",
                                   "44671ecdd9c606eb7166f2197ab50be8d36a3c3b"),
                               (1, "8b964e421a5b7e48b7bc19b94782672be126be8b",
                                   "3eeab577a3134fa3afdcd82881751789ec48e08f")]:

            self.client.run("install -o language=%d %s --build missing" % (lang, self.settings))
            info_path = os.path.join(self.client.current_folder, CONANINFO)
            conan_info = ConanInfo.load_file(info_path)
            self.assertEqual("arch=x86\n"
                             "compiler=Visual Studio\n"
                             "compiler.runtime=MD\n"
                             "compiler.version=12\n"
                             "os=Windows",
                             conan_info.settings.dumps())
            self.assertEqual("language=%s\nstatic=True" % lang, conan_info.options.dumps())
            conan_ref = ConanFileReference.loads("Hello0/[email protected]/stable")

            hello0 = self.client.paths.package(PackageReference(conan_ref, id0))
            hello0_info = os.path.join(hello0, CONANINFO)
            hello0_conan_info = ConanInfo.load_file(hello0_info)
            self.assertEqual(lang, hello0_conan_info.options.language)

            package_ref1 = PackageReference(ConanFileReference.loads("Hello1/[email protected]/stable"),
                                            id1)
            hello1 = self.client.paths.package(package_ref1)
            hello1_info = os.path.join(hello1, CONANINFO)
            hello1_conan_info = ConanInfo.load_file(hello1_info)
            self.assertEqual(lang, hello1_conan_info.options.language)
开发者ID:JustgeekDE,项目名称:conan,代码行数:35,代码来源:install_test.py

示例3: change_option_txt_test

# 需要导入模块: from conans.model.info import ConanInfo [as 别名]
# 或者: from conans.model.info.ConanInfo import load_file [as 别名]
    def change_option_txt_test(self):
        self._create("Hello0", "0.1")

        client = TestClient(base_folder=self.client.base_folder)
        files = {CONANFILE_TXT: """[requires]
        Hello0/[email protected]/stable

        [options]
        Hello0:language=1
        """}
        client.save(files)

        client.run("install %s --build missing" % self.settings)
        info_path = os.path.join(client.current_folder, CONANINFO)
        conan_info = ConanInfo.load_file(info_path)
        self.assertEqual("", conan_info.options.dumps())
        self.assertIn("Hello0:language=1", conan_info.full_options.dumps())
        self.assertIn("Hello0/[email protected]/stable:8b964e421a5b7e48b7bc19b94782672be126be8b",
                      conan_info.full_requires.dumps())

        files = {CONANFILE_TXT: """[requires]
        Hello0/[email protected]/stable

        [options]
        Hello0:language=0
        """}
        client.save(files)
        client.run("install %s --build missing" % self.settings)

        info_path = os.path.join(client.current_folder, CONANINFO)
        conan_info = ConanInfo.load_file(info_path)
        self.assertEqual("", conan_info.options.dumps())
        self.assertIn("Hello0:language=0", conan_info.full_options.dumps())
        self.assertIn("Hello0/[email protected]/stable:2e38bbc2c3ef1425197c8e2ffa8532894c347d26",
                      conan_info.full_requires.dumps())
开发者ID:JustgeekDE,项目名称:conan,代码行数:37,代码来源:install_test.py

示例4: upper_option_txt_test

# 需要导入模块: from conans.model.info import ConanInfo [as 别名]
# 或者: from conans.model.info.ConanInfo import load_file [as 别名]
    def upper_option_txt_test(self):
        self._create("Hello0", "0.1", no_config=True)
        self._create("Hello1", "0.1", ["Hello0/[email protected]/stable"], no_config=True)

        files = cpp_hello_conan_files("Hello2", "0.1", ["Hello1/[email protected]/stable"])
        files.pop(CONANFILE)
        files[CONANFILE_TXT] = """[requires]
        Hello1/[email protected]/stable

        [options]
        Hello0:language=1
        Hello1:language=0
        """
        self.client.save(files, clean_first=True)

        self.client.run("install %s --build missing" % self.settings)
        info_path = os.path.join(self.client.current_folder, CONANINFO)
        conan_info = ConanInfo.load_file(info_path)
        self.assertEqual("", conan_info.options.dumps())
        conan_ref = ConanFileReference.loads("Hello0/[email protected]/stable")

        hello0 = self.client.paths.package(PackageReference(conan_ref,
                                           "8b964e421a5b7e48b7bc19b94782672be126be8b"))
        hello0_info = os.path.join(hello0, CONANINFO)
        hello0_conan_info = ConanInfo.load_file(hello0_info)
        self.assertEqual(1, hello0_conan_info.options.language)

        package_ref1 = PackageReference(ConanFileReference.loads("Hello1/[email protected]/stable"),
                                        "44671ecdd9c606eb7166f2197ab50be8d36a3c3b")
        hello1 = self.client.paths.package(package_ref1)
        hello1_info = os.path.join(hello1, CONANINFO)
        hello1_conan_info = ConanInfo.load_file(hello1_info)
        self.assertEqual(0, hello1_conan_info.options.language)
开发者ID:JustgeekDE,项目名称:conan,代码行数:35,代码来源:install_test.py

示例5: _loader

# 需要导入模块: from conans.model.info import ConanInfo [as 别名]
# 或者: from conans.model.info.ConanInfo import load_file [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

示例6: read_conaninfo_profile

# 需要导入模块: from conans.model.info import ConanInfo [as 别名]
# 或者: from conans.model.info.ConanInfo import load_file [as 别名]
def read_conaninfo_profile(current_path):
    conan_info_path = os.path.join(current_path, CONANINFO)
    if not os.path.exists(conan_info_path):
        return None
    existing_info = ConanInfo.load_file(conan_info_path)
    profile = Profile()
    profile.settings = OrderedDict(existing_info.full_settings.as_list())
    profile.options = existing_info.full_options
    profile.env_values = existing_info.env_values
    return profile
开发者ID:19317362,项目名称:conan,代码行数:12,代码来源:profile_loader.py

示例7: upper_option_test

# 需要导入模块: from conans.model.info import ConanInfo [as 别名]
# 或者: from conans.model.info.ConanInfo import load_file [as 别名]
    def upper_option_test(self):
        self._create("Hello0", "0.1", no_config=True)
        self._create("Hello1", "0.1", ["Hello0/[email protected]/stable"], no_config=True)
        self._create("Hello2", "0.1", ["Hello1/[email protected]/stable"], export=False, no_config=True)

        self.client.run("install -o language=1 -o Hello1:language=0 -o Hello0:language=1 %s "
                        "--build missing" % self.settings)
        info_path = os.path.join(self.client.current_folder, CONANINFO)
        conan_info = ConanInfo.load_file(info_path)
        self.assertEqual("language=1\nstatic=True", conan_info.options.dumps())
        conan_ref = ConanFileReference.loads("Hello0/[email protected]/stable")

        hello0 = self.client.paths.package(PackageReference(conan_ref,
                                           "8b964e421a5b7e48b7bc19b94782672be126be8b"))
        hello0_info = os.path.join(hello0, CONANINFO)
        hello0_conan_info = ConanInfo.load_file(hello0_info)
        self.assertEqual(1, hello0_conan_info.options.language)

        package_ref1 = PackageReference(ConanFileReference.loads("Hello1/[email protected]/stable"),
                                        "44671ecdd9c606eb7166f2197ab50be8d36a3c3b")
        hello1 = self.client.paths.package(package_ref1)
        hello1_info = os.path.join(hello1, CONANINFO)
        hello1_conan_info = ConanInfo.load_file(hello1_info)
        self.assertEqual(0, hello1_conan_info.options.language)
开发者ID:JustgeekDE,项目名称:conan,代码行数:26,代码来源:install_test.py

示例8: reuse_test

# 需要导入模块: from conans.model.info import ConanInfo [as 别名]
# 或者: from conans.model.info.ConanInfo import load_file [as 别名]
    def reuse_test(self):
        self._create("Hello0", "0.1")
        self._create("Hello1", "0.1", ["Hello0/[email protected]/stable"])
        self._create("Hello2", "0.1", ["Hello1/[email protected]/stable"], export=False)

        current_folder = self.client.current_folder
        h00 = "2e38bbc2c3ef1425197c8e2ffa8532894c347d26"
        h10 = "44671ecdd9c606eb7166f2197ab50be8d36a3c3b"
        h01 = "8b964e421a5b7e48b7bc19b94782672be126be8b"
        h11 = "3eeab577a3134fa3afdcd82881751789ec48e08f"
        for lang, id0, id1, id2, id3 in [(0, h00, h10, h01, h11),
                                         (1, h01, h11, h00, h10)]:
            self.client.current_folder = os.path.join(current_folder, "lang%dbuild" % lang)
            mkdir(self.client.current_folder)
            self.client.run("install .. -o language=%d %s --build missing" % (lang, self.settings))
            info_path = os.path.join(self.client.current_folder, CONANINFO)
            conan_info = ConanInfo.load_file(info_path)
            self.assertEqual("arch=x86\n"
                             "compiler=Visual Studio\n"
                             "compiler.runtime=MD\n"
                             "compiler.version=12\n"
                             "os=Windows",
                             conan_info.settings.dumps())
            conan_info_text = load(info_path)
            self.assertIn(id0, conan_info_text)
            self.assertIn(id1, conan_info_text)
            self.assertNotIn(id2, conan_info_text)
            self.assertNotIn(id3, conan_info_text)
            self.assertEqual("language=%s\nstatic=True" % lang, conan_info.options.dumps())
            build_cmake = os.path.join(self.client.current_folder, BUILD_INFO_CMAKE)
            build_cmake_text = load(build_cmake)
            self.assertIn(id0, build_cmake_text)
            self.assertIn(id1, build_cmake_text)
            self.assertNotIn(id2, build_cmake_text)
            self.assertNotIn(id3, build_cmake_text)

        # Now test "build" command in subfolders
        for lang, id0, id1, id2, id3 in [(0, h00, h10, h01, h11),
                                         (1, h01, h11, h00, h10)]:
            self.client.current_folder = os.path.join(current_folder, "lang%dbuild" % lang)
            self.client.run("build ..")
            self.assertIn("compiler=Visual Studio", self.client.user_io.out)
            self.assertIn("language=%d" % lang, self.client.user_io.out)
            self.assertNotIn("language=%d" % (not lang), self.client.user_io.out)
开发者ID:JustgeekDE,项目名称:conan,代码行数:46,代码来源:install_subfolder_test.py


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