Mark py3 venv as default buildpack

pull/42/head
yuvipanda 2017-07-29 17:14:49 -07:00
rodzic b23f088ae8
commit b187df0637
3 zmienionych plików z 30 dodań i 13 usunięć

Wyświetl plik

@ -19,7 +19,7 @@ import escapism
from traitlets.config import Application, LoggingConfigurable
from traitlets import Type, Bool, Unicode, Dict, List, default
from traitlets import Type, Bool, Unicode, Dict, List, default, Tuple
import docker
from docker.utils import kwargs_from_env
@ -81,6 +81,15 @@ class Repo2Docker(Application):
"""
)
default_buildpack = Tuple(
(BaseImage, PythonBuildPack),
config=True,
help="""
The build pack to use when no buildpacks are found
"""
)
cleanup_checkout = Bool(
True,
config=True,
@ -299,21 +308,23 @@ class Repo2Docker(Application):
)
os.chdir(checkout_path)
picked_buildpack = c(self.default_buildpack)
for bp_spec in self.buildpacks:
bp = c(bp_spec)
if bp.detect():
self.log.info('Using %s builder\n', bp.name, extra=dict(phase='building'))
for l in bp.build(self.output_image_spec):
if 'stream' in l:
self.log.info(l['stream'], extra=dict(phase='building'))
elif 'error' in l:
self.log.info(l['error'], extra=dict(phase='failure'))
sys.exit(1)
else:
self.log.info(json.dumps(l), extra=dict(phase='building'))
picked_buildpack = bp
break
else:
raise Exception("No builder found!")
self.log.info('Using %s builder\n', bp.name, extra=dict(phase='building'))
for l in picked_buildpack.build(self.output_image_spec):
if 'stream' in l:
self.log.info(l['stream'], extra=dict(phase='building'))
elif 'error' in l:
self.log.info(l['error'], extra=dict(phase='failure'))
sys.exit(1)
else:
self.log.info(json.dumps(l), extra=dict(phase='building'))
if self.repo_type != 'local' and self.cleanup_checkout:
shutil.rmtree(checkout_path)

Wyświetl plik

@ -537,7 +537,7 @@ class PythonBuildPack(BuildPack):
return []
def detect(self):
return os.path.exists('requirements.txt') and super()
return os.path.exists('requirements.txt') and super().detect()
class CondaBuildPack(BuildPack):
name = "conda"

Wyświetl plik

@ -0,0 +1,6 @@
#!/usr/bin/env python
# Verify that the default just provides a py3 environment with jupyter
import sys
assert sys.version_info[:2] == (3, 5)
import jupyter