def _call_package_info(conanfile, package_folder): conanfile.cpp_info = CppInfo(package_folder) conanfile.cpp_info.version = conanfile.version conanfile.cpp_info.description = conanfile.description conanfile.env_info = EnvInfo() conanfile.user_info = UserInfo() # Get deps_cpp_info from upstream nodes public_deps = [ name for name, req in conanfile.requires.items() if not req.private ] conanfile.cpp_info.public_deps = public_deps # Once the node is build, execute package info, so it has access to the # package folder and artifacts with pythonpath( conanfile ): # Minimal pythonpath, not the whole context, make it 50% slower with tools.chdir(package_folder): with conanfile_exception_formatter(str(conanfile), "package_info"): conanfile.package_folder = package_folder conanfile.source_folder = None conanfile.build_folder = None conanfile.install_folder = None conanfile.package_info()
def _call_package_info(self, conanfile, package_folder, ref): conanfile.cpp_info = CppInfo(conanfile.name, package_folder) conanfile.cpp_info.version = conanfile.version conanfile.cpp_info.description = conanfile.description conanfile.env_info = EnvInfo() conanfile.user_info = UserInfo() # Get deps_cpp_info from upstream nodes public_deps = [name for name, req in conanfile.requires.items() if not req.private and not req.override] conanfile.cpp_info.public_deps = public_deps # Once the node is build, execute package info, so it has access to the # package folder and artifacts conan_v2 = get_env(CONAN_V2_MODE_ENVVAR, False) with pythonpath(conanfile) if not conan_v2 else no_op(): # Minimal pythonpath, not the whole context, make it 50% slower with tools.chdir(package_folder): with conanfile_exception_formatter(str(conanfile), "package_info"): conanfile.package_folder = package_folder conanfile.source_folder = None conanfile.build_folder = None conanfile.install_folder = None self._hook_manager.execute("pre_package_info", conanfile=conanfile, reference=ref) conanfile.package_info() if conanfile._conan_dep_cpp_info is None: try: conanfile.cpp_info._raise_incorrect_components_definition( conanfile.name, conanfile.requires) except ConanException as e: raise ConanException("%s package_info(): %s" % (str(conanfile), e)) conanfile._conan_dep_cpp_info = DepCppInfo(conanfile.cpp_info) self._hook_manager.execute("post_package_info", conanfile=conanfile, reference=ref)
def _env_and_python(conanfile): with environment_append(conanfile.env): if get_env(CONAN_V2_MODE_ENVVAR, False): yield else: with pythonpath(conanfile): yield
def _call_package_info(conanfile, package_folder): conanfile.cpp_info = CppInfo(package_folder) conanfile.cpp_info.version = conanfile.version conanfile.cpp_info.description = conanfile.description conanfile.env_info = EnvInfo() conanfile.user_info = UserInfo() # Get deps_cpp_info from upstream nodes public_deps = [name for name, req in conanfile.requires.items() if not req.private] conanfile.cpp_info.public_deps = public_deps # Once the node is build, execute package info, so it has access to the # package folder and artifacts with pythonpath(conanfile): # Minimal pythonpath, not the whole context, make it 50% slower with tools.chdir(package_folder): with conanfile_exception_formatter(str(conanfile), "package_info"): conanfile.package_folder = package_folder conanfile.source_folder = None conanfile.build_folder = None conanfile.install_folder = None conanfile.package_info()
def _call_package_info(self, conanfile, package_folder, ref): conanfile.cpp_info = CppInfo(conanfile.name, package_folder) conanfile.cpp_info.version = conanfile.version conanfile.cpp_info.description = conanfile.description conanfile.env_info = EnvInfo() conanfile.user_info = UserInfo() # Get deps_cpp_info from upstream nodes public_deps = [ name for name, req in conanfile.requires.items() if not req.private and not req.override ] conanfile.cpp_info.public_deps = public_deps # Once the node is build, execute package info, so it has access to the # package folder and artifacts # Minimal pythonpath, not the whole context, make it 50% slower # FIXME Conan 2.0, Remove old ways of reusing python code with pythonpath(conanfile): with tools.chdir(package_folder): with conanfile_exception_formatter(str(conanfile), "package_info"): conanfile.layout.set_base_package_folder(package_folder) conanfile.layout.set_base_source_folder(None) conanfile.layout.set_base_build_folder(None) conanfile.layout.set_base_install_folder(None) self._hook_manager.execute("pre_package_info", conanfile=conanfile, reference=ref) conanfile.package_info() if conanfile._conan_dep_cpp_info is None: try: conanfile.cpp_info._raise_incorrect_components_definition( conanfile.name, conanfile.requires) except ConanException as e: raise ConanException("%s package_info(): %s" % (str(conanfile), e)) conanfile._conan_dep_cpp_info = DepCppInfo( conanfile.cpp_info) self._hook_manager.execute("post_package_info", conanfile=conanfile, reference=ref)
def _env_and_python(conanfile): with environment_append(conanfile.env): with pythonpath(conanfile): yield
def _call_package_info(self, conanfile, package_folder, ref, is_editable): conanfile.cpp_info = CppInfo(conanfile.name, package_folder) conanfile.cpp_info.version = conanfile.version conanfile.cpp_info.description = conanfile.description conanfile.env_info = EnvInfo() conanfile.user_info = UserInfo() # Get deps_cpp_info from upstream nodes public_deps = [ name for name, req in conanfile.requires.items() if not req.private and not req.override ] conanfile.cpp_info.public_deps = public_deps # Once the node is build, execute package info, so it has access to the # package folder and artifacts # Minimal pythonpath, not the whole context, make it 50% slower # FIXME Conan 2.0, Remove old ways of reusing python code with pythonpath(conanfile): with tools.chdir(package_folder): with conanfile_exception_formatter(str(conanfile), "package_info"): self._hook_manager.execute("pre_package_info", conanfile=conanfile, reference=ref) if hasattr(conanfile, "layout"): # Old cpp info without defaults (the defaults are in the new one) conanfile.cpp_info = CppInfo( conanfile.name, package_folder, default_values=CppInfoDefaultValues()) if not is_editable: conanfile.cpp.package.set_relative_base_folder( conanfile.package_folder) # Copy the infos.package into the old cppinfo fill_old_cppinfo(conanfile.cpp.package, conanfile.cpp_info) else: conanfile.cpp_info.filter_empty = False conanfile.package_info() if hasattr(conanfile, "layout") and is_editable: # Adjust the folders of the layout to consolidate the rootfolder of the # cppinfos inside # convert directory entries to be relative to the declared folders.build conanfile.cpp.build.set_relative_base_folder( conanfile.build_folder) # convert directory entries to be relative to the declared folders.source conanfile.cpp.source.set_relative_base_folder( conanfile.source_folder) full_editable_cppinfo = NewCppInfo() full_editable_cppinfo.merge(conanfile.cpp.source) full_editable_cppinfo.merge(conanfile.cpp.build) # Paste the editable cpp_info but prioritizing it, only if a # variable is not declared at build/source, the package will keep the value fill_old_cppinfo(full_editable_cppinfo, conanfile.cpp_info) if conanfile._conan_dep_cpp_info is None: try: if not is_editable and not hasattr( conanfile, "layout"): # FIXME: The default for the cppinfo from build are not the same # so this check fails when editable # FIXME: Remove when new cppinfo model. If using the layout method # the cppinfo object is filled from self.cpp.package new # model and we cannot check if the defaults have been modified # because it doesn't exist in the new model where the defaults # for the components are always empty conanfile.cpp_info._raise_incorrect_components_definition( conanfile.name, conanfile.requires) except ConanException as e: raise ConanException("%s package_info(): %s" % (str(conanfile), e)) conanfile._conan_dep_cpp_info = DepCppInfo( conanfile.cpp_info) self._hook_manager.execute("post_package_info", conanfile=conanfile, reference=ref)
def _env_and_python(conanfile): with environment_append(conanfile.env): # FIXME Conan 2.0, Remove old ways of reusing python code with pythonpath(conanfile): yield