summaryrefslogtreecommitdiff
path: root/tools/net/ynl/ethtool.py
diff options
context:
space:
mode:
authorRahul Rameshbabu <rrameshbabu@nvidia.com>2024-04-02 23:39:52 +0300
committerJakub Kicinski <kuba@kernel.org>2024-04-04 05:34:08 +0300
commitca3e10c4d83ad6bb611d07857aade7078c87ad99 (patch)
tree44ec0869d01a3ef668586259b1ab86a300ba9c65 /tools/net/ynl/ethtool.py
parenta9e4230d0b2202bf1f7dc7b80e034fb1a6df4f67 (diff)
downloadlinux-ca3e10c4d83ad6bb611d07857aade7078c87ad99.tar.xz
tools: ynl: ethtool.py: Make tool invokable from any CWD
ethtool.py depends on yml files in a specific location of the linux kernel tree. Using relative lookup for those files means that ethtool.py would need to be run under tools/net/ynl/. Lookup needed yml files without depending on the current working directory that ethtool.py is invoked from. Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com> Link: https://lore.kernel.org/r/20240402204000.115081-1-rrameshbabu@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/net/ynl/ethtool.py')
-rwxr-xr-xtools/net/ynl/ethtool.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/net/ynl/ethtool.py b/tools/net/ynl/ethtool.py
index 6c9f7e31250c..44ba3ba58ed9 100755
--- a/tools/net/ynl/ethtool.py
+++ b/tools/net/ynl/ethtool.py
@@ -6,6 +6,7 @@ import json
import pprint
import sys
import re
+import os
from lib import YnlFamily
@@ -152,8 +153,11 @@ def main():
global args
args = parser.parse_args()
- spec = '../../../Documentation/netlink/specs/ethtool.yaml'
- schema = '../../../Documentation/netlink/genetlink-legacy.yaml'
+ script_abs_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
+ spec = os.path.join(script_abs_dir,
+ '../../../Documentation/netlink/specs/ethtool.yaml')
+ schema = os.path.join(script_abs_dir,
+ '../../../Documentation/netlink/genetlink-legacy.yaml')
ynl = YnlFamily(spec, schema)