use bundled s2i by adding package to PATH
MODIFY
repo2docker/app.py
repo2docker/app.py
@@ -144,7 +144,7 @@ class Repo2Docker(Application):
sys.exit(1)
try:
- for line in execute_cmd(['git', 'reset', '--hard', ref], checkout_path):
+ for line in execute_cmd(['git', 'reset', '--hard', ref], cwd=checkout_path):
self.log.info(line, extra=dict(phase='fetching'))
except subprocess.CalledProcessError:
self.log.error('Failed to check out ref %s', ref, extra=dict(phase='failed'))

MODIFY
repo2docker/detectors.py
repo2docker/detectors.py
@@ -12,6 +12,7 @@ from pythonjsonlogger import jsonlogger
from .utils import execute_cmd
+here = os.path.abspath(os.path.dirname(__file__))
class BuildPack(LoggingConfigurable):
name = Unicode()
@@ -73,8 +74,10 @@ class S2IBuildPack(BuildPack):
build_image,
output_image_spec,
]
+ env = os.environ.copy()
+ env['PATH'] = os.pathsep.join([here, env.get('PATH') or os.defpath])
try:
- for line in execute_cmd(cmd, cwd=workdir):
+ for line in execute_cmd(cmd, cwd=workdir, env=env):
self.log.info(line, extra=dict(phase='building', builder=self.name))
except subprocess.CalledProcessError:
self.log.error('Failed to build image!', extra=dict(phase='failed'))

MODIFY
repo2docker/utils.py
repo2docker/utils.py
import subprocess
-def execute_cmd(cmd, cwd=None):
+def execute_cmd(cmd, **kwargs):
"""
Call given command, yielding output line by line
"""
- proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, cwd=cwd)
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, **kwargs)
try:
for line in iter(proc.stdout.readline, ''):

use bundled s2i by adding package to PATH