You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2016/09/26 17:58:40 UTC

[1/2] incubator-beam git commit: Add BEAM_PYTHON environment override to set the python executable

Repository: incubator-beam
Updated Branches:
  refs/heads/python-sdk 753cc9c2e -> bb649061f


Add BEAM_PYTHON environment override to set the python executable


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

Branch: refs/heads/python-sdk
Commit: 26eb336ae63dceefae876d6bc8ff742d2670567b
Parents: 753cc9c
Author: Scott Wegner <sw...@google.com>
Authored: Mon Sep 26 10:05:01 2016 -0700
Committer: Robert Bradshaw <ro...@google.com>
Committed: Mon Sep 26 10:58:11 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/26eb336a/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 e9d73ae..150b2fc 100644
--- a/sdks/python/apache_beam/utils/dependency.py
+++ b/sdks/python/apache_beam/utils/dependency.py
@@ -189,13 +189,23 @@ def _stage_extra_packages(extra_packages, staging_location, temp_dir,
   return resources
 
 
+def _get_python_executable():
+  # Allow overriding the python executable to use for downloading and
+  # installing dependencies, otherwise use the python executable for
+  # the current process.
+  beam_python = os.environ.get('BEAM_PYTHON') or sys.executable
+  if not python_bin:
+    raise ValueError('Could not find Python executable.')
+  return python_bin
+
+
 def _populate_requirements_cache(requirements_file, cache_dir):
   # The 'pip download' command will not download again if it finds the
   # tarball with the proper version already present.
   # It will get the packages downloaded in the order they are presented in
   # the requirements file and will not download package dependencies.
   cmd_args = [
-      sys.executable, '-m', 'pip', 'install', '--download', cache_dir,
+      _get_python_executable(), '-m', 'pip', 'install', '--download', cache_dir,
       '-r', requirements_file,
       # Download from PyPI source distributions.
       '--no-binary', ':all:']
@@ -375,7 +385,7 @@ def _build_setup_package(setup_file, temp_dir, build_setup_args=None):
     os.chdir(os.path.dirname(setup_file))
     if build_setup_args is None:
       build_setup_args = [
-          sys.executable, os.path.basename(setup_file),
+          _get_python_executable(), os.path.basename(setup_file),
           'sdist', '--dist-dir', temp_dir]
     logging.info('Executing command: %s', build_setup_args)
     processes.check_call(build_setup_args)
@@ -461,7 +471,7 @@ def _download_pypi_sdk_package(temp_dir):
   version = pkg.get_distribution(GOOGLE_PACKAGE_NAME).version
   # Get a source distribution for the SDK package from PyPI.
   cmd_args = [
-      sys.executable, '-m', 'pip', 'install', '--download', temp_dir,
+      _get_python_executable(), '-m', 'pip', 'install', '--download', temp_dir,
       '%s==%s' % (GOOGLE_PACKAGE_NAME, version),
       '--no-binary', ':all:', '--no-deps']
   logging.info('Executing command: %s', cmd_args)


[2/2] incubator-beam git commit: Closes #1006

Posted by ro...@apache.org.
Closes #1006


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

Branch: refs/heads/python-sdk
Commit: bb649061f46867c9721e82963e91ac6fe1387245
Parents: 753cc9c 26eb336
Author: Robert Bradshaw <ro...@google.com>
Authored: Mon Sep 26 10:58:15 2016 -0700
Committer: Robert Bradshaw <ro...@google.com>
Committed: Mon Sep 26 10:58:15 2016 -0700

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