def load_consumer_conanfile(self, conanfile_path, info_folder, output, deps_info_required=False): """loads a conanfile for local flow: source, imports, package, build """ profile = read_conaninfo_profile( info_folder) or self._client_cache.default_profile cache_settings = self._client_cache.settings.copy() cache_settings.values = profile.settings_values # We are recovering state from captured profile from conaninfo, remove not defined cache_settings.remove_undefined() processed_profile = ProcessedProfile(cache_settings, profile, None) if conanfile_path.endswith(".py"): conanfile = self._loader.load_conanfile( conanfile_path, output, consumer=True, local=True, processed_profile=processed_profile) else: conanfile = self._loader.load_conanfile_txt( conanfile_path, output, processed_profile) load_deps_info(info_folder, conanfile, required=deps_info_required) return conanfile
def load_consumer_conanfile(conanfile_path, current_path, settings, runner, output, default_profile=None, reference=None, deps_cpp_info_required=False): profile = read_conaninfo_profile(current_path) or default_profile if not profile: raise ConanException("Execute 'conan install -g txt' first.") loader = ConanFileLoader(runner, settings, profile) if conanfile_path.endswith(".py"): consumer = not reference conanfile = loader.load_conan(conanfile_path, output, consumer, reference) else: conanfile = loader.load_conan_txt(conanfile_path, output) if deps_cpp_info_required is not None: _load_deps_cpp_info(current_path, conanfile, required=deps_cpp_info_required) return conanfile
def export_pkg(self, conanfile_path, name, channel, source_folder=None, build_folder=None, package_folder=None, install_folder=None, profile_name=None, settings=None, options=None, env=None, force=False, user=None, version=None, cwd=None): settings = settings or [] options = options or [] env = env or [] cwd = cwd or get_cwd() # Checks that info files exists if the install folder is specified if install_folder and not existing_info_files(_make_abs_path(install_folder, cwd)): raise ConanException("The specified install folder doesn't contain '%s' and '%s' " "files" % (CONANINFO, BUILD_INFO)) conanfile_path = _get_conanfile_path(conanfile_path, cwd, py=True) if package_folder: if build_folder or source_folder: raise ConanException("package folder definition incompatible with build and source folders") package_folder = _make_abs_path(package_folder, cwd) build_folder = _make_abs_path(build_folder, cwd) install_folder = _make_abs_path(install_folder, cwd, default=build_folder) source_folder = _make_abs_path(source_folder, cwd, default=os.path.dirname(conanfile_path)) # Checks that no both settings and info files are specified if install_folder and existing_info_files(install_folder) and \ (profile_name or settings or options or env): raise ConanException("%s and %s are found, at '%s' folder, so specifying profile, " "settings, options or env is not allowed" % (CONANINFO, BUILD_INFO, install_folder)) infos_present = existing_info_files(install_folder) if not infos_present: profile = profile_from_args(profile_name, settings, options, env=env, cwd=cwd, client_cache=self._client_cache) else: profile = read_conaninfo_profile(install_folder) conanfile = load_conanfile_class(conanfile_path) if (name and conanfile.name and conanfile.name != name) or \ (version and conanfile.version and conanfile.version != version): raise ConanException("Specified name/version doesn't match with the " "name/version in the conanfile") cmd_export(conanfile_path, name, version, user, channel, False, self._user_io.out, self._client_cache) if not (name and version): name = conanfile.name version = conanfile.version reference = ConanFileReference(name, version, user, channel) recorder = ActionRecorder() manager = self._init_manager(recorder) manager.export_pkg(reference, source_folder=source_folder, build_folder=build_folder, package_folder=package_folder, install_folder=install_folder, profile=profile, force=force)
def _get_profile(self, profile_name, settings, options, env, cwd, install_folder): infos_present = existing_info_files(install_folder) if not infos_present: profile = profile_from_args(profile_name, settings, options, env=env, scope=None, cwd=cwd, client_cache=self._client_cache) else: profile = read_conaninfo_profile(install_folder) return profile
def load_consumer_conanfile(self, conanfile_path, current_path, output, reference=None, deps_cpp_info_required=False): profile = read_conaninfo_profile(current_path) or self._client_cache.default_profile loader = self.get_loader(profile) if conanfile_path.endswith(".py"): consumer = not reference conanfile = loader.load_conan(conanfile_path, output, consumer, reference) else: conanfile = loader.load_conan_txt(conanfile_path, output) if deps_cpp_info_required is not None: _load_deps_cpp_info(current_path, conanfile, required=deps_cpp_info_required) return conanfile
def _load_consumer_conanfile(self, conanfile_path, info_folder, output, deps_info_required=False): """loads a conanfile for local flow: source, imports, package, build """ profile = read_conaninfo_profile(info_folder) or self._client_cache.default_profile loader = self.get_loader(profile, local=True) if conanfile_path.endswith(".py"): conanfile = loader.load_conan(conanfile_path, output, consumer=True, local=True) else: conanfile = loader.load_conan_txt(conanfile_path, output) _load_deps_info(info_folder, conanfile, required=deps_info_required) return conanfile
def _info_get_profile(self, reference, install_folder, profile_name, settings, options, env): cwd = os.getcwd() try: reference = ConanFileReference.loads(reference) except ConanException: reference = _get_conanfile_path(reference, cwd=None, py=None) if install_folder or not (profile_name or settings or options or env): # When not install folder is specified but neither any setting, we try to read the # info from cwd install_folder = _make_abs_path(install_folder, cwd) if existing_info_files(install_folder): return reference, read_conaninfo_profile(install_folder) return reference, profile_from_args(profile_name, settings, options, env=env, cwd=cwd, client_cache=self._client_cache)
def load_consumer_conanfile(conanfile_path, current_path, settings, runner, output, reference=None, error=False): profile = read_conaninfo_profile(current_path) loader = ConanFileLoader(runner, settings, profile) if conanfile_path.endswith(".py"): consumer = not reference conanfile = loader.load_conan(conanfile_path, output, consumer, reference) else: conanfile = loader.load_conan_txt(conanfile_path, output) if error is not None: _load_info_file(current_path, conanfile, output, error) return conanfile