Skip to content

Commit

Permalink
Problem: mr.developer broken by CLI arg to avoid endless loop
Browse files Browse the repository at this point in the history
Solution: use environment variable instead
  • Loading branch information
gotcha committed Mar 2, 2021
1 parent 3645619 commit c2d6341
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/zc/buildout/buildout.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ def _maybe_upgrade(self):
# If they do, do the upgrade and restart the buildout process.
__doing__ = 'Checking for upgrades.'

if self['buildout'].get('restart-after-upgrade', '') == 'true':
if 'BUILDOUT_RESTART_AFTER_UPGRADE' in os.environ:
return

if not self.newest:
Expand Down Expand Up @@ -1172,11 +1172,11 @@ def _maybe_upgrade(self):

# Restart
args = sys.argv[:]
args.insert(1, '--restart-after-upgrade')
if not __debug__:
args.insert(0, '-O')
args.insert(0, sys.executable)
sys.exit(subprocess.call(args))
env=dict(os.environ, BUILDOUT_RESTART_AFTER_UPGRADE='1')
sys.exit(subprocess.call(args, env=env))

def _load_extensions(self):
__doing__ = 'Loading extensions.'
Expand Down Expand Up @@ -2161,8 +2161,6 @@ def main(args=None):
_help()
elif orig_op == '--version':
_version()
elif orig_op == '--restart-after-upgrade':
options.append(('buildout', 'restart-after-upgrade', "true"))
else:
_error("Invalid option", '-'+op[0])
elif '=' in args[0]:
Expand Down

0 comments on commit c2d6341

Please sign in to comment.