reformat base

This commit is contained in:
Divyansh Singh 2023-03-23 01:08:30 +05:30
parent 8a63c49498
commit 7a2f287918
2 changed files with 13 additions and 15 deletions

View file

@ -84,10 +84,9 @@ def normalize(config_filename, config):
}
)
elif repository.startswith('ssh://'):
config['location']['repositories'].append({
'path': repository,
'label': repository_dict.get('label', None),
})
config['location']['repositories'].append(
{'path': repository, 'label': repository_dict.get('label', None),}
)
else:
rewritten_repository = f"ssh://{repository.replace(':~', '/~').replace(':/', '/').replace(':', '/./')}"
logs.append(
@ -99,16 +98,12 @@ def normalize(config_filename, config):
)
)
)
config['location']['repositories'].append({
'path': rewritten_repository,
'label': repository_dict.get('label', None),
})
config['location']['repositories'].append(
{'path': rewritten_repository, 'label': repository_dict.get('label', None),}
)
else:
config['location']['repositories'].append(
{
'path': repository,
'label': repository_dict.get('label', None),
}
{'path': repository, 'label': repository_dict.get('label', None),}
)
return logs

View file

@ -141,10 +141,13 @@ def repositories_match(first, second):
Given two repository dicts with keys 'path' (relative and/or absolute),
and 'label', return whether they match.
'''
if isinstance(first,str) and isinstance(second,str):
if isinstance(first, str) and isinstance(second, str):
return normalize_repository_path(first) == normalize_repository_path(second)
elif isinstance(first,dict) and isinstance(second,str):
return (second == first.get('label')) or (normalize_repository_path(second) == normalize_repository_path(first.get('path')))
elif isinstance(first, dict) and isinstance(second, str):
return (second == first.get('label')) or (
normalize_repository_path(second) == normalize_repository_path(first.get('path'))
)
def guard_configuration_contains_repository(repository, configurations):
'''