summaryrefslogtreecommitdiff
path: root/tools/patman
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-04-17 18:09:04 -0600
committerSimon Glass <sjg@chromium.org>2020-04-26 14:25:21 -0600
commitbf776679a73f3b9eae37aabd2be5754483039cb2 (patch)
tree939e4c78bc95bf5f8677be6b5fd4755de4609b7e /tools/patman
parent16287933a852bab2ac4985a770e08c9aa69d21b1 (diff)
patman: Move to absolute imports
At present patman sets the python path on startup so that it can access the libraries it needs. If we convert to use absolute imports this is not necessary. Move patman to use absolute imports. This requires changes in tools which use the patman libraries (which is most of them). Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman')
-rw-r--r--tools/patman/checkpatch.py8
-rw-r--r--tools/patman/command.py5
-rw-r--r--tools/patman/func_test.py8
-rw-r--r--tools/patman/get_maintainer.py5
-rw-r--r--tools/patman/gitutil.py12
-rwxr-xr-xtools/patman/main.py18
-rw-r--r--tools/patman/patchstream.py8
-rw-r--r--tools/patman/project.py2
-rw-r--r--tools/patman/series.py10
-rw-r--r--tools/patman/settings.py6
-rw-r--r--tools/patman/test.py10
-rw-r--r--tools/patman/test_util.py3
-rw-r--r--tools/patman/tools.py4
-rw-r--r--tools/patman/tout.py2
14 files changed, 53 insertions, 48 deletions
diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
index d47ea438b7..795b519314 100644
--- a/tools/patman/checkpatch.py
+++ b/tools/patman/checkpatch.py
@@ -3,12 +3,14 @@
#
import collections
-import command
-import gitutil
import os
import re
import sys
-import terminal
+
+from patman import command
+from patman import gitutil
+from patman import terminal
+from patman import tools
def FindCheckPatch():
top_level = gitutil.GetTopLevel()
diff --git a/tools/patman/command.py b/tools/patman/command.py
index 5fbd2c4a3e..e67ac159e5 100644
--- a/tools/patman/command.py
+++ b/tools/patman/command.py
@@ -3,8 +3,9 @@
#
import os
-import cros_subprocess
-import tools
+
+from patman import cros_subprocess
+from patman import tools
"""Shell command ease-ups for Python."""
diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index 748e225446..b7e2825de8 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -14,10 +14,10 @@ import unittest
from io import StringIO
-import gitutil
-import patchstream
-import settings
-import tools
+from patman import gitutil
+from patman import patchstream
+from patman import settings
+from patman import tools
@contextlib.contextmanager
diff --git a/tools/patman/get_maintainer.py b/tools/patman/get_maintainer.py
index 0ffb55a821..473f0feebf 100644
--- a/tools/patman/get_maintainer.py
+++ b/tools/patman/get_maintainer.py
@@ -2,10 +2,11 @@
# Copyright (c) 2012 The Chromium OS Authors.
#
-import command
-import gitutil
import os
+from patman import command
+from patman import gitutil
+
def FindGetMaintainer():
"""Look for the get_maintainer.pl script.
diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index a2a225c6b9..770a051014 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -2,17 +2,17 @@
# Copyright (c) 2011 The Chromium OS Authors.
#
-import command
import re
import os
-import series
import subprocess
import sys
-import terminal
-import checkpatch
-import settings
-import tools
+from patman import checkpatch
+from patman import command
+from patman import series
+from patman import settings
+from patman import terminal
+from patman import tools
# True to use --no-decorate - we check this in Setup()
use_no_decorate = True
diff --git a/tools/patman/main.py b/tools/patman/main.py
index b642c2ed03..f59367fafb 100755
--- a/tools/patman/main.py
+++ b/tools/patman/main.py
@@ -18,14 +18,14 @@ if __name__ == "__main__":
sys.path.append(os.path.join(our_path, '..'))
# Our modules
-import checkpatch
-import command
-import gitutil
-import patchstream
-import project
-import settings
-import terminal
-import test
+from patman import checkpatch
+from patman import command
+from patman import gitutil
+from patman import patchstream
+from patman import project
+from patman import settings
+from patman import terminal
+from patman import test
parser = OptionParser()
@@ -86,7 +86,7 @@ if __name__ != "__main__":
# Run our meagre tests
elif options.test:
import doctest
- import func_test
+ from patman import func_test
sys.argv = [sys.argv[0]]
result = unittest.TestResult()
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index df3eb7483b..405297505c 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -9,10 +9,10 @@ import re
import shutil
import tempfile
-import command
-import commit
-import gitutil
-from series import Series
+from patman import command
+from patman import commit
+from patman import gitutil
+from patman.series import Series
# Tags that we detect and remove
re_remove = re.compile('^BUG=|^TEST=|^BRANCH=|^Review URL:'
diff --git a/tools/patman/project.py b/tools/patman/project.py
index 1d9cfc0625..2dfc303729 100644
--- a/tools/patman/project.py
+++ b/tools/patman/project.py
@@ -4,7 +4,7 @@
import os.path
-import gitutil
+from patman import gitutil
def DetectProject():
"""Autodetect the name of the current project.
diff --git a/tools/patman/series.py b/tools/patman/series.py
index 3869696abc..e5e28cebdf 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -5,11 +5,11 @@
import itertools
import os
-import get_maintainer
-import gitutil
-import settings
-import terminal
-import tools
+from patman import get_maintainer
+from patman import gitutil
+from patman import settings
+from patman import terminal
+from patman import tools
# Series-xxx tags that we understand
valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name',
diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index 21e8fc41a9..ca74fc611f 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -10,9 +10,9 @@ except:
import os
import re
-import command
-import gitutil
-import tools
+from patman import command
+from patman import gitutil
+from patman import tools
"""Default settings per-project.
diff --git a/tools/patman/test.py b/tools/patman/test.py
index 889e186606..e7f709e34c 100644
--- a/tools/patman/test.py
+++ b/tools/patman/test.py
@@ -8,11 +8,11 @@ import os
import tempfile
import unittest
-import checkpatch
-import gitutil
-import patchstream
-import series
-import commit
+from patman import checkpatch
+from patman import gitutil
+from patman import patchstream
+from patman import series
+from patman import commit
class TestPatch(unittest.TestCase):
diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py
index bb5a298e39..4d28d9fc92 100644
--- a/tools/patman/test_util.py
+++ b/tools/patman/test_util.py
@@ -10,7 +10,8 @@ import os
import sys
import unittest
-import command
+from patman import command
+from patman import test_util
from io import StringIO
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 7b21a128f3..b50370dfe8 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -3,7 +3,6 @@
# Copyright (c) 2016 Google, Inc
#
-import command
import glob
import os
import shutil
@@ -11,7 +10,8 @@ import struct
import sys
import tempfile
-import tout
+from patman import command
+from patman import tout
# Output directly (generally this is temporary)
outdir = None
diff --git a/tools/patman/tout.py b/tools/patman/tout.py
index ee3c519c80..c7e3272096 100644
--- a/tools/patman/tout.py
+++ b/tools/patman/tout.py
@@ -6,7 +6,7 @@
import sys
-import terminal
+from patman import terminal
# Output verbosity levels that we support
ERROR, WARNING, NOTICE, INFO, DETAIL, DEBUG = range(6)