patman: Rename the main module

Python does not like the module name being the same as the module
directory. To allow patman modules to be used from other tools, rename
it.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2020-04-17 18:08:52 -06:00
parent 60b285f8c3
commit 0d7a8c4033
2 changed files with 15 additions and 14 deletions

View File

@ -12,19 +12,20 @@ import re
import sys import sys
import unittest 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 # Our modules
try: from patman import checkpatch
from patman import checkpatch, command, gitutil, patchstream, \ from patman import command
project, settings, terminal, test from patman import gitutil
except ImportError: from patman import patchstream
import checkpatch from patman import project
import command from patman import settings
import gitutil from patman import terminal
import patchstream from patman import test
import project
import settings
import terminal
import test
parser = OptionParser() parser = OptionParser()
@ -85,7 +86,7 @@ if __name__ != "__main__":
# Run our meagre tests # Run our meagre tests
elif options.test: elif options.test:
import doctest import doctest
import func_test from patman import func_test
sys.argv = [sys.argv[0]] sys.argv = [sys.argv[0]]
result = unittest.TestResult() result = unittest.TestResult()

View File

@ -1 +1 @@
patman.py main.py