Install APIΒΆ
Warning
This feature is experimental and subject to breaking changes. See the Conan stability section for more information.
Warning
Subapis must not be initialized by themselves. They are intended to be accessed only through the main ConanAPI attributes.
- class InstallAPI(conan_api, helpers)ΒΆ
This is the InstallAPI.
It provides methods to install binaries, sources, prepare the consumer folder with generators and deploy, etc., all of them based on an already resolved dependency graph.
- install_binaries(deps_graph, remotes: List[Remote] = None, return_install_error=False)ΒΆ
Install binaries of a dependency graph.
This is the equivalent to the
conan installcommand, but working with an already resolved dependency graph, usually obtained from the correspondingGraphAPImethods.It will download the available packages from the given remotes, and then build the ones that were marked for build from source.
System requirements will be installed as well, taking into account the
tools.system.package_manager:modeconf to determine whether to install, check or skip them.- Parameters:
deps_graph β Dependency graph to install packages for
remotes β List of remotes to fetch packages from if necessary.
return_install_error β If
True, do not raise an exception, but return it
- install_system_requires(graph, only_info=False)ΒΆ
Install only the system requirements of a dependency graph.
This is a subset of
install_binarieswhich only deals with system requirements of an already resolved dependency graph, usually obtained from the correspondingGraphAPImethods.The
tools.system.package_manager:modeconf will be taken into account to determine whether to install, check or skip system requirements.- Parameters:
graph β Dependency graph to install system requirements for
only_info β If
True, only reporting and checking of whether the system requirements are installed is performed.
- install_sources(graph, remotes: List[Remote])ΒΆ
Download sources in the given dependency graph.
If the
tools.build:download_sourceconf isTrue, sources will be downloaded for every package in the graph, otherwise only the packages marked for build from source will have their sources downloaded.tools.build:download_source=Trueis useful when users want to inspect the source code of all dependencies, even the ones that are not built from source.After this method, the
conanfile.source_folderon each node of the dependency graph for which the sources have been downloaded will be set to the folder where sources have been downloaded.- Parameters:
remotes β List of remotes where the
exports_sourcesof the packages might be locatedgraph β Dependency graph to download sources from
- install_consumer(deps_graph, generators: List[str] = None, source_folder=None, output_folder=None, deploy=False, deploy_package: List[str] = None, deploy_folder=None, envs_generation=None)ΒΆ
Prepare the folder of the root consumer of a dependency graph after installation of the dependencies.
This ensures that the requested generators are created in the consumer folder, and also handles deployment if requested.
- Parameters:
deps_graph β Dependency graph whose root is the consumer we want to prepare
generators β List of generators to be used in addition to the ones defined in the root conanfile, if any
source_folder β Source folder of the consumer
output_folder β Output folder of the consumer
deploy β Deployer or list of deployers to be used for deployment
deploy_package β Only deploy the packages matching these patterns (
Noneor empty for all)deploy_folder β Folder where to deploy, by default the build folder
envs_generation β Anything other than
Nonewill activate the generation of virtual environment files for the root conanfile
- deploy(graph, deployer: List[str], deploy_package: List[str] = None, deploy_folder=None) NoneΒΆ
Run the given deployer in the dependency graph.
No checks are performed in the graph, it is assumed to be already resolved and in a valid state to be deployed from.
- Parameters:
graph β The dependency graph to deploy
deployer β List of deployers to be used
deploy_package β Only deploy the packages matching these patterns (
Noneor empty for all)deploy_folder β Folder where to deploy, by default the build folder