OSDN Git Service

tools: ynl: move the cli and netlink code around
authorJakub Kicinski <kuba@kernel.org>
Tue, 31 Jan 2023 02:33:42 +0000 (18:33 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 1 Feb 2023 04:36:03 +0000 (20:36 -0800)
Move the CLI code out of samples/ and the library part
of it into tools/net/ynl/lib/. This way we can start
sharing some code with the code gen.

Initially I thought that code gen is too C-specific to
share anything but basic stuff like calculating values
for enums can easily be shared.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/cli.py [moved from tools/net/ynl/samples/cli.py with 97% similarity]
tools/net/ynl/lib/__init__.py [new file with mode: 0644]
tools/net/ynl/lib/ynl.py [moved from tools/net/ynl/samples/ynl.py with 100% similarity]

similarity index 97%
rename from tools/net/ynl/samples/cli.py
rename to tools/net/ynl/cli.py
index b27159c..5c4eb5a 100755 (executable)
@@ -6,7 +6,7 @@ import json
 import pprint
 import time
 
-from ynl import YnlFamily
+from lib import YnlFamily
 
 
 def main():
diff --git a/tools/net/ynl/lib/__init__.py b/tools/net/ynl/lib/__init__.py
new file mode 100644 (file)
index 0000000..0a61027
--- /dev/null
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: BSD-3-Clause
+
+from .ynl import YnlFamily
+
+__all__ = ["YnlFamily"]