@@ -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()
@@ -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."""
@@ -17,10 +17,10 @@ try:
except ImportError:
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
@@ -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.
@@ -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
similarity index 93%
rename from tools/patman/patman.py
rename to tools/patman/main.py
@@ -12,19 +12,20 @@ import re
import sys
import unittest
+if __name__ == "__main__":
+ # Allow 'from patman import xxx to work'
+ our_path = os.path.dirname(os.path.realpath(__file__))
+ sys.path.append(os.path.join(our_path, '..'))
+
# Our modules
-try:
- from patman import checkpatch, command, gitutil, patchstream, \
- project, settings, terminal, test
-except ImportError:
- 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()
@@ -85,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()
@@ -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:'
@@ -1 +1 @@
-patman.py
\ No newline at end of file
+main.py
\ No newline at end of file
@@ -4,7 +4,7 @@
import os.path
-import gitutil
+from patman import gitutil
def DetectProject():
"""Autodetect the name of the current project.
@@ -7,11 +7,11 @@ from __future__ import print_function
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',
@@ -12,9 +12,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.
@@ -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):
@@ -5,7 +5,6 @@
from __future__ import print_function
-import command
import glob
import os
import shutil
@@ -13,7 +12,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
@@ -8,7 +8,7 @@ from __future__ import print_function
import sys
-import terminal
+from patman import terminal
# Output verbosity levels that we support
ERROR, WARNING, NOTICE, INFO, DETAIL, DEBUG = range(6)