Skip to content

Commit

Permalink
Fixes #106. Implemented Conan 2 profile_meta command
Browse files Browse the repository at this point in the history
  • Loading branch information
markfinal committed Jul 15, 2023
1 parent ee94971 commit c3aae51
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cruiz/workers/api/v2/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,22 @@ def _interop_get_config_envvars(api: typing.Any) -> typing.List[str]:
return envvar_list


def _interop_profile_meta(
api: typing.Any, profile: str
) -> typing.Dict[str, typing.Dict[str, typing.Any]]:
from conans.client.cache.cache import ClientCache
from conans.client.profile_loader import ProfileLoader

cache = ClientCache(api.cache_folder)
loader = ProfileLoader(cache)
# TODO: using internal method
profile = loader._load_profile(profile, os.getcwd())
details: typing.Dict[str, typing.Dict[str, typing.Any]] = {"settings": {}}
for key, value in profile.settings.items():
details["settings"][key] = value
return details


def invoke(
request_queue: multiprocessing.JoinableQueue[str],
reply_queue: multiprocessing.Queue[Message],
Expand Down Expand Up @@ -155,6 +171,8 @@ def invoke(
result = _interop_get_conandata(api, request_params["path"][0])
elif request == "get_config_envvars":
result = _interop_get_config_envvars(api)
elif request == "profile_meta":
result = _interop_profile_meta(api, request_params["name"][0])
else:
raise RuntimeError(
f"Meta command request not implemented: '{request}' "
Expand Down

0 comments on commit c3aae51

Please sign in to comment.