def _package_conanfile(self, conan_ref, conan_file, package_reference, build_folder, package_folder, output): """Generate the info txt files and calls the conanfile package method""" # FIXME: Is weak to assign here the recipe_hash conan_file.info.recipe_hash = self._client_cache.load_manifest( conan_ref).summary_hash # Creating ***info.txt files save(os.path.join(build_folder, CONANINFO), conan_file.info.dumps()) output.info("Generated %s" % CONANINFO) save(os.path.join(build_folder, BUILD_INFO), TXTGenerator(conan_file).content) output.info("Generated %s" % BUILD_INFO) save(os.path.join(build_folder, CONANENV), ConanEnvGenerator(conan_file).content) output.info("Generated %s" % CONANENV) os.chdir(build_folder) if getattr(conan_file, 'no_copy_source', False): source_folder = self._client_cache.source(package_reference.conan, conan_file.short_paths) else: source_folder = build_folder with environment_append(conan_file.env): create_package(conan_file, source_folder, build_folder, package_folder, output, False) self._remote_proxy.handle_package_manifest(package_reference, installed=True)
def _build_node(self, conan_ref, conan_file, build_mode): # Compute conan_file package from local (already compiled) or from remote output = ScopedOutput(str(conan_ref), self._out) package_id = conan_file.info.package_id() package_reference = PackageReference(conan_ref, package_id) check_outdated = build_mode == "outdated" conan_ref = package_reference.conan package_folder = self._client_cache.package(package_reference, conan_file.short_paths) build_folder = self._client_cache.build(package_reference, conan_file.short_paths) src_folder = self._client_cache.source(conan_ref, conan_file.short_paths) export_folder = self._client_cache.export(conan_ref) # If already exists do not dirt the output, the common situation # is that package is already installed and OK. If don't, the proxy # will print some other message about it if not os.path.exists(package_folder): output.info("Installing package %s" % package_id) self._handle_system_requirements(conan_ref, package_reference, conan_file, output) force_build = self._build_forced(conan_ref, build_mode, conan_file) if self._remote_proxy.get_package(package_reference, force_build, short_paths=conan_file.short_paths, check_outdated=check_outdated): return # we need and can build? Only if we are forced or build_mode missing and package not exists # Option "--build outdated" means: missing or outdated, so don't care if it's really oudated # just build it. build = force_build or build_mode is True or check_outdated or conan_file.build_policy_missing if build: if not force_build and not build_mode: output.info( "Building package from source as defined by build_policy='missing'" ) try: rmdir(build_folder) rmdir(package_folder) except Exception as e: raise ConanException( "%s\n\nCouldn't remove folder, might be busy or open\n" "Close any app using it, and retry" % str(e)) if force_build: output.warn('Forced build from source') with environment_append(conan_file.env): self._build_package(export_folder, src_folder, build_folder, conan_file, output) # FIXME: Is weak to assign here the recipe_hash conan_file.info.recipe_hash = self._client_cache.load_manifest( conan_ref).summary_hash # Creating ***info.txt files save(os.path.join(build_folder, CONANINFO), conan_file.info.dumps()) output.info("Generated %s" % CONANINFO) save(os.path.join(build_folder, BUILD_INFO), TXTGenerator(conan_file).content) output.info("Generated %s" % BUILD_INFO) save(os.path.join(build_folder, CONANENV), ConanEnvGenerator(conan_file).content) output.info("Generated %s" % CONANENV) os.chdir(build_folder) with environment_append(conan_file.env): create_package(conan_file, build_folder, package_folder, output) self._remote_proxy.handle_package_manifest(package_reference, installed=True) else: self._raise_package_not_found_error(conan_ref, conan_file)