Skip to content

Commit 8474c28

Browse files
committed
warpinator-launch.py: Get rid of pre-populated google namespace
from sys.modules. The system path is pre-seeded to /usr/lib/..../dist-packages/google, so our relative import from /usr/libexec/warpinator/google/protobuf fails when using bundled grpc/protobuf.
1 parent 599a871 commit 8474c28

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/warpinator-launch.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@
6666

6767
import config
6868

69+
# A system-installed google_auth (or similar) can pre-seed sys.modules['google']
70+
# via a .pth file, pointing its __path__ only at the system location and
71+
# preventing our bundled google/__init__.py from running. Drop the pre-seeded
72+
# entry so the normal import machinery picks up our bundled copy via sys.path.
73+
if config.bundle_grpc:
74+
sys.modules.pop("google", None)
75+
6976
# Remove xapp from GTK3_MODULES if this is a flatpak.
7077
if config.FLATPAK_BUILD:
7178
mods_str = os.environ.get("GTK3_MODULES")

0 commit comments

Comments
 (0)