Extensions: New status message when checking for update #122378
@ -168,6 +168,7 @@ def sync_status_generator(repos_notify):
|
||||
cmd_batch_partial.append(partial(
|
||||
bl_extension_utils.repo_sync,
|
||||
directory=repo_item.directory,
|
||||
remote_name=repo_item.name,
|
||||
remote_url=bl_extension_ops.url_params_append_defaults(repo_item.remote_url),
|
||||
online_user_agent=bl_extension_ops.online_user_agent_from_blender(),
|
||||
access_token=repo_item.access_token if repo_item.use_access_token else "",
|
||||
|
@ -1007,6 +1007,7 @@ class BlPkgRepoSync(Operator, _BlPkgCmdMixIn):
|
||||
partial(
|
||||
bl_extension_utils.repo_sync,
|
||||
directory=directory,
|
||||
remote_name=repo_item.name,
|
||||
remote_url=url_params_append_defaults(repo_item.remote_url),
|
||||
online_user_agent=online_user_agent_from_blender(),
|
||||
access_token=repo_item.access_token,
|
||||
@ -1084,6 +1085,7 @@ class BlPkgRepoSyncAll(Operator, _BlPkgCmdMixIn):
|
||||
cmd_batch.append(partial(
|
||||
bl_extension_utils.repo_sync,
|
||||
directory=repo_item.directory,
|
||||
remote_name=repo_item.name,
|
||||
remote_url=url_params_append_defaults(repo_item.remote_url),
|
||||
online_user_agent=online_user_agent_from_blender(),
|
||||
access_token=repo_item.access_token,
|
||||
|
@ -350,6 +350,7 @@ def url_params_append_for_blender(url: str, blender_version: Tuple[int, int, int
|
||||
def repo_sync(
|
||||
*,
|
||||
directory: str,
|
||||
remote_name: str,
|
||||
remote_url: str,
|
||||
online_user_agent: str,
|
||||
access_token: str,
|
||||
@ -364,6 +365,7 @@ def repo_sync(
|
||||
yield from command_output_from_json_0([
|
||||
"sync",
|
||||
"--local-dir", directory,
|
||||
"--remote-name", remote_name,
|
||||
"--remote-url", remote_url,
|
||||
"--online-user-agent", online_user_agent,
|
||||
"--access-token", access_token,
|
||||
|
@ -1645,6 +1645,7 @@ def repo_local_private_dir_ensure_with_subdir(*, local_dir: str, subdir: str) ->
|
||||
def repo_sync_from_remote(
|
||||
*,
|
||||
msg_fn: MessageFn,
|
||||
remote_name: str,
|
||||
remote_url: str,
|
||||
local_dir: str,
|
||||
online_user_agent: str,
|
||||
@ -1656,7 +1657,7 @@ def repo_sync_from_remote(
|
||||
Load package information into the local path.
|
||||
"""
|
||||
request_exit = False
|
||||
request_exit |= message_status(msg_fn, "Sync repo: {:s}".format(remote_url))
|
||||
request_exit |= message_status(msg_fn, f'Checking repository "{remote_name}" for updates...')
|
||||
dfelinto marked this conversation as resolved
Outdated
|
||||
if request_exit:
|
||||
return False
|
||||
|
||||
@ -1675,7 +1676,7 @@ def repo_sync_from_remote(
|
||||
|
||||
with CleanupPathsContext(files=(local_json_path_temp,), directories=()):
|
||||
# TODO: time-out.
|
||||
request_exit |= message_status(msg_fn, "Sync downloading remote data")
|
||||
request_exit |= message_status(msg_fn, f'Refreshing extensions list for "{remote_name}"...')
|
||||
if request_exit:
|
||||
return False
|
||||
|
||||
@ -1706,11 +1707,11 @@ def repo_sync_from_remote(
|
||||
|
||||
error_msg = repo_json_is_valid_or_error(local_json_path_temp)
|
||||
if error_msg is not None:
|
||||
message_error(msg_fn, "sync: invalid manifest ({:s}) reading {!r}!".format(error_msg, remote_url))
|
||||
message_error(msg_fn, f'Repository error: invalid manifest ({error_msg}) for repository "{remote_name}"!')
|
||||
return False
|
||||
del error_msg
|
||||
|
||||
request_exit |= message_status(msg_fn, "Sync complete: {:s}".format(remote_url))
|
||||
request_exit |= message_status(msg_fn, f'Extensions list for "{remote_name}" updated')
|
||||
if request_exit:
|
||||
return False
|
||||
|
||||
@ -1838,6 +1839,19 @@ def generic_arg_repo_dir(subparse: argparse.ArgumentParser) -> None:
|
||||
)
|
||||
|
||||
|
||||
def generic_arg_remote_name(subparse: argparse.ArgumentParser) -> None:
|
||||
subparse.add_argument(
|
||||
"--remote-name",
|
||||
dest="remote_name",
|
||||
type=str,
|
||||
help=(
|
||||
"The remote repository name."
|
||||
),
|
||||
default="",
|
||||
required=False,
|
||||
)
|
||||
|
||||
|
||||
def generic_arg_remote_url(subparse: argparse.ArgumentParser) -> None:
|
||||
subparse.add_argument(
|
||||
"--remote-url",
|
||||
@ -2167,6 +2181,7 @@ class subcmd_client:
|
||||
msg_fn: MessageFn,
|
||||
*,
|
||||
remote_url: str,
|
||||
remote_name: str,
|
||||
local_dir: str,
|
||||
online_user_agent: str,
|
||||
access_token: str,
|
||||
@ -2179,6 +2194,7 @@ class subcmd_client:
|
||||
|
||||
success = repo_sync_from_remote(
|
||||
msg_fn=msg_fn,
|
||||
remote_name=remote_name,
|
||||
remote_url=remote_url,
|
||||
local_dir=local_dir,
|
||||
online_user_agent=online_user_agent,
|
||||
@ -3022,6 +3038,7 @@ def argparse_create_client_sync(subparsers: "argparse._SubParsersAction[argparse
|
||||
)
|
||||
|
||||
generic_arg_remote_url(subparse)
|
||||
generic_arg_remote_name(subparse)
|
||||
generic_arg_local_dir(subparse)
|
||||
generic_arg_online_user_agent(subparse)
|
||||
generic_arg_access_token(subparse)
|
||||
@ -3035,6 +3052,7 @@ def argparse_create_client_sync(subparsers: "argparse._SubParsersAction[argparse
|
||||
func=lambda args: subcmd_client.sync(
|
||||
msg_fn_from_args(args),
|
||||
remote_url=args.remote_url,
|
||||
remote_name=args.remote_name if args.remote_name else args.remote_url,
|
||||
dfelinto marked this conversation as resolved
Outdated
Campbell Barton
commented
Less verbose (in the else case):
Less verbose (in the else case):
```
remote_name=args.remote_name if args.remote_name else remote_url_params_strip(args.remote_url)
```
|
||||
local_dir=args.local_dir,
|
||||
online_user_agent=args.online_user_agent,
|
||||
access_token=args.access_token,
|
||||
|
@ -352,9 +352,9 @@ class TestCLI_WithRepo(unittest.TestCase):
|
||||
], exclude_types={"PROGRESS"})
|
||||
self.assertEqual(
|
||||
output_json, [
|
||||
('STATUS', 'Sync repo: ' + self.dirpath_url),
|
||||
('STATUS', 'Sync downloading remote data'),
|
||||
('STATUS', 'Sync complete: ' + self.dirpath_url),
|
||||
('STATUS', f'Checking repository "{self.dirpath_url}" for updates...'),
|
||||
('STATUS', f'Refreshing extensions list for "{self.dirpath_url}"...'),
|
||||
('STATUS', f'Extensions list for "{self.dirpath_url}" updated'),
|
||||
]
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user
Prefer to use
str.format
over f-strings. Also oter strings in this PR.