diff options
author | Simon Glass <sjg@chromium.org> | 2020-04-18 03:09:04 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-04-26 23:25:21 +0300 |
commit | bf776679a73f3b9eae37aabd2be5754483039cb2 (patch) | |
tree | 939e4c78bc95bf5f8677be6b5fd4755de4609b7e /tools/dtoc | |
parent | 16287933a852bab2ac4985a770e08c9aa69d21b1 (diff) | |
download | u-boot-bf776679a73f3b9eae37aabd2be5754483039cb2.tar.xz |
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/dtoc')
-rw-r--r-- | tools/dtoc/dtb_platdata.py | 6 | ||||
-rw-r--r-- | tools/dtoc/fdt.py | 4 | ||||
-rw-r--r-- | tools/dtoc/fdt_util.py | 4 | ||||
-rwxr-xr-x | tools/dtoc/main.py | 5 | ||||
-rwxr-xr-x | tools/dtoc/test_dtoc.py | 10 | ||||
-rwxr-xr-x | tools/dtoc/test_fdt.py | 12 |
6 files changed, 21 insertions, 20 deletions
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 90a9e1a626..ecfe0624d1 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -15,9 +15,9 @@ import collections import copy import sys -import fdt -import fdt_util -import tools +from dtoc import fdt +from dtoc import fdt_util +from patman import tools # When we see these properties we ignore them - i.e. do not create a structure member PROP_IGNORE_LIST = [ diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 1b7b730359..188490b728 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -8,10 +8,10 @@ import struct import sys -import fdt_util +from dtoc import fdt_util import libfdt from libfdt import QUIET_NOTFOUND -import tools +from patman import tools # This deals with a device tree, presenting it as an assortment of Node and # Prop objects, representing nodes and properties, respectively. This file diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py index b105faec74..b040793772 100644 --- a/tools/dtoc/fdt_util.py +++ b/tools/dtoc/fdt_util.py @@ -13,8 +13,8 @@ import struct import sys import tempfile -import command -import tools +from patman import command +from patman import tools def fdt32_to_cpu(val): """Convert a device tree cell to an integer diff --git a/tools/dtoc/main.py b/tools/dtoc/main.py index b1eee21f17..6c63d637a7 100755 --- a/tools/dtoc/main.py +++ b/tools/dtoc/main.py @@ -33,14 +33,15 @@ import unittest # Bring in the patman libraries 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, '..')) # Bring in the libfdt module sys.path.insert(0, 'scripts/dtc/pylibfdt') sys.path.insert(0, os.path.join(our_path, '../../build-sandbox_spl/scripts/dtc/pylibfdt')) -import dtb_platdata -import test_util +from dtoc import dtb_platdata +from patman import test_util def run_tests(args): """Run all the test we have for dtoc diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index 9db97489d4..8498e8303c 100755 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -14,15 +14,15 @@ import os import struct import unittest -import dtb_platdata +from dtoc import dtb_platdata from dtb_platdata import conv_name_to_c from dtb_platdata import get_compat_name from dtb_platdata import get_value from dtb_platdata import tab_to -import fdt -import fdt_util -import test_util -import tools +from dtoc import fdt +from dtoc import fdt_util +from patman import test_util +from patman import tools our_path = os.path.dirname(os.path.realpath(__file__)) diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index 4f39a5589f..d68230713e 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -17,14 +17,14 @@ our_path = os.path.dirname(os.path.realpath(__file__)) for dirname in ['../patman', '..']: sys.path.insert(0, os.path.join(our_path, dirname)) -import command -import fdt +from dtoc import fdt +from dtoc import fdt_util +from dtoc.fdt_util import fdt32_to_cpu from fdt import TYPE_BYTE, TYPE_INT, TYPE_STRING, TYPE_BOOL, BytesToValue -import fdt_util -from fdt_util import fdt32_to_cpu import libfdt -import test_util -import tools +from patman import command +from patman import test_util +from patman import tools def _GetPropertyValue(dtb, node, prop_name): """Low-level function to get the property value based on its offset |