Skip to content

Commit c3b3eb5

Browse files
jstancekkuba-moo
authored andcommitted
tools: ynl: add script dir to sys.path
Python options like PYTHONSAFEPATH or -P [1] do not add script directory to PYTHONPATH. ynl depends on this path to build and run. [1] This option is default for Fedora rpmbuild since introduction of https://fedoraproject.org/wiki/Changes/PythonSafePath Signed-off-by: Jan Stancek <jstancek@redhat.com> Acked-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/b26537cdb6e1b24435b50b2ef81d71f31c630bc1.1731399562.git.jstancek@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 5c46638 commit c3b3eb5

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

tools/net/ynl/cli.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33

44
import argparse
55
import json
6+
import pathlib
67
import pprint
8+
import sys
79
import time
810
import signal
911

12+
sys.path.append(pathlib.Path(__file__).resolve().parent.as_posix())
1013
from lib import YnlFamily, Netlink, NlError
1114

1215

tools/net/ynl/ethtool.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33

44
import argparse
55
import json
6+
import pathlib
67
import pprint
78
import sys
89
import re
910
import os
1011

12+
sys.path.append(pathlib.Path(__file__).resolve().parent.as_posix())
1113
from lib import YnlFamily
1214

1315
def args_to_req(ynl, op_name, args, req):

tools/net/ynl/ynl-gen-c.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
import argparse
55
import collections
66
import filecmp
7+
import pathlib
78
import os
89
import re
910
import shutil
11+
import sys
1012
import tempfile
1113
import yaml
1214

15+
sys.path.append(pathlib.Path(__file__).resolve().parent.as_posix())
1316
from lib import SpecFamily, SpecAttrSet, SpecAttr, SpecOperation, SpecEnumSet, SpecEnumEntry
1417

1518

0 commit comments

Comments
 (0)