Commit d157d8a1 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

script option: fix IndentationError with buildout 2, if some lines are indented.

parent e4d1eb12
......@@ -28,6 +28,7 @@ import errno
import logging
import os
from platform import uname
import re
import setuptools
import shlex
import shutil
......@@ -271,8 +272,12 @@ class Script(EnvironMixin):
for k in 'url', 'md5sum', 'path':
self.options[k] = self.options.get(k, '').strip()
self.script = self.options['script']
if self.options.get('format', 'yes') in TRUE_LIST:
if self.script:
if self.options.get('format', 'yes') in TRUE_LIST:
self.script = self.script % self.options
if re.match(r'^\s', self.script):
# Buildout 2 keeps all indentation unless all lines have the same indentation.
self.script = 'if True:\n' + self.script
if self.options.get('keep-on-error', '').strip().lower() in TRUE_LIST:
self.logger.debug('Keeping directories in case of errors')
self.keep_on_error = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment