beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rober...@apache.org
Subject [2/3] incubator-beam git commit: Pushing check down. Rewritting error message
Date Mon, 31 Oct 2016 16:04:23 GMT
Pushing check down. Rewritting error message


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/32f3214c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/32f3214c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/32f3214c

Branch: refs/heads/python-sdk
Commit: 32f3214cc301b0eb9ac7120a901ac4f1930ed30f
Parents: a68c246
Author: Pablo <pabloem@google.com>
Authored: Thu Oct 27 09:45:03 2016 -0700
Committer: Robert Bradshaw <robertwb@gmail.com>
Committed: Mon Oct 31 09:04:05 2016 -0700

----------------------------------------------------------------------
 sdks/python/apache_beam/utils/dependency.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/32f3214c/sdks/python/apache_beam/utils/dependency.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/dependency.py b/sdks/python/apache_beam/utils/dependency.py
index 04f869a..addcdb2 100644
--- a/sdks/python/apache_beam/utils/dependency.py
+++ b/sdks/python/apache_beam/utils/dependency.py
@@ -435,13 +435,7 @@ def _stage_dataflow_sdk_tarball(sdk_remote_location, staged_path, temp_dir):
     _dependency_file_copy(sdk_remote_location, staged_path)
   elif sdk_remote_location == 'pypi':
     logging.info('Staging the SDK tarball from PyPI to %s', staged_path)
-    import pkg_resources as pkg
-    try:
-      _dependency_file_copy(_download_pypi_sdk_package(temp_dir), staged_path)
-    except pkg.DistributionNotFound:
-      raise RuntimeError('Unable to stage SDK tarball. '
-                         'Provide --sdk_location, check remote location, '
-                         'or provide google-cloud-dataflow repository.')
+    _dependency_file_copy(_download_pypi_sdk_package(temp_dir), staged_path)
   else:
     raise RuntimeError(
         'The --sdk_location option was used with an unsupported '
@@ -482,7 +476,13 @@ def _download_pypi_sdk_package(temp_dir):
   """Downloads SDK package from PyPI and returns path to local path."""
   # TODO(silviuc): Handle apache-beam versions when we have official releases.
   import pkg_resources as pkg
-  version = pkg.get_distribution(GOOGLE_PACKAGE_NAME).version
+  try:
+    version = pkg.get_distribution(GOOGLE_PACKAGE_NAME).version
+  except pkg.DistributionNotFound:
+    raise RuntimeError('Please set --sdk_location command-line option '
+                       'or install a valid {} distribution.'
+                       .format(GOOGLE_PACKAGE_NAME))
+
   # Get a source distribution for the SDK package from PyPI.
   cmd_args = [
       _get_python_executable(), '-m', 'pip', 'install', '--download', temp_dir,


Mime
View raw message