Make compiler dependencies optional

This commit is contained in:
Daniel G. Taylor
2019-10-22 21:08:30 -07:00
parent 5dae20970b
commit 109dc5a8a5
3 changed files with 17 additions and 5 deletions

View File

@@ -8,7 +8,13 @@ import sys
import textwrap
from typing import Any, List, Tuple
import jinja2
try:
import jinja2
except ImportError:
print(
"Unable to import `jinja2`. Did you install the compiler feature with `pip install betterproto[compiler]`?"
)
raise SystemExit(1)
from google.protobuf.compiler import plugin_pb2 as plugin
from google.protobuf.descriptor_pb2 import (