Skip to content

Commit

Permalink
Merge branch 'develop2' into ci-gh-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
czoido authored Sep 20, 2024
2 parents 4d75f86 + 7179562 commit 48cddf9
Show file tree
Hide file tree
Showing 52 changed files with 276 additions and 202 deletions.
8 changes: 5 additions & 3 deletions conan/api/conan_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
from conan.api.subapi.remove import RemoveAPI
from conan.api.subapi.search import SearchAPI
from conan.api.subapi.upload import UploadAPI
from conans.client.conf.required_version import check_required_conan_version
from conans.client.migrations import ClientMigrator
from conans.client.userio import init_colorama
from conans.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


class ConanAPI(object):
class ConanAPI:
def __init__(self, cache_folder=None):

version = sys.version_info
Expand Down Expand Up @@ -59,4 +59,6 @@ def __init__(self, cache_folder=None):
self.lockfile = LockfileAPI(self)
self.local = LocalAPI(self)

check_required_conan_version(self.config.global_conf)
required_range_new = self.config.global_conf.get("core:required_conan_version")
if required_range_new:
validate_conan_version(required_range_new)
2 changes: 1 addition & 1 deletion conan/api/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __getitem__(self, name):
try:
return self.lists[name]
except KeyError:
raise ConanException(f"'{name}' doesn't exist is package list")
raise ConanException(f"'{name}' doesn't exist in package list")

def add(self, name, pkg_list):
self.lists[name] = pkg_list
Expand Down
5 changes: 3 additions & 2 deletions conan/api/subapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@

from conan import conan_version
from conan.api.output import ConanOutput
from conans.client.conf import default_settings_yml
from conan.internal.api import detect_api

from conan.internal.api.detect import detect_api
from conan.internal.cache.home_paths import HomePaths
from conan.internal.conan_app import ConanApp
from conan.internal.default_settings import default_settings_yml
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
Expand Down
4 changes: 2 additions & 2 deletions conan/api/subapi/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from conan.api.output import ConanOutput
from conan.internal.conan_app import ConanApp
from conan.internal.upload_metadata import gather_metadata
from conan.internal.api.uploader import PackagePreparator, UploadExecutor, UploadUpstreamChecker
from conan.internal.api.uploader import PackagePreparator, UploadExecutor, UploadUpstreamChecker, \
gather_metadata
from conans.client.pkg_sign import PkgSignaturesPlugin
from conans.client.rest.file_uploader import FileUploader
from conans.errors import ConanException, AuthenticationException, ForbiddenException
Expand Down
10 changes: 8 additions & 2 deletions conan/cli/commands/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,14 @@ def config_list(conan_api, parser, subparser, *args):
"""
Show all the Conan available configurations: core and tools.
"""
parser.parse_args(*args)
return conan_api.config.builtin_confs
subparser.add_argument('pattern', nargs="?",
help="Filter configuration items that matches this pattern")
args = parser.parse_args(*args)
confs = conan_api.config.builtin_confs
if args.pattern:
p = args.pattern.lower()
confs = {k: v for k, v in confs.items() if p in k.lower() or p in v.lower()}
return confs


@conan_subcommand(formatters={"text": list_text_formatter, "json": default_json_formatter})
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def default_msvc_runtime(compiler):


def detect_msvc_update(version):
from conans.client.conf.detect_vs import vs_detect_update
from conan.internal.api.detect.detect_vs import vs_detect_update
return vs_detect_update(version)


Expand Down Expand Up @@ -416,7 +416,7 @@ def default_msvc_ide_version(version):


def _detect_vs_ide_version():
from conans.client.conf.detect_vs import vs_installation_path
from conan.internal.api.detect.detect_vs import vs_installation_path
msvc_versions = "17", "16", "15"
for version in msvc_versions:
vs_path = os.getenv('vs%s0comntools' % version)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion conan/internal/api/profile/detect.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from conan.api.output import ConanOutput
from conan.internal.api.detect_api import detect_os, detect_arch, default_msvc_runtime, \
from conan.internal.api.detect.detect_api import detect_os, detect_arch, default_msvc_runtime, \
detect_libcxx, detect_cppstd, detect_default_compiler, default_compiler_version


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

