Przeglądaj źródła

Use kconfiglib from $IDF_PATH/tools/kconfig_new

Roland Dobai 6 lat temu
rodzic
commit
1dcdc56a7f

+ 6 - 1
tools/kconfig_new/confgen.py

@@ -30,7 +30,12 @@ import sys
 import tempfile
 
 import gen_kconfig_doc
-import kconfiglib
+
+try:
+    from . import kconfiglib
+except Exception:
+    sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
+    import kconfiglib
 
 __version__ = "0.1"
 

+ 6 - 1
tools/kconfig_new/confserver.py

@@ -7,12 +7,17 @@ from __future__ import print_function
 import argparse
 import confgen
 import json
-import kconfiglib
 import os
 import sys
 import tempfile
 from confgen import FatalError, __version__
 
+try:
+    from . import kconfiglib
+except Exception:
+    sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
+    import kconfiglib
+
 # Min/Max supported protocol versions
 MIN_PROTOCOL_VERSION = 1
 MAX_PROTOCOL_VERSION = 2

+ 8 - 1
tools/kconfig_new/gen_kconfig_doc.py

@@ -21,8 +21,15 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 from __future__ import print_function
+import os
 import re
-import kconfiglib
+import sys
+
+try:
+    from . import kconfiglib
+except Exception:
+    sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
+    import kconfiglib
 
 # Indentation to be used in the generated file
 INDENT = '    '

+ 3 - 3
tools/ldgen/sdkconfig.py

@@ -19,11 +19,11 @@ from pyparsing import Word, alphanums, printables, Combine, Literal, hexnums, qu
 
 import sys
 try:
-    import kconfiglib
-except ImportError:
+    from . import kconfiglib
+except Exception:
     parent_dir_name = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
     kconfig_new_dir = os.path.abspath(parent_dir_name + "/kconfig_new")
-    sys.path.append(kconfig_new_dir)
+    sys.path.insert(0, kconfig_new_dir)
     import kconfiglib