summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2025-10-27 09:56:32 -0400
committerChuck Lever <chuck.lever@oracle.com>2025-11-25 09:09:42 -0500
commit3bd937b49a2e0d45450c9326e288c8d1612e8ecd (patch)
tree16bcf1345fb4ddf5e2ece59568d2cdc5225e6840
parent75a9b40f3b14d1cc3771c463d32b71cf4e558246 (diff)
xdrgen: Make the xdrgen script location-independent
The @pythondir@ placeholder is meant for build-time substitution, such as with autoconf. autoconf is not used in the kernel. Let's replace that mechanism with one that better enables the xdrgen script to be run from any directory. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
-rwxr-xr-xtools/net/sunrpc/xdrgen/xdrgen5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/net/sunrpc/xdrgen/xdrgen b/tools/net/sunrpc/xdrgen/xdrgen
index 43762be39252..3afd0547d67c 100755
--- a/tools/net/sunrpc/xdrgen/xdrgen
+++ b/tools/net/sunrpc/xdrgen/xdrgen
@@ -10,8 +10,13 @@ __license__ = "GPL-2.0 only"
__version__ = "0.2"
import sys
+from pathlib import Path
import argparse
+_XDRGEN_DIR = Path(__file__).resolve().parent
+if str(_XDRGEN_DIR) not in sys.path:
+ sys.path.insert(0, str(_XDRGEN_DIR))
+
from subcmds import definitions
from subcmds import declarations
from subcmds import lint