提交 b4fa9495 编写于 作者: S Simon Glass

patman: Tidy up sys.path changes

Now that we are using absolute paths we can remove some of the sys.path
mangling that appears in the tools.

We only need to add the path to 'tools/' so that everything can find
modules relative to that directory.

The special paths for finding pylibfdt remain.
Signed-off-by: NSimon Glass <sjg@chromium.org>
上级 bf776679
...@@ -20,8 +20,9 @@ import unittest ...@@ -20,8 +20,9 @@ import unittest
# Bring in the patman and dtoc libraries (but don't override the first path # Bring in the patman and dtoc libraries (but don't override the first path
# in PYTHONPATH) # in PYTHONPATH)
our_path = os.path.dirname(os.path.realpath(__file__)) our_path = os.path.dirname(os.path.realpath(__file__))
for dirname in ['../patman', '../dtoc', '../concurrencytest', '..']: sys.path.insert(2, os.path.join(our_path, '..'))
sys.path.insert(2, os.path.realpath(os.path.join(our_path, dirname)))
from patman import test_util
# Bring in the libfdt module # Bring in the libfdt module
sys.path.insert(2, 'scripts/dtc/pylibfdt') sys.path.insert(2, 'scripts/dtc/pylibfdt')
......
...@@ -16,7 +16,6 @@ import unittest ...@@ -16,7 +16,6 @@ import unittest
# Bring in the patman libraries # Bring in the patman libraries
our_path = os.path.dirname(os.path.realpath(__file__)) our_path = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(1, os.path.join(our_path, '..')) sys.path.insert(1, os.path.join(our_path, '..'))
sys.path.insert(2, os.path.join(our_path, '../patman'))
# Our modules # Our modules
from buildman import board from buildman import board
...@@ -35,7 +34,7 @@ def RunTests(skip_net_tests): ...@@ -35,7 +34,7 @@ def RunTests(skip_net_tests):
import doctest import doctest
result = unittest.TestResult() result = unittest.TestResult()
for module in ['toolchain', 'gitutil']: for module in ['buildman.toolchain', 'patman.gitutil']:
suite = doctest.DocTestSuite(module) suite = doctest.DocTestSuite(module)
suite.run(result) suite.run(result)
......
...@@ -11,7 +11,6 @@ import unittest ...@@ -11,7 +11,6 @@ import unittest
# Bring in the patman libraries # Bring in the patman libraries
our_path = os.path.dirname(os.path.realpath(__file__)) our_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(our_path, '../patman'))
from buildman import board from buildman import board
from buildman import bsettings from buildman import bsettings
......
...@@ -32,7 +32,6 @@ import unittest ...@@ -32,7 +32,6 @@ import unittest
# Bring in the patman libraries # Bring in the patman libraries
our_path = os.path.dirname(os.path.realpath(__file__)) our_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(our_path, '../patman'))
sys.path.append(os.path.join(our_path, '..')) sys.path.append(os.path.join(our_path, '..'))
# Bring in the libfdt module # Bring in the libfdt module
......
...@@ -14,8 +14,7 @@ import unittest ...@@ -14,8 +14,7 @@ import unittest
# Bring in the patman libraries # Bring in the patman libraries
our_path = os.path.dirname(os.path.realpath(__file__)) our_path = os.path.dirname(os.path.realpath(__file__))
for dirname in ['../patman', '..']: sys.path.insert(1, os.path.join(our_path, '..'))
sys.path.insert(0, os.path.join(our_path, dirname))
from dtoc import fdt from dtoc import fdt
from dtoc import fdt_util from dtoc import fdt_util
......
...@@ -22,8 +22,7 @@ import sys ...@@ -22,8 +22,7 @@ import sys
import tempfile import tempfile
import time import time
sys.path.insert(1, os.path.join(os.path.dirname(__file__), 'buildman')) from buildman import kconfiglib
import kconfiglib
### constant variables ### ### constant variables ###
OUTPUT_FILE = 'boards.cfg' OUTPUT_FILE = 'boards.cfg'
......
...@@ -314,8 +314,6 @@ import tempfile ...@@ -314,8 +314,6 @@ import tempfile
import threading import threading
import time import time
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(os.path.dirname(__file__), 'patman'))
from buildman import bsettings from buildman import bsettings
from buildman import kconfiglib from buildman import kconfiglib
from buildman import toolchain from buildman import toolchain
......
...@@ -13,7 +13,7 @@ import sys ...@@ -13,7 +13,7 @@ import sys
import unittest import unittest
if __name__ == "__main__": if __name__ == "__main__":
# Allow 'import xxx to work' # Allow 'from patman import xxx to work'
our_path = os.path.dirname(os.path.realpath(__file__)) our_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(our_path, '..')) sys.path.append(os.path.join(our_path, '..'))
......
...@@ -30,7 +30,6 @@ import sys ...@@ -30,7 +30,6 @@ import sys
# Bring in the patman libraries # Bring in the patman libraries
our_path = os.path.dirname(os.path.realpath(__file__)) our_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(our_path, '../tools/patman'))
from patman import command from patman import command
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册