from conan import conan_version
from conan.api.output import ConanOutput
from conan.internal.api import detect_api
from conan.internal.api.detect import detect_api
from conan.internal.cache.home_paths import HomePaths
from conan.tools.env.environment import ProfileEnvironment
from conans.errors import ConanException
Expand Down
35 changes: 35 additions & 0 deletions conan/internal/api/uploader.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fnmatch
import os
import shutil
import time
Expand Down Expand Up @@ -277,3 +278,37 @@ def _total_size(cache_files):
stat = os.stat(file)
total_size += stat.st_size
return human_size(total_size)


def _metadata_files(folder, metadata):
result = {}
for root, _, files in os.walk(folder):
for f in files:
abs_path = os.path.join(root, f)
relpath = os.path.relpath(abs_path, folder)
if metadata:
if not any(fnmatch.fnmatch(relpath, m) for m in metadata):
continue
path = os.path.join("metadata", relpath).replace("\\", "/")
result[path] = abs_path
return result


def gather_metadata(package_list, cache, metadata):
for rref, recipe_bundle in package_list.refs().items():
if metadata or recipe_bundle["upload"]:
metadata_folder = cache.recipe_layout(rref).metadata()
files = _metadata_files(metadata_folder, metadata)
if files:
ConanOutput(scope=str(rref)).info(f"Recipe metadata: {len(files)} files")
recipe_bundle.setdefault("files", {}).update(files)
recipe_bundle["upload"] = True

