tools: Better dependency fixing

Lines like 'deps = [ "foo" ]' would fail to be fixed.
Just insert the new dependencies in front and let the formatter have fun
with this after.

Bug: None
Change-Id: I747925cd0a1de93715a00b9ff3490b555f237e97
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257906
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36429}
diff --git a/tools_webrtc/gn_check_autofix.py b/tools_webrtc/gn_check_autofix.py
index 1a93898..3895dc9 100644
--- a/tools_webrtc/gn_check_autofix.py
+++ b/tools_webrtc/gn_check_autofix.py
@@ -81,11 +81,10 @@
                                        for dep in missing_deps[target]) +
                 ']\n') + line
         indentation_level = None
-      elif line.strip().startswith('deps'):
-        is_empty_deps = line.strip() == 'deps = []'
-        line = 'deps = [\n' if is_empty_deps else line
-        line += ''.join('  "' + dep + '",\n' for dep in missing_deps[target])
-        line += ']\n' if is_empty_deps else ''
+      elif line.strip().startswith('deps = ['):
+        joined_deps = ''.join('  "' + dep + '",\n'
+                              for dep in missing_deps[target])
+        line = line.replace('deps = [', 'deps = [' + joined_deps)
         indentation_level = None
 
     if line.strip() not in deleted_sources: