Loading core/product_config.rbc +17 −0 Original line number Diff line number Diff line Loading @@ -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). Loading Loading @@ -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, Loading tests/run.rbc +9 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,15 @@ assert_eq("/foo/baz", rblf.abspath("/foo/bar/../baz")) assert_eq(cwd+"/foo/bar "+cwd+"/foo/baz", rblf.abspath("foo/bar foo/baz")) assert_eq("/baz", rblf.abspath("/../../../../../../../../../../../../../../../../baz")) assert_eq("foo", rblf.first_word("foo bar")) assert_eq("foo", rblf.first_word(["foo", "bar"])) assert_eq("", rblf.first_word("")) assert_eq("", rblf.first_word([])) assert_eq("bar", rblf.last_word("foo bar")) assert_eq("bar", rblf.last_word(["foo", "bar"])) assert_eq("", rblf.last_word("")) assert_eq("", rblf.last_word([])) assert_eq( ["build/make/tests/board.rbc", "build/make/tests/board_input_vars.rbc"], rblf.expand_wildcard("build/make/tests/board*.rbc") Loading Loading
core/product_config.rbc +17 −0 Original line number Diff line number Diff line Loading @@ -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). Loading Loading @@ -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, Loading
tests/run.rbc +9 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,15 @@ assert_eq("/foo/baz", rblf.abspath("/foo/bar/../baz")) assert_eq(cwd+"/foo/bar "+cwd+"/foo/baz", rblf.abspath("foo/bar foo/baz")) assert_eq("/baz", rblf.abspath("/../../../../../../../../../../../../../../../../baz")) assert_eq("foo", rblf.first_word("foo bar")) assert_eq("foo", rblf.first_word(["foo", "bar"])) assert_eq("", rblf.first_word("")) assert_eq("", rblf.first_word([])) assert_eq("bar", rblf.last_word("foo bar")) assert_eq("bar", rblf.last_word(["foo", "bar"])) assert_eq("", rblf.last_word("")) assert_eq("", rblf.last_word([])) assert_eq( ["build/make/tests/board.rbc", "build/make/tests/board_input_vars.rbc"], rblf.expand_wildcard("build/make/tests/board*.rbc") Loading