Add implementations for firstword/lastword
Bug: 226974242 Test: ./out/rbcrun ./build/make/tests/run.rbc Change-Id: Ibb992f42a59212bae48acd55647b2d0872c2f69e
This commit is contained in:
@@ -605,6 +605,21 @@ def _filter(pattern, text):
|
||||
break
|
||||
return res
|
||||
|
||||
def _first_word(input):
|
||||
"""Equivalent to the GNU make function $(firstword)."""
|
||||
input = __words(input)
|
||||
if len(input) == 0:
|
||||
return ""
|
||||
return input[0]
|
||||
|
||||
def _last_word(input):
|
||||
"""Equivalent to the GNU make function $(lastword)."""
|
||||
input = __words(input)
|
||||
l = len(input)
|
||||
if l == 0:
|
||||
return ""
|
||||
return input[l-1]
|
||||
|
||||
def _dir(paths):
|
||||
"""Equivalent to the GNU make function $(dir).
|
||||
|
||||
@@ -862,6 +877,8 @@ rblf = struct(
|
||||
filter_out = _filter_out,
|
||||
find_and_copy = _find_and_copy,
|
||||
findstring = _findstring,
|
||||
first_word = _first_word,
|
||||
last_word = _last_word,
|
||||
inherit = _inherit,
|
||||
indirect = _indirect,
|
||||
mk2rbc_error = _mk2rbc_error,
|
||||
|
Reference in New Issue
Block a user