Commit ec81c0c6 authored by Nicolas Delaby's avatar Nicolas Delaby

Bug fix

Avoid concatenation of None and string vlaues if profile_path is defined later in vcs_repository_list.
parent 1f3745c7
......@@ -109,7 +109,7 @@ def run(config):
custom_profile_path = os.path.join(config['working_directory'], 'software.cfg')
config['custom_profile_path'] = custom_profile_path
vcs_repository_list = config['vcs_repository_list']
profile_content = None
profile_content = ''
assert len(vcs_repository_list), "we must have at least one repository"
try:
# BBB: Accept global profile_path, which is the same as setting it for the
......@@ -119,6 +119,7 @@ def run(config):
pass
else:
vcs_repository_list[0][PROFILE_PATH_KEY] = profile_path
profile_path_count = 0
for vcs_repository in vcs_repository_list:
url = vcs_repository['url']
buildout_section_id = vcs_repository.get('buildout_section_id', None)
......@@ -132,7 +133,8 @@ def run(config):
except KeyError:
pass
else:
if profile_content is not None:
profile_path_count += 1
if profile_path_count > 1:
raise ValueError(PROFILE_PATH_KEY + ' defined more than once')
profile_content = """
[buildout]
......@@ -148,7 +150,7 @@ branch = %(branch)s
'repository_path' : repository_path,
'branch' : vcs_repository.get('branch','master')}
if profile_content is None:
if not profile_path_count:
raise ValueError(PROFILE_PATH_KEY + ' not defined')
custom_profile = open(custom_profile_path, 'w')
custom_profile.write(profile_content)
......
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