Skip to content

Commit

Permalink
fix: Fix namespace packages conflict issue
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vam-google committed Jan 31, 2021
1 parent 6bd6415 commit ad54adf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions gapic/cli/generate_with_pandoc.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import os

from gapic.cli import generate
import sys

if __name__ == '__main__':
os.environ['PYPANDOC_PANDOC'] = os.path.join(
os.path.abspath(__file__).rsplit("gapic", 1)[0], "pandoc")
os.path.abspath(__file__).rsplit("gapic", 1)[0], "pandoc")
os.environ['LC_ALL'] = 'C.UTF-8'
generate.generate()
os.environ['PYTHONNOUSERSITE'] = 'True'

entry_point_script = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "generate.py")
args = [sys.executable, entry_point_script] + sys.argv[1:]

os.execv(args[0], args)

0 comments on commit ad54adf

Please sign in to comment.