]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xdrgen: Make the xdrgen script location-independent
authorChuck Lever <chuck.lever@oracle.com>
Mon, 27 Oct 2025 13:56:32 +0000 (09:56 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Tue, 25 Nov 2025 14:09:42 +0000 (09:09 -0500)
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>
tools/net/sunrpc/xdrgen/xdrgen

index 43762be39252d3b1f1c5a9d4fae53acf410a07c8..3afd0547d67c3f3c47c4166380bf92a6006911e9 100755 (executable)
@@ -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