From 8b26bbe4e0ace6180147e6cea5a56612888e2800 Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Mon, 17 Dec 2018 15:32:17 -0800 Subject: [PATCH] Allow setting REPO_PATH from commandline --- repo2docker/__main__.py | 8 ++++++++ repo2docker/app.py | 13 ++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/repo2docker/__main__.py b/repo2docker/__main__.py index d0e01d14..bb658f75 100644 --- a/repo2docker/__main__.py +++ b/repo2docker/__main__.py @@ -168,6 +168,11 @@ def get_argparser(): help='Use the local repository in edit mode', ) + argparser.add_argument( + '--repo-path', + help=Repo2Docker.repo_path.help + ) + argparser.add_argument( '--appendix', type=str, @@ -316,6 +321,9 @@ def make_r2d(argv=None): else: r2d.cleanup_checkout = args.clean + if args.repo_path: + r2d.repo_path = args.repo_path + return r2d diff --git a/repo2docker/app.py b/repo2docker/app.py index 64daabe0..986e7d13 100644 --- a/repo2docker/app.py +++ b/repo2docker/app.py @@ -327,6 +327,16 @@ class Repo2Docker(Application): config=True ) + repo_path = Unicode( + '$HOME', + help=""" + Path inside the image where contents of the repositories are copied to. + + Build arguments in this are expanded. + """, + config=True + ) + def fetch(self, url, ref, checkout_path): """Fetch the contents of `url` and place it in `checkout_path`. @@ -593,7 +603,8 @@ class Repo2Docker(Application): if not self.dry_run: build_args = { 'NB_USER': self.user_name, - 'NB_UID': str(self.user_id) + 'NB_UID': str(self.user_id), + 'REPO_PATH': self.repo_path } self.log.info('Using %s builder\n', bp.__class__.__name__, extra=dict(phase='building'))