Skip to content

Commit 8035662

Browse files
authored
fix: Fix namespace packages conflict issue (#757)
* fix: Fix namespace packages conflict issue This fixes the googleapis/gapic-generator#3334 by excluding system-wide site-packages dir from python packages resolution path completely. This pretty much implements the long-standing featrue request for rules_python bazelbuild/bazel#4939, but only in scope of gapic-generator-python. * Format with autopep8
1 parent 6bd6415 commit 8035662

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

gapic/cli/generate_with_pandoc.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import os
2-
3-
from gapic.cli import generate
2+
import sys
43

54
if __name__ == '__main__':
65
os.environ['PYPANDOC_PANDOC'] = os.path.join(
76
os.path.abspath(__file__).rsplit("gapic", 1)[0], "pandoc")
87
os.environ['LC_ALL'] = 'C.UTF-8'
9-
generate.generate()
8+
os.environ['PYTHONNOUSERSITE'] = 'True'
9+
10+
entry_point_script = os.path.join(
11+
os.path.dirname(os.path.abspath(__file__)), "generate.py")
12+
args = [sys.executable, entry_point_script] + sys.argv[1:]
13+
14+
os.execv(args[0], args)

0 commit comments

Comments
 (0)