From 930a1e3d1e61d32308fc1b0c723ae94d962d71a8 Mon Sep 17 00:00:00 2001 From: Ahmet Altay Date: Thu, 1 Jun 2017 11:29:42 -0700 Subject: [PATCH] Do not fail when gen_protos cannot be imported --- sdks/python/setup.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sdks/python/setup.py b/sdks/python/setup.py index 596c8c51afb0..051043b07e7f 100644 --- a/sdks/python/setup.py +++ b/sdks/python/setup.py @@ -125,14 +125,18 @@ def get_version(): # We must generate protos after setup_requires are installed. def generate_protos_first(original_cmd): - # See https://issues.apache.org/jira/browse/BEAM-2366 - # pylint: disable=wrong-import-position - import gen_protos - class cmd(original_cmd, object): - def run(self): - gen_protos.generate_proto_files() - super(cmd, self).run() - return cmd + try: + # See https://issues.apache.org/jira/browse/BEAM-2366 + # pylint: disable=wrong-import-position + import gen_protos + class cmd(original_cmd, object): + def run(self): + gen_protos.generate_proto_files() + super(cmd, self).run() + return cmd + except ImportError: + warnings.warn("Could not import gen_protos, skipping proto generation.") + return original_cmd setuptools.setup(