for pref, pkg_bundle in package_list.prefs(rref, recipe_bundle).items():
if metadata or pkg_bundle["upload"]:
metadata_folder = cache.pkg_layout(pref).metadata()
files = _metadata_files(metadata_folder, metadata)
if files:
ConanOutput(scope=str(pref)).info(f"Package metadata: {len(files)} files")
pkg_bundle.setdefault("files", {}).update(files)
pkg_bundle["upload"] = True
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,48 @@
"13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7",
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "14.8",
"15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6", "16.0", "16.1",
"16.2", "16.3", "16.4", "16.5", "16.6", "17.0", "17.1", "17.2", "17.3", "17.4", "17.5"]
"16.2", "16.3", "16.4", "16.5", "16.6", "17.0", "17.1", "17.2", "17.3", "17.4", "17.5",
"18.0", "18.1"]
sdk: ["iphoneos", "iphonesimulator"]
sdk_version: [null, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
"13.0", "13.1", "13.2", "13.4", "13.5", "13.6", "13.7",
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "15.0", "15.2", "15.4",
"15.5", "16.0", "16.1", "16.2", "16.4", "17.0", "17.1", "17.2", "17.4", "17.5"]
"15.5", "16.0", "16.1", "16.2", "16.4", "17.0", "17.1", "17.2", "17.4", "17.5",
"18.0", "18.1"]
watchOS:
version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2",
"7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "8.0", "8.1", "8.3", "8.4",
"8.5", "8.6", "8.7", "9.0", "9.1", "9.2", "9.3", "9.4", "9.5", "9.6",
"10.0", "10.1", "10.2", "10.3", "10.4", "10.5"]
"10.0", "10.1", "10.2", "10.3", "10.4", "10.5", "11.0", "11.1"]
sdk: ["watchos", "watchsimulator"]
sdk_version: [null, "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2",
"7.0", "7.1", "7.2", "7.4", "8.0", "8.0.1", "8.3", "8.5", "9.0", "9.1",
"9.4", "10.0", "10.1", "10.2", "10.4", "10.5"]
"9.4", "10.0", "10.1", "10.2", "10.4", "10.5", "11.0", "11.1"]
tvOS:
version: ["11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4",
"13.0", "13.2", "13.3", "13.4", "14.0", "14.2", "14.3", "14.4", "14.5",
"14.6", "14.7", "15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6",
"16.0", "16.1", "16.2", "16.3", "16.4", "16.5", "16.6", "17.0", "17.1", "17.2", "17.3", "17.4",
"17.5"]
"17.5", "18.0", "18.1"]
sdk: ["appletvos", "appletvsimulator"]
sdk_version: [null, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
"13.0", "13.1", "13.2", "13.4", "14.0", "14.2", "14.3", "14.5", "15.0",
"15.2", "15.4", "16.0", "16.1", "16.4", "17.0", "17.1", "17.2", "17.4", "17.5"]
"15.2", "15.4", "16.0", "16.1", "16.4", "17.0", "17.1", "17.2", "17.4", "17.5",
"18.0", "18.1"]
visionOS:
version: ["1.0", "1.1", "1.2"]
version: ["1.0", "1.1", "1.2", "2.0", "2.1"]
sdk: ["xros", "xrsimulator"]
sdk_version: [null, "1.0", "1.1", "1.2"]
sdk_version: [null, "1.0", "1.1", "1.2", "2.0", "2.1"]
Macos:
version: [null, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15",
"11.0", "11.1", "11.2", "11.3", "11.4", "11.5", "11.6", "11.7",
"12.0", "12.1", "12.2", "12.3", "12.4", "12.5", "12.6", "12.7",
"13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6",
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5"]
"14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6",
"15.0", "15.1"]
sdk_version: [null, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1",
"12.3", "13.0", "13.1", "13.3", "14.0", "14.2", "14.4", "14.5"]
"12.3", "13.0", "13.1", "13.3", "14.0", "14.2", "14.4", "14.5",
"15.0", "15.1"]
subsystem:
null:
catalyst:
Expand Down Expand Up @@ -124,7 +129,7 @@
cstd: [null, 99, gnu99, 11, gnu11, 17, gnu17, 23, gnu23]
apple-clang:
version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1",
"10.0", "11.0", "12.0", "13", "13.0", "13.1", "14", "14.0", "15", "15.0"]
"10.0", "11.0", "12.0", "13", "13.0", "13.1", "14", "14.0", "15", "15.0", "16", "16.0"]
libcxx: [libstdc++, libc++]
cppstd: [null, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
cstd: [null, 99, gnu99, 11, gnu11, 17, gnu17, 23, gnu23]
Expand All @@ -150,10 +155,6 @@
"""


def get_default_settings_yml():
return default_settings_yml


def migrate_settings_file(cache_folder):
from conans.client.migrations import update_file

Expand Down
38 changes: 0 additions & 38 deletions conan/internal/upload_metadata.py

This file was deleted.

2 changes: 1 addition & 1 deletion conan/tools/build/cppstd.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import operator

from conan.errors import ConanInvalidConfiguration, ConanException
from conan.internal.api.detect_api import default_cppstd as default_cppstd_
from conan.internal.api.detect.detect_api import default_cppstd as default_cppstd_
from conans.model.version import Version


Expand Down
5 changes: 4 additions & 1 deletion conan/tools/build/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,10 @@ def _cppstd_apple_clang(clang_version, cppstd):
v20 = "c++2a"
vgnu20 = "gnu++2a"

if clang_version >= "13.0":
if clang_version >= "16.0":
v23 = "c++23"
vgnu23 = "gnu++23"
elif clang_version >= "13.0":
v23 = "c++2b"
vgnu23 = "gnu++2b"

Expand Down
9 changes: 1 addition & 8 deletions conan/tools/cmake/presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from conan.api.output import ConanOutput, Color
from conan.tools.cmake.layout import get_build_folder_custom_vars
from conan.tools.cmake.toolchain.blocks import GenericSystemBlock, CompilersBlock
from conan.tools.cmake.toolchain.blocks import GenericSystemBlock
from conan.tools.cmake.utils import is_multi_configuration
from conan.tools.build import build_jobs
from conan.tools.microsoft import is_msvc
Expand Down Expand Up @@ -158,13 +158,6 @@ def _configure_preset(conanfile, generator, cache_variables, toolchain_file, mul
"strategy": "external"
}

# Set the compiler like in the toolchain. Some IDEs like VS or VSCode require the compiler
# being set to cl.exe in order to activate the environment using vcvarsall.bat according to
# the toolset and architecture settings.
compilers = CompilersBlock.get_compilers(conanfile)
for lang, compiler in compilers.items():
ret["cacheVariables"][f"CMAKE_{lang}_COMPILER"] = compiler.replace("\\", "/")

ret["toolchainFile"] = toolchain_file
if conanfile.build_folder:
# If we are installing a ref: "conan install <ref>", we don't have build_folder, because
Expand Down
21 changes: 9 additions & 12 deletions conan/tools/cmake/toolchain/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,13 +865,9 @@ class CompilersBlock(Block):
""")

