manifest: api change: remove Project.format()

This also stops using it from Project.git(). We no longer have any
in-tree users, and neither Zephyr 2.1.x nor 1.14.x appear to have any
users either.

We can revert this commit later if it causes trouble.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2020-01-14 13:09:31 -08:00 committed by Marti Bolivar
parent 42f4106f6f
commit c5e3434d53
1 changed files with 2 additions and 36 deletions

View File

@ -1082,39 +1082,6 @@ class Project:
return ret return ret
def format(self, s, *args, **kwargs):
'''Calls ``s.format()`` with instance-related arguments.
The formatted value is returned.
``s.format()`` is called with any args and kwargs passed as
parameters to this method, and the following additional
kwargs:
- ``name``
- ``url``
- ``revision``
- ``path``
- ``abspath``
- ``posixpath``
- ``clone_depth``
- ``west_commands``
- ``topdir``
- ``name_and_path=f"{self.name} ({self.path})"`` (or its
non-f-string equivalent)
Any kwargs passed as parameters to this method override the
above additional kwargs.
:param s: string (or other object) to call ``format()`` on
'''
kw = {s: getattr(self, s) for s in
'name url revision path abspath posixpath '
'clone_depth west_commands topdir'.split()}
kw['name_and_path'] = '{} ({})'.format(self.name, self.path)
kw.update(kwargs)
return s.format(*args, **kw)
# #
# Git helpers # Git helpers
# #
@ -1126,8 +1093,7 @@ class Project:
Returns a ``subprocess.CompletedProcess`` (an equivalent Returns a ``subprocess.CompletedProcess`` (an equivalent
object is back-ported for Python 3.4). object is back-ported for Python 3.4).
:param cmd: git command as a string (or list of strings); all :param cmd: git command as a string (or list of strings)
strings are formatted using `format` before use.
:param extra_args: sequence of additional arguments to pass to :param extra_args: sequence of additional arguments to pass to
the git command (useful mostly if *cmd* is a string). the git command (useful mostly if *cmd* is a string).
:param capture_stdout: if True, git's standard output is :param capture_stdout: if True, git's standard output is
@ -1155,7 +1121,7 @@ class Project:
else: else:
raise ValueError('no abspath; cwd must be given') raise ValueError('no abspath; cwd must be given')
args = ['git'] + [self.format(arg) for arg in cmd_list] + extra_args args = ['git'] + cmd_list + extra_args
cmd_str = util.quote_sh_list(args) cmd_str = util.quote_sh_list(args)
log.dbg("running '{}'".format(cmd_str), 'in', cwd, log.dbg("running '{}'".format(cmd_str), 'in', cwd,