本文整理汇总了Python中conans.client.output.ScopedOutput.info方法的典型用法代码示例。如果您正苦于以下问题:Python ScopedOutput.info方法的具体用法?Python ScopedOutput.info怎么用?Python ScopedOutput.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类conans.client.output.ScopedOutput
的用法示例。
在下文中一共展示了ScopedOutput.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_package
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def get_package(self, package_ref, short_paths):
""" obtain a package, either from disk or retrieve from remotes if necessary
and not necessary to build
"""
output = ScopedOutput(str(package_ref.conan), self._out)
package_folder = self._client_cache.package(package_ref, short_paths=short_paths)
# Check current package status
if os.path.exists(package_folder):
if self._check_updates:
read_manifest = self._client_cache.load_package_manifest(package_ref)
try: # get_conan_digest can fail, not in server
upstream_manifest = self.get_package_digest(package_ref)
if upstream_manifest != read_manifest:
if upstream_manifest.time > read_manifest.time:
output.warn("Current package is older than remote upstream one")
if self._update:
output.warn("Removing it to retrieve or build an updated one")
rmdir(package_folder)
else:
output.warn("Current package is newer than remote upstream one")
except ConanException:
pass
installed = False
local_package = os.path.exists(package_folder)
if local_package:
output.info('Already installed!')
installed = True
log_package_got_from_local_cache(package_ref)
else:
installed = self._retrieve_remote_package(package_ref, package_folder,
output)
self.handle_package_manifest(package_ref, installed)
return installed
示例2: package_available
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def package_available(self, package_ref, package_folder, check_outdated):
"""
Returns True if there is a local or remote package available (and up to date if check_outdated).
It wont download the package, just check its hash
"""
output = ScopedOutput(str(package_ref.conan), self._out)
remote_info = None
# No package in local cache
if not os.path.exists(package_folder):
try:
remote_info = self.get_package_info(package_ref)
except (NotFoundException, NoRemoteAvailable): # 404 or no remote
return False
# Maybe we have the package (locally or in remote) but it's outdated
if check_outdated:
if remote_info:
package_hash = remote_info.recipe_hash
else:
package_hash = self._client_cache.read_package_recipe_hash(package_folder)
local_recipe_hash = self._client_cache.load_manifest(package_ref.conan).summary_hash
up_to_date = local_recipe_hash == package_hash
if not up_to_date:
output.info("Outdated package!")
else:
output.info("Package is up to date")
return up_to_date
return True
示例3: get_recipe
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def get_recipe(self, conan_reference):
output = ScopedOutput(str(conan_reference), self._out)
def _refresh():
export_path = self._client_cache.export(conan_reference)
rmdir(export_path)
# It might need to remove shortpath
rm_conandir(self._client_cache.source(conan_reference))
current_remote, _ = self._get_remote(conan_reference)
output.info("Retrieving from remote '%s'..." % current_remote.name)
self._remote_manager.get_recipe(conan_reference, export_path, current_remote)
if self._update:
output.info("Updated!")
else:
output.info("Installed!")
# check if it is in disk
conanfile_path = self._client_cache.conanfile(conan_reference)
if os.path.exists(conanfile_path):
log_recipe_got_from_local_cache(conan_reference)
if self._check_updates:
ret = self.update_available(conan_reference)
if ret != 0: # Found and not equal
remote, ref_remote = self._get_remote(conan_reference)
if ret == 1:
if not self._update:
if remote != ref_remote: # Forced new remote
output.warn("There is a new conanfile in '%s' remote. "
"Execute 'install -u -r %s' to update it."
% (remote.name, remote.name))
else:
output.warn("There is a new conanfile in '%s' remote. "
"Execute 'install -u' to update it."
% remote.name)
output.warn("Refused to install!")
else:
if remote != ref_remote:
# Delete packages, could be non coherent with new remote
DiskRemover(self._client_cache).remove_packages(conan_reference)
_refresh()
elif ret == -1:
if not self._update:
output.info("Current conanfile is newer "
"than %s's one" % remote.name)
else:
output.error("Current conanfile is newer than %s's one. "
"Run 'conan remove %s' and run install again "
"to replace it." % (remote.name, conan_reference))
else:
self._retrieve_recipe(conan_reference, output)
if self._manifest_manager:
# Just make sure that the recipe sources are there to check
self.get_recipe_sources(conan_reference)
remote = self._registry.get_ref(conan_reference)
self._manifest_manager.check_recipe(conan_reference, remote)
return conanfile_path
示例4: get_conanfile
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def get_conanfile(self, conan_reference):
output = ScopedOutput(str(conan_reference), self._out)
def _refresh():
conan_dir_path = self._paths.export(conan_reference)
rmdir(conan_dir_path)
rmdir(self._paths.source(conan_reference), True) # It might need to remove shortpath
current_remote, _ = self._get_remote(conan_reference)
output.info("Retrieving from remote '%s'..." % current_remote.name)
self._remote_manager.get_conanfile(conan_reference, current_remote)
if self._update:
output.info("Updated!")
else:
output.info("Installed!")
# check if it is in disk
conanfile_path = self._paths.conanfile(conan_reference)
path_exist = path_exists(conanfile_path, self._paths.store)
if path_exist:
if self._check_integrity: # Check if package is corrupted
read_manifest, expected_manifest = self._paths.conan_manifests(conan_reference)
if read_manifest.file_sums != expected_manifest.file_sums:
output.warn("Bad conanfile detected! Removing export directory... ")
_refresh()
else: # Check for updates
if self._check_updates:
ret = self.update_available(conan_reference)
if ret != 0: # Found and not equal
remote, ref_remote = self._get_remote(conan_reference)
if ret == 1:
if not self._update:
if remote != ref_remote: # Forced new remote
output.warn("There is a new conanfile in '%s' remote. "
"Execute 'install -u -r %s' to update it."
% (remote.name, remote.name))
else:
output.warn("There is a new conanfile in '%s' remote. "
"Execute 'install -u' to update it."
% remote.name)
output.warn("Refused to install!")
else:
if remote != ref_remote:
# Delete packages, could be non coherent with new remote
rmdir(self._paths.packages(conan_reference))
_refresh()
elif ret == -1:
if not self._update:
output.info("Current conanfile is newer "
"than %s's one" % remote.name)
else:
output.error("Current conanfile is newer than %s's one. "
"Run 'conan remove %s' and run install again "
"to replace it." % (remote.name, conan_reference))
else:
self._retrieve_conanfile(conan_reference, output)
return conanfile_path
示例5: install
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def install(self, reference, current_path, remote=None, options=None, settings=None,
build_mode=False, filename=None, update=False, check_updates=False,
integrity=False, scopes=None, generators=None):
""" Fetch and build all dependencies for the given reference
@param reference: ConanFileReference or path to user space conanfile
@param current_path: where the output files will be saved
@param remote: install only from that remote
@param options: list of tuples: [(optionname, optionvalue), (optionname, optionvalue)...]
@param settings: list of tuples: [(settingname, settingvalue), (settingname, value)...]
"""
generators = generators or []
objects = self._get_graph(reference, current_path, remote, options, settings, filename,
update, check_updates, integrity, scopes)
(_, deps_graph, _, registry, conanfile, remote_proxy, loader) = objects
Printer(self._user_io.out).print_graph(deps_graph, registry)
# Warn if os doesn't match
try:
if detected_os() != loader._settings.os:
message = '''You are building this package with settings.os='%s' on a '%s' system.
If this is your intention, you can ignore this message.
If not:
- Check the passed settings (-s)
- Check your global settings in ~/.conan/conan.conf
- Remove conaninfo.txt to avoid bad cached settings
''' % (loader._settings.os, detected_os())
self._user_io.out.warn(message)
except ConanException: # Setting os doesn't exist
pass
installer = ConanInstaller(self._paths, self._user_io, remote_proxy)
installer.install(deps_graph, build_mode)
scope_prefix = "PROJECT" if not isinstance(reference, ConanFileReference) else str(reference)
output = ScopedOutput(scope_prefix, self._user_io.out)
# Write generators
tmp = list(conanfile.generators) # Add the command line specified generators
tmp.extend(generators)
conanfile.generators = tmp
write_generators(conanfile, current_path, output)
if not isinstance(reference, ConanFileReference):
content = normalize(conanfile.info.dumps())
save(os.path.join(current_path, CONANINFO), content)
output.info("Generated %s" % CONANINFO)
local_installer = FileImporter(deps_graph, self._paths, current_path)
conanfile.copy = local_installer
conanfile.imports()
copied_files = local_installer.execute()
import_output = ScopedOutput("%s imports()" % output.scope, output)
report_copied_files(copied_files, import_output)
示例6: forced
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def forced(self, reference, conanfile):
if self.all:
return True
if conanfile.build_policy_always:
out = ScopedOutput(str(reference), self._out)
out.info("Building package from source as defined by build_policy='always'")
return True
ref = reference.name
# Patterns to match, if package matches pattern, build is forced
force_build = any([fnmatch.fnmatch(ref, pattern) for pattern in self.patterns])
return force_build
示例7: _build_forced
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def _build_forced(self, conan_ref, build_mode, conan_file):
if conan_file.build_policy_always:
out = ScopedOutput(str(conan_ref), self._out)
out.info("Building package from source as defined by build_policy='always'")
return True
if build_mode is False: # "never" option, default
return False
if build_mode is True: # Build missing (just if needed), not force
return False
# Patterns to match, if package matches pattern, build is forced
force_build = any([fnmatch.fnmatch(str(conan_ref), pattern)
for pattern in build_mode])
return force_build
示例8: package
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def package(self, reference, package_id):
# Package paths
conan_file_path = self._client_cache.conanfile(reference)
if not os.path.exists(conan_file_path):
raise ConanException("Package recipe '%s' does not exist" % str(reference))
conanfile = load_conanfile_class(conan_file_path)
if hasattr(conanfile, "build_id"):
raise ConanException("package command does not support recipes with 'build_id'\n"
"To repackage them use 'conan install'")
if not package_id:
packages = [PackageReference(reference, packid)
for packid in self._client_cache.conan_builds(reference)]
if not packages:
raise NotFoundException("%s: Package recipe has not been built locally\n"
"Please read the 'conan package' command help\n"
"Use 'conan install' or 'conan test_package' to build and "
"create binaries" % str(reference))
else:
packages = [PackageReference(reference, package_id)]
package_source_folder = self._client_cache.source(reference, conanfile.short_paths)
for package_reference in packages:
build_folder = self._client_cache.build(package_reference, short_paths=None)
if not os.path.exists(build_folder):
raise NotFoundException("%s: Package binary '%s' folder doesn't exist\n"
"Please read the 'conan package' command help\n"
"Use 'conan install' or 'conan test_package' to build and "
"create binaries"
% (str(reference), package_reference.package_id))
# The package already exist, we can use short_paths if they were defined
package_folder = self._client_cache.package(package_reference, short_paths=None)
# Will read current conaninfo with specified options and load conanfile with them
output = ScopedOutput(str(reference), self._user_io.out)
output.info("Re-packaging %s" % package_reference.package_id)
conanfile = load_consumer_conanfile(conan_file_path, build_folder,
self._client_cache.settings,
self._runner, output, reference)
rmdir(package_folder)
if getattr(conanfile, 'no_copy_source', False):
source_folder = package_source_folder
else:
source_folder = build_folder
with environment_append(conanfile.env):
packager.create_package(conanfile, source_folder, build_folder, package_folder,
output)
示例9: source
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def source(self, conanfile_path, source_folder, info_folder):
"""
:param conanfile_path: Absolute path to a conanfile
:param source_folder: Absolute path where to put the files
:param info_folder: Absolute path where to read the info files
:param package_folder: Absolute path to the package_folder, only to have the var present
:return:
"""
output = ScopedOutput("PROJECT", self._user_io.out)
# only infos if exist
conanfile = self._load_consumer_conanfile(conanfile_path, info_folder, output)
conanfile_folder = os.path.dirname(conanfile_path)
if conanfile_folder != source_folder:
output.info("Executing exports to: %s" % source_folder)
_execute_export(conanfile_path, conanfile, source_folder,
source_folder, output)
config_source_local(source_folder, conanfile, output)
示例10: retrieve_conanfile
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def retrieve_conanfile(self, conan_reference, consumer=False):
""" returns the requested conanfile object, retrieving it from
remotes if necessary. Can raise NotFoundException
"""
output = ScopedOutput(str(conan_reference), self._out)
conanfile_path = self._paths.conanfile(conan_reference)
if not self._paths.valid_conan_digest(conan_reference):
conan_dir_path = self._paths.export(conan_reference)
if path_exists(conan_dir_path, self._paths.store):
# If not valid conanfile, ensure empty folder
output.warn("Bad conanfile detected! Removing export directory... ")
rmdir(conan_dir_path)
output.info("Conanfile not found, retrieving from server")
# If not in localhost, download it. Will raise if not found
self._remote_manager.get_conanfile(conan_reference, self._remote)
conanfile = self._loader.load_conan(conanfile_path, output, consumer)
return conanfile
示例11: _build_node
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
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)
conan_ref = package_reference.conan
package_folder = self._paths.package(package_reference, conan_file.short_paths)
build_folder = self._paths.build(package_reference, conan_file.short_paths)
src_folder = self._paths.source(conan_ref, conan_file.short_paths)
export_folder = self._paths.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 package_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):
return
# we need and can build? Only if we are forced or build_mode missing and package not exists
build = force_build or build_mode is True 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, conan_file.short_paths)
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')
self._build_package(export_folder, src_folder, build_folder, package_folder,
conan_file, output)
# 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)
os.chdir(build_folder)
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)
示例12: get_package
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def get_package(self, package_reference, force_build):
""" obtain a package, either from disk or retrieve from remotes if necessary
and not necessary to build
"""
output = ScopedOutput(str(package_reference.conan), self._out)
package_folder = self._paths.package(package_reference)
# Check current package status
if path_exists(package_folder, self._paths.store):
if self._check_integrity or self._check_updates:
read_manifest, expected_manifest = self._paths.package_manifests(package_reference)
if self._check_integrity: # Check if package is corrupted
if read_manifest.file_sums != expected_manifest.file_sums:
# If not valid package, ensure empty folder
output.warn("Bad package '%s' detected! Removing "
"package directory... " % str(package_reference.package_id))
rmdir(package_folder)
if self._check_updates:
try: # get_conan_digest can fail, not in server
upstream_manifest = self.get_package_digest(package_reference)
if upstream_manifest.file_sums != read_manifest.file_sums:
if upstream_manifest.time > read_manifest.time:
output.warn("Current package is older than remote upstream one")
if self._update:
output.warn("Removing it to retrieve or build an updated one")
rmdir(package_folder)
else:
output.warn("Current package is newer than remote upstream one")
except ConanException:
pass
if not force_build:
local_package = os.path.exists(package_folder)
if local_package:
output = ScopedOutput(str(package_reference.conan), self._out)
output.info('Already installed!')
return True
return self._retrieve_remote_package(package_reference, output)
return False
示例13: _get_package
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def _get_package(self, conan_ref, conan_file):
'''Get remote package. It won't check if it's outdated'''
# 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)
conan_ref = package_reference.conan
package_folder = self._client_cache.package(package_reference, conan_file.short_paths)
# 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)
if self._remote_proxy.get_package(package_reference, short_paths=conan_file.short_paths):
self._handle_system_requirements(conan_ref, package_reference, conan_file, output)
return True
self._raise_package_not_found_error(conan_ref, conan_file)
示例14: _compute_private_nodes
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def _compute_private_nodes(self, deps_graph, build_mode):
""" computes a list of nodes that are not required to be built, as they are
private requirements of already available shared libraries as binaries
"""
private_closure = deps_graph.private_nodes()
skippable_nodes = []
for private_node, private_requirers in private_closure:
for private_requirer in private_requirers:
conan_ref, conan_file = private_requirer
if conan_ref is None:
continue
package_id = conan_file.info.package_id()
package_reference = PackageReference(conan_ref, package_id)
package_folder = self._paths.package(package_reference)
if not path_exists(package_folder, self._paths.store):
if not self._force_build(conan_ref, build_mode): # Not download package
output = ScopedOutput(str(conan_ref), self._out)
output.info("Package not installed")
if not self._retrieve_remote_package(package_reference, output):
break
else:
skippable_nodes.append(private_node)
return skippable_nodes
示例15: package
# 需要导入模块: from conans.client.output import ScopedOutput [as 别名]
# 或者: from conans.client.output.ScopedOutput import info [as 别名]
def package(self, reference, package_id):
assert(isinstance(reference, ConanFileReference))
# Package paths
conan_file_path = self._client_cache.conanfile(reference)
if not os.path.exists(conan_file_path):
raise ConanException("Package recipe '%s' does not exist" % str(reference))
if not package_id:
packages = [PackageReference(reference, packid)
for packid in self._client_cache.conan_builds(reference)]
if not packages:
raise NotFoundException("%s: Package recipe has not been built locally\n"
"Please read the 'conan package' command help\n"
"Use 'conan install' or 'conan test_package' to build and "
"create binaries" % str(reference))
else:
packages = [PackageReference(reference, package_id)]
for package_reference in packages:
build_folder = self._client_cache.build(package_reference, short_paths=None)
if not build_exists(build_folder):
raise NotFoundException("%s: Package binary '%s' folder doesn't exist\n"
"Please read the 'conan package' command help\n"
"Use 'conan install' or 'conan test_package' to build and "
"create binaries"
% (str(reference), package_reference.package_id))
# The package already exist, we can use short_paths if they were defined
package_folder = self._client_cache.package(package_reference, short_paths=None)
# Will read current conaninfo with specified options and load conanfile with them
output = ScopedOutput(str(reference), self._user_io.out)
output.info("Re-packaging %s" % package_reference.package_id)
loader = self._loader(build_folder)
conanfile = loader.load_conan(conan_file_path, self._user_io.out)
rmdir(package_folder)
packager.create_package(conanfile, build_folder, package_folder, output)