コード例 #1
0
 def new_cpp_info(self):
     if not self._conan_new_cpp_info:
         self._conan_new_cpp_info = from_old_cppinfo(self.cpp_info)
         # The new_cpp_info will be already absolute paths if layout() is defined
         if self.package_folder is not None:  # to not crash when editable and layout()
             self._conan_new_cpp_info.set_relative_base_folder(
                 self.package_folder)
     return self._conan_new_cpp_info
コード例 #2
0
def test_from_old_cppinfo_no_components():
    oldcppinfo = CppInfo("ref", "/root/")
    oldcppinfo.requires = ["my_req::my_component"]
    for n in _DIRS_VAR_NAMES + _FIELD_VAR_NAMES:
        setattr(oldcppinfo, n, ["var_{}_1".format(n), "var_{}_2".format(n)])

    oldcppinfo.build_modules = {
        "cmake_find_package": ["my_scripts.cmake", "foo.cmake"],
        "cmake_find_package_multi": ["my_scripts.cmake", "foo2.cmake"]
    }

    cppinfo = from_old_cppinfo(oldcppinfo)

    assert isinstance(cppinfo, NewCppInfo)

    for n in _DIRS_VAR_NAMES + _FIELD_VAR_NAMES:
        assert getattr(cppinfo,
                       n) == ["var_{}_1".format(n), "var_{}_2".format(n)]

    assert cppinfo.get_property("cmake_build_modules") is None
    assert cppinfo.requires == ["my_req::my_component"]
コード例 #3
0
def test_from_old_cppinfo_components():
    oldcppinfo = CppInfo("ref", "/root/")
    for n in _DIRS_VAR_NAMES + _FIELD_VAR_NAMES:
        setattr(oldcppinfo.components["foo"], n,
                ["var_{}_1".format(n), "var_{}_2".format(n)])
        setattr(oldcppinfo.components["foo2"], n,
                ["var2_{}_1".format(n), "var2_{}_2".format(n)])
    oldcppinfo.components["foo"].requires = ["my_req::my_component"]

    # The names and filenames are not copied to the new model
    oldcppinfo.components["foo"].names["Gen"] = ["MyName"]
    oldcppinfo.filenames["Gen"] = ["Myfilename"]
    oldcppinfo.components["foo"].build_modules = \
        {"cmake_find_package_multi": ["foo_my_scripts.cmake"],
         "cmake_find_package": ["foo.cmake"]}
    oldcppinfo.components["foo2"].build_modules = \
        {"cmake_find_package_multi": ["foo2_my_scripts.cmake"]}

    cppinfo = from_old_cppinfo(oldcppinfo)

    assert isinstance(cppinfo, NewCppInfo)

    for n in _DIRS_VAR_NAMES + _FIELD_VAR_NAMES:
        assert getattr(cppinfo.components["foo"],
                       n) == ["var_{}_1".format(n), "var_{}_2".format(n)]
        assert getattr(cppinfo.components["foo2"],
                       n) == ["var2_{}_1".format(n), "var2_{}_2".format(n)]

    # The .build_modules are assigned to the root cppinfo because it is something
    # global that make no sense to set as a component property
    assert cppinfo.components["foo"].get_property(
        "cmake_build_modules") is None
    assert cppinfo.components["foo"].requires == ["my_req::my_component"]
    assert cppinfo.components["foo2"].get_property(
        "cmake_build_modules") is None

    assert cppinfo.get_property("cmake_build_modules") == \
           ["foo_my_scripts.cmake", "foo.cmake", "foo2_my_scripts.cmake"]
コード例 #4
0
 def new_cpp_info(self):
     if not self._conan_new_cpp_info:
         self._conan_new_cpp_info = from_old_cppinfo(self.cpp_info)
     return self._conan_new_cpp_info
コード例 #5
0
ファイル: conan_file.py プロジェクト: bjoernrennfanz/conan
 def new_cpp_info(self):
     if not self._conan_new_cpp_info:
         self._conan_new_cpp_info = from_old_cppinfo(self.cpp_info)
         self._conan_new_cpp_info.set_relative_base_folder(self.package_folder)
     return self._conan_new_cpp_info