]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
patman: Rename the main module
authorSimon Glass <sjg@chromium.org>
Sat, 18 Apr 2020 00:08:52 +0000 (18:08 -0600)
committerSimon Glass <sjg@chromium.org>
Sun, 26 Apr 2020 20:24:08 +0000 (14:24 -0600)
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>
tools/patman/main.py [moved from tools/patman/patman.py with 93% similarity]
tools/patman/patman

similarity index 93%
rename from tools/patman/patman.py
rename to tools/patman/main.py
index 7f4ac9aef482b44cd29c59cbf04108beeaaf4917..f3d9c0c4348657540a1fdfb35621816b55080289 100755 (executable)
@@ -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()
index 6cc3d7a56a54b88c36534e232952b58d2c053e34..11a5d8e18ab71465be9424cf930c5e792c75edb7 120000 (symlink)
@@ -1 +1 @@
-patman.py
\ No newline at end of file
+main.py
\ No newline at end of file