def context(self):
return {"compilers": self.get_compilers(self._conanfile)}

@staticmethod
def get_compilers(conanfile):
# Reading configuration from "tools.build:compiler_executables" -> {"C": "/usr/bin/gcc"}
compilers_by_conf = conanfile.conf.get("tools.build:compiler_executables", default={},
check_type=dict)
compilers_by_conf = self._conanfile.conf.get("tools.build:compiler_executables", default={},
check_type=dict)
# Map the possible languages
compilers = {}
# Allowed <LANG> variables (and <LANG>_LAUNCHER)
Expand All @@ -882,7 +878,7 @@ def get_compilers(conanfile):
# To set CMAKE_<LANG>_COMPILER
if comp in compilers_by_conf:
compilers[lang] = compilers_by_conf[comp]
return compilers
return {"compilers": compilers}


class GenericSystemBlock(Block):
Expand Down Expand Up @@ -1018,26 +1014,27 @@ def _is_apple_cross_building(self):
@staticmethod
def _get_darwin_version(os_name, os_version):
# version mapping from https://en.wikipedia.org/wiki/Darwin_(operating_system)
# but a more detailed version can be found in https://theapplewiki.com/wiki/Kernel
version_mapping = {
"Macos": {
"10.6": "10", "10.7": "11", "10.8": "12", "10.9": "13", "10.10": "14", "10.11": "15",
"10.12": "16", "10.13": "17", "10.14": "18", "10.15": "19", "11": "20", "12": "21",
"13": "22", "14": "23",
"13": "22", "14": "23", "15": "24"
},
"iOS": {
"7": "14", "8": "14", "9": "15", "10": "16", "11": "17", "12": "18", "13": "19",
"14": "20", "15": "21", "16": "22", "17": "23"
"14": "20", "15": "21", "16": "22", "17": "23", "18": "24"
},
"watchOS": {
"4": "17", "5": "18", "6": "19", "7": "20",
"8": "21", "9": "22", "10": "23"
"8": "21", "9": "22", "10": "23", "11": "24"
},
"tvOS": {
"11": "17", "12": "18", "13": "19", "14": "20",
"15": "21", "16": "22", "17": "23"
"15": "21", "16": "22", "17": "23", "18": "24"
},
"visionOS": {
"1": "23"
"1": "23", "2": "24"
}
}
os_version = Version(os_version).major if os_name != "Macos" or (os_name == "Macos" and Version(
Expand Down
2 changes: 1 addition & 1 deletion conan/tools/microsoft/visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import textwrap

from conan.internal import check_duplicated_generator
from conans.client.conf.detect_vs import vs_installation_path
from conan.internal.api.detect.detect_vs import vs_installation_path
from conan.errors import ConanException, ConanInvalidConfiguration
from conan.tools.scm import Version
from conan.tools.intel.intel_cc import IntelCC
Expand Down
Loading

0 comments on commit 48cddf9

Please sign in to comment.