Do not fail when gen_protos cannot be imported
Project: http://git-wip-us.apache.org/repos/asf/beam/repo Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/ae3dc5f3 Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/ae3dc5f3 Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/ae3dc5f3 Branch: refs/heads/DSL_SQL Commit: ae3dc5f313ad55f3f86805b9f220bd1cdf1c902b Parents: a054550 Author: Ahmet Altay <[email protected]> Authored: Thu Jun 1 11:29:42 2017 -0700 Committer: Ahmet Altay <[email protected]> Committed: Tue Jun 6 12:58:26 2017 -0700 ---------------------------------------------------------------------- sdks/python/setup.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/beam/blob/ae3dc5f3/sdks/python/setup.py ---------------------------------------------------------------------- diff --git a/sdks/python/setup.py b/sdks/python/setup.py index 596c8c5..051043b 100644 --- a/sdks/python/setup.py +++ b/sdks/python/setup.py @@ -125,14 +125,18 @@ GCP_REQUIREMENTS = [ # 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(
