Move cleanup_checkout automatic determination to main()
This is automaticaly determined only from commandline args,
so it should be in __main__
MODIFY
repo2docker/__main__.py
repo2docker/__main__.py
import argparse
import sys
+import os
from .app import Repo2Docker
from . import __version__
from .utils import validate_and_generate_port_mapping
@@ -299,6 +300,12 @@ def make_r2d(argv=None):
r2d.environment = args.environment
+ # if the source exists locally we don't want to delete it at the end
+ if os.path.exists(args.repo):
+ r2d.cleanup_checkout = False
+ else:
+ r2d.cleanup_checkout = args.clean
+
return r2d

MODIFY
repo2docker/app.py
repo2docker/app.py
@@ -391,12 +391,6 @@ class Repo2Docker(Application):
fmt='%(message)s'
)
- # if the source exists locally we don't want to delete it at the end
- if os.path.exists(self.repo):
- self.cleanup_checkout = False
- else:
- self.cleanup_checkout = args.clean
-
if self.output_image_spec == "":
# Attempt to set a sane default!
# HACK: Provide something more descriptive?

Move cleanup_checkout automatic determination to main()

This is automaticaly determined only from commandline args,
so it should be in __main__