Skip to content

Commit

Permalink
Merge branch 'develop2' into msbuilddeps-keys
Browse files Browse the repository at this point in the history
  • Loading branch information
vermz99 authored Oct 13, 2024
2 parents 571c1ea + 890f000 commit 6702664
Show file tree
Hide file tree
Showing 183 changed files with 1,167 additions and 883 deletions.
61 changes: 0 additions & 61 deletions .github/stale.yml

This file was deleted.

2 changes: 1 addition & 1 deletion conan/api/conan_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from conan.api.subapi.upload import UploadAPI
from conans.client.migrations import ClientMigrator
from conans.client.userio import init_colorama
from conans.errors import ConanException
from conan.errors import ConanException
from conans.model.version import Version
from conan.internal.paths import get_conan_user_home
from conans.model.version_range import validate_conan_version
Expand Down
3 changes: 2 additions & 1 deletion conan/api/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

from conans.client.graph.graph import RECIPE_EDITABLE, RECIPE_CONSUMER, RECIPE_PLATFORM, \
RECIPE_VIRTUAL, BINARY_SKIP, BINARY_MISSING, BINARY_INVALID
from conans.errors import ConanException, NotFoundException
from conan.internal.errors import NotFoundException
from conan.errors import ConanException
from conans.model.package_ref import PkgReference
from conans.model.recipe_ref import RecipeReference
from conans.util.files import load
Expand Down
2 changes: 1 addition & 1 deletion conan/api/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from colorama import Fore, Style

from conans.client.userio import color_enabled
from conans.errors import ConanException
from conan.errors import ConanException

LEVEL_QUIET = 80 # -q
LEVEL_ERROR = 70 # Errors
Expand Down
2 changes: 1 addition & 1 deletion conan/api/subapi/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from conan.internal.conan_app import ConanApp
from conan.internal.cache.integrity_check import IntegrityChecker
from conans.client.downloaders.download_cache import DownloadCache
from conans.errors import ConanException
from conan.errors import ConanException
from conans.model.package_ref import PkgReference
from conans.model.recipe_ref import RecipeReference
from conans.util.dates import revision_timestamp_now
Expand Down
18 changes: 16 additions & 2 deletions conan/api/subapi/command.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from conans.errors import ConanException
from conan.api.output import ConanOutput
from conan.errors import ConanException


class CommandAPI:
Expand All @@ -20,5 +21,18 @@ def run(self, cmd):
command = commands[current_cmd]
except KeyError:
raise ConanException(f"Command {current_cmd} does not exist")
# Conan has some global state in the ConanOutput class that
# get redefined when running a command and leak to the calling scope
# if running from a custom command.
# Store the old one and restore it after the command execution as a workaround.
_conan_output_level = ConanOutput._conan_output_level
_silent_warn_tags = ConanOutput._silent_warn_tags
_warnings_as_errors = ConanOutput._warnings_as_errors

return command.run_cli(self.conan_api, args)
try:
result = command.run_cli(self.conan_api, args)
finally:
ConanOutput._conan_output_level = _conan_output_level
ConanOutput._silent_warn_tags = _silent_warn_tags
ConanOutput._warnings_as_errors = _warnings_as_errors
return result
2 changes: 1 addition & 1 deletion conan/api/subapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from conans.client.graph.graph import CONTEXT_HOST, RECIPE_VIRTUAL, Node
from conans.client.graph.graph_builder import DepsGraphBuilder
from conans.client.graph.profile_node_definer import consumer_definer
from conans.errors import ConanException
from conan.errors import ConanException
from conans.model.conf import ConfDefinition, BUILT_IN_CONFS
from conans.model.pkg_type import PackageType
from conans.model.recipe_ref import RecipeReference
Expand Down
2 changes: 1 addition & 1 deletion conan/api/subapi/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from conan.api.model import Remote, PackagesList
from conan.api.output import ConanOutput
from conan.internal.conan_app import ConanApp
from conans.errors import ConanException
from conan.errors import ConanException
from conans.model.package_ref import PkgReference
from conans.model.recipe_ref import RecipeReference

Expand Down
2 changes: 1 addition & 1 deletion conan/api/subapi/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from conans.client.graph.graph_binaries import GraphBinariesAnalyzer
from conans.client.graph.graph_builder import DepsGraphBuilder
from conans.client.graph.profile_node_definer import initialize_conanfile_profile, consumer_definer
from conans.errors import ConanException
from conan.errors import ConanException
from conans.model.recipe_ref import RecipeReference


Expand Down
2 changes: 1 addition & 1 deletion conan/api/subapi/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from conans.client.graph.install_graph import InstallGraph
from conans.client.installer import BinaryInstaller
from conans.errors import ConanInvalidConfiguration
from conan.errors import ConanInvalidConfiguration


class InstallAPI:
Expand Down
4 changes: 2 additions & 2 deletions conan/api/subapi/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from conan.internal.api.list.query_parse import filter_package_configs
from conan.internal.conan_app import ConanApp
from conan.internal.paths import CONANINFO
from conans.errors import ConanException, NotFoundException
from conan.internal.errors import NotFoundException
from conan.errors import ConanException
from conans.model.info import load_binary_info
from conans.model.package_ref import PkgReference
from conans.model.recipe_ref import RecipeReference, ref_matches
Expand Down Expand Up @@ -149,7 +150,6 @@ def select(self, pattern, package_query=None, remote=None, lru=None, profile=Non
if search_ref:
refs = self.conan_api.search.recipes(search_ref, remote=remote)
refs = pattern.filter_versions(refs)
refs = sorted(refs) # Order alphabetical and older versions first
pattern.check_refs(refs)
out.info(f"Found {len(refs)} pkg/version recipes matching {search_ref} in {remote_name}")
else:
Expand Down
3 changes: 2 additions & 1 deletion conan/api/subapi/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from conans.client.graph.graph import CONTEXT_HOST
from conans.client.graph.profile_node_definer import initialize_conanfile_profile
from conans.client.source import run_source_method
from conans.errors import ConanException, conanfile_exception_formatter
from conan.internal.errors import conanfile_exception_formatter
from conan.errors import ConanException
from conans.model.recipe_ref import RecipeReference
from conans.util.files import chdir

Expand Down
2 changes: 1 addition & 1 deletion conan/api/subapi/lockfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from conan.api.output import ConanOutput
from conan.cli import make_abs_path
from conans.client.graph.graph import Overrides
from conans.errors import ConanException
from conan.errors import ConanException
from conans.model.graph_lock import Lockfile, LOCKFILE


Expand Down
2 changes: 1 addition & 1 deletion conan/api/subapi/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from jinja2 import Template, StrictUndefined

from conans.errors import ConanException
from conan.errors import ConanException
from conans.util.files import load
from conans import __version__

Expand Down
3 changes: 2 additions & 1 deletion conan/api/subapi/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

from conans.client.loader import load_python_file
from conan.internal.api.profile.profile_loader import ProfileLoader
from conans.errors import ConanException, scoped_traceback
from conan.internal.errors import scoped_traceback
from conan.errors import ConanException
from conans.model.profile import Profile

DEFAULT_PROFILE_NAME = "default"
Expand Down
2 changes: 1 addition & 1 deletion conan/api/subapi/remotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from conans.client.rest_client_local_recipe_index import add_local_recipes_index_remote, \
remove_local_recipes_index_remote
from conan.internal.api.remotes.localdb import LocalDB
from conans.errors import ConanException
from conan.errors import ConanException
from conans.util.files import save, load

CONAN_CENTER_REMOTE_NAME = "conancenter"
Expand Down
12 changes: 2 additions & 10 deletions conan/api/subapi/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,9 @@ def recipes(self, query: str, remote=None):
if remote:
refs = app.remote_manager.search_recipes(remote, query)
else:
references = app.cache.search_recipes(query)
# For consistency with the remote search, we return references without revisions
# user could use further the API to look for the revisions
refs = []
for r in references:
r.revision = None
r.timestamp = None
if r not in refs:
refs.append(r)
refs = app.cache.search_recipes(query)
ret = []
for r in refs:
if not only_none_user_channel or (r.user is None and r.channel is None):
ret.append(r)
return ret
return sorted(ret)
3 changes: 2 additions & 1 deletion conan/api/subapi/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
gather_metadata
from conans.client.pkg_sign import PkgSignaturesPlugin
from conans.client.rest.file_uploader import FileUploader
from conans.errors import ConanException, AuthenticationException, ForbiddenException
from conan.internal.errors import AuthenticationException, ForbiddenException
from conan.errors import ConanException


class UploadAPI:
Expand Down
10 changes: 5 additions & 5 deletions conan/cli/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def add_common_install_arguments(parser):
help='Do not use remote, resolve exclusively in the cache')

update_help = ("Will install newer versions and/or revisions in the local cache "
"for the given reference, or all in case no argument is supplied. "
"for the given reference name, or all references in the graph if no argument is supplied. "
"When using version ranges, it will install the latest version that "
"satisfies the range. Also, if using revisions, it will update to the "
"satisfies the range. It will update to the "
"latest revision for the resolved version range.")

parser.add_argument("-u", "--update", action="append", nargs="?", help=update_help, const="*")
Expand Down Expand Up @@ -96,9 +96,9 @@ def create_config(short, long, example=None):
help="")

create_config("pr", "profile")
create_config("o", "options", "-o pkg:with_qt=true")
create_config("s", "settings", "-s compiler=gcc")
create_config("c", "conf", "-c tools.cmake.cmaketoolchain:generator=Xcode")
create_config("o", "options", '-o="pkg/*:with_qt=True"')
create_config("s", "settings", '-s="compiler=gcc"')
create_config("c", "conf", '-c="tools.cmake.cmaketoolchain:generator=Xcode"')


def add_reference_args(parser):
Expand Down
4 changes: 1 addition & 3 deletions conan/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from conan.internal.cache.home_paths import HomePaths
from conans import __version__ as client_version
from conan.errors import ConanException, ConanInvalidConfiguration, ConanMigrationError
from conans.util.files import exception_message_safe

_CONAN_INTERNAL_CUSTOM_COMMANDS_PATH = "_CONAN_INTERNAL_CUSTOM_COMMANDS_PATH"

Expand Down Expand Up @@ -231,8 +230,7 @@ def exception_exit_error(exception):

assert isinstance(exception, Exception)
output.error(traceback.format_exc(), error_type="exception")
msg = exception_message_safe(exception)
output.error(msg, error_type="exception")
output.error(str(exception), error_type="exception")
return ERROR_UNEXPECTED


Expand Down
2 changes: 1 addition & 1 deletion conan/cli/commands/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from conan.cli import make_abs_path
from conan.cli.command import conan_command, OnceArgument
from conan.cli.commands.list import print_list_text, print_list_json
from conans.errors import ConanException
from conan.errors import ConanException


@conan_command(group="Creator", formatters={"text": print_list_text,
Expand Down
2 changes: 1 addition & 1 deletion conan/cli/commands/export_pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from conan.cli.commands.create import _get_test_conanfile_path
from conan.cli.formatters.graph import format_graph_json
from conan.cli.printers.graph import print_graph_basic
from conans.errors import ConanException
from conan.errors import ConanException


@conan_command(group="Creator", formatters={"json": format_graph_json})
Expand Down
9 changes: 6 additions & 3 deletions conan/cli/commands/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
from conan.cli.formatters.graph import format_graph_html, format_graph_json, format_graph_dot
from conan.cli.formatters.graph.build_order_html import format_build_order_html
from conan.cli.formatters.graph.graph_info_text import format_graph_info
from conan.cli.printers import print_profiles
from conan.cli.printers.graph import print_graph_packages, print_graph_basic
from conan.errors import ConanException
from conan.internal.deploy import do_deploys
from conans.client.graph.graph import BINARY_MISSING
from conans.client.graph.install_graph import InstallGraph
from conans.errors import NotFoundException
from conans.client.graph.install_graph import InstallGraph, ProfileArgs
from conan.internal.errors import NotFoundException
from conans.model.recipe_ref import ref_matches, RecipeReference


Expand Down Expand Up @@ -116,7 +117,8 @@ def graph_build_order(conan_api, parser, subparser, *args):
out = ConanOutput()
out.title("Computing the build order")

install_graph = InstallGraph(deps_graph, order_by=args.order_by)
install_graph = InstallGraph(deps_graph, order_by=args.order_by,
profile_args=ProfileArgs.from_args(args))
if args.reduce:
if args.order_by is None:
raise ConanException("--reduce needs --order-by argument defined")
Expand Down Expand Up @@ -209,6 +211,7 @@ def graph_info(conan_api, parser, subparser, *args):
partial=args.lockfile_partial,
overrides=overrides)
profile_host, profile_build = conan_api.profiles.get_profiles_from_args(args)
print_profiles(profile_host, profile_build)

if path:
deps_graph = conan_api.graph.load_graph_consumer(path, args.name, args.version,
Expand Down
2 changes: 1 addition & 1 deletion conan/cli/commands/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from conan.cli import make_abs_path
from conan.cli.command import conan_command, OnceArgument
from conan.cli.formatters.list import list_packages_html
from conans.errors import ConanException
from conan.errors import ConanException
from conans.util.dates import timestamp_to_str


Expand Down
2 changes: 1 addition & 1 deletion conan/cli/commands/pkglist.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from conan.cli.command import conan_command, conan_subcommand
from conan.cli.commands.list import print_list_text, print_list_json
from conan.cli.formatters.list import list_packages_html
from conans.errors import NotFoundException
from conan.internal.errors import NotFoundException


@conan_command(group="Consumer")
Expand Down
2 changes: 1 addition & 1 deletion conan/cli/commands/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def remote_login(conan_api, parser, subparser, *args):
if args.username is not None and args.password is not None:
user, password = args.username, args.password
else:
user, password = creds.auth(r, args.username)
user, password, _ = creds.auth(r, args.username)
if args.username is not None and args.username != user:
raise ConanException(f"User '{args.username}' doesn't match user '{user}' in "
f"credentials.json or environment variables")
Expand Down
2 changes: 1 addition & 1 deletion conan/cli/commands/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from conan.cli.command import conan_command, OnceArgument
from conan.cli.commands.list import print_list_json, print_serial
from conans.client.userio import UserInput
from conans.errors import ConanException
from conan.errors import ConanException


def summary_remove_list(results):
Expand Down
Loading

0 comments on commit 6702664

Please sign in to comment.