doc: board: ti: Move documentation from README to .rst
[platform/kernel/u-boot.git] / tools / rmboard.py
index df4f04b..0c56b14 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 # SPDX-License-Identifier: GPL-2.0+
 # Copyright 2019 Google LLC
 #
@@ -23,18 +23,12 @@ This script works by:
 Search for ## to update the commit message manually.
 """
 
-from __future__ import print_function
-
 import glob
 import os
 import re
 import sys
 
-# Bring in the patman libraries
-our_path = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(our_path, '../tools/patman'))
-
-import command
+from u_boot_pylib import command
 
 def rm_kconfig_include(path):
     """Remove a path from Kconfig files
@@ -50,17 +44,17 @@ def rm_kconfig_include(path):
         path: Path to search for and remove
     """
     cmd = ['git', 'grep', path]
-    stdout = command.RunPipe([cmd], capture=True, raise_on_error=False).stdout
+    stdout = command.run_pipe([cmd], capture=True, raise_on_error=False).stdout
     if not stdout:
         return
     fname = stdout.split(':')[0]
 
     print("Fixing up '%s' to remove reference to '%s'" % (fname, path))
     cmd = ['sed', '-i', '\|%s|d' % path, fname]
-    stdout = command.RunPipe([cmd], capture=True).stdout
+    stdout = command.run_pipe([cmd], capture=True).stdout
 
     cmd = ['git', 'add', fname]
-    stdout = command.RunPipe([cmd], capture=True).stdout
+    stdout = command.run_pipe([cmd], capture=True).stdout
 
 def rm_board(board):
     """Create a commit which removes a single board
@@ -75,7 +69,7 @@ def rm_board(board):
 
     # Find all MAINTAINERS and Kconfig files which mention the board
     cmd = ['git', 'grep', '-l', board]
-    stdout = command.RunPipe([cmd], capture=True).stdout
+    stdout = command.run_pipe([cmd], capture=True).stdout
     maintain = []
     kconfig = []
     for line in stdout.splitlines():
@@ -116,7 +110,7 @@ def rm_board(board):
     # which reference Kconfig files we want to remove
     for path in real:
         cmd = ['find', path]
-        stdout = (command.RunPipe([cmd], capture=True, raise_on_error=False).
+        stdout = (command.run_pipe([cmd], capture=True, raise_on_error=False).
                   stdout)
         for fname in stdout.splitlines():
             if fname.endswith('Kconfig'):
@@ -124,7 +118,7 @@ def rm_board(board):
 
     # Remove unwanted files
     cmd = ['git', 'rm', '-r'] + real
-    stdout = command.RunPipe([cmd], capture=True).stdout
+    stdout = command.run_pipe([cmd], capture=True).stdout
 
     ## Change the messages as needed
     msg = '''arm: Remove %s board
@@ -138,12 +132,12 @@ Remove it.
 
     # Create the commit
     cmd = ['git', 'commit', '-s', '-m', msg]
-    stdout = command.RunPipe([cmd], capture=True).stdout
+    stdout = command.run_pipe([cmd], capture=True).stdout
 
     # Check if the board is mentioned anywhere else. The user will need to deal
     # with this
     cmd = ['git', 'grep', '-il', board]
-    print(command.RunPipe([cmd], capture=True, raise_on_error=False).stdout)
+    print(command.run_pipe([cmd], capture=True, raise_on_error=False).stdout)
     print(' '.join(cmd))
 
 for board in sys.argv[1:]: