Skip to content

Commit

Permalink
fix: Fix namespace packages conflict issue (#757)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
vam-google committed Feb 1, 2021
1 parent 6bd6415 commit 8035662
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions gapic/cli/generate_with_pandoc.py
@@ -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.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 8035662

Please sign in to comment.