gn2bp: clean up _delete_arg

This previously supported deleteing flags or value args. Deleting flags
may not be required (and if it is, we can always add a second function).
I prefer having a simpler implementation at the cost of little
duplication.

Test: none
Change-Id: Ice16dd54185c65fec99882ff65e982804478c85f
This commit is contained in:
Patrick Rohr
2022-11-30 19:46:26 -08:00
parent f0abead137
commit 357b25cd23

View File

@@ -671,14 +671,12 @@ class BaseActionSanitizer():
def _set_arg_at(self, position, value):
self.target.args[position] = value
def _delete_arg(self, arg, throw_if_absent = True):
def _delete_value_arg(self, arg, throw_if_absent = True):
if self._should_fail_silently(arg, throw_if_absent):
return
assert(not self._is_list_arg(arg))
hasValue = self._is_value_arg(arg)
assert(self._is_value_arg(arg))
i = self.target.args.index(arg)
self.target.args.pop(i)
if hasValue:
self.target.args.pop(i)
def _append_arg(self, arg, value):
@@ -720,7 +718,7 @@ class JniGeneratorSanitizer(BaseActionSanitizer):
self._append_arg('--javap', '$$(find out/.path -name javap)')
self._update_value_arg('--output_dir', self._sanitize_filepath)
self._update_value_arg('--includes', self._sanitize_filepath, False)
self._delete_arg('--prev_output_dir', False)
self._delete_value_arg('--prev_output_dir', False)
return super().get_args()