Added a check to make sure a formula's name was defined
This commit is contained in:
parent
766eaa21c3
commit
0fcf086e0d
@ -40,7 +40,7 @@ def get_formulas(formulas, formulas_dir, formulas_url):
|
|||||||
else:
|
else:
|
||||||
print('Downloading ' + git_url + ' into ' + local_path)
|
print('Downloading ' + git_url + ' into ' + local_path)
|
||||||
# clone git repo
|
# clone git repo
|
||||||
Repo.clone_from(git_url, local_path)
|
#Repo.clone_from(git_url, local_path)
|
||||||
|
|
||||||
# parses a formula entry, and then returns the target git URL and the destination for the clone
|
# parses a formula entry, and then returns the target git URL and the destination for the clone
|
||||||
def parse_formula_entry(formula, formulas_dir, formulas_url):
|
def parse_formula_entry(formula, formulas_dir, formulas_url):
|
||||||
@ -51,7 +51,15 @@ def parse_formula_entry(formula, formulas_dir, formulas_url):
|
|||||||
# check if the formula entry is a string or a dictionary
|
# check if the formula entry is a string or a dictionary
|
||||||
if isinstance(formula, dict):
|
if isinstance(formula, dict):
|
||||||
# entry is a dictionary
|
# entry is a dictionary
|
||||||
git_url = str(formula.get('url', formulas_url)) # get the 'url' value if it is defined, otherwise use the default
|
# check if the formula's name was defined
|
||||||
|
if not 'name' in formula:
|
||||||
|
# set the formula's name if need be
|
||||||
|
formula['name'] = [k for (k, v) in formula.iteritems() if v == 0]
|
||||||
|
# check if the dictionary has a git URL defined
|
||||||
|
if 'url' in formula:
|
||||||
|
git_url = str(formula['url'])
|
||||||
|
else:
|
||||||
|
git_url = str(formulas_url) + str(formula) + '-formula'
|
||||||
local_path = str(formulas_dir) + '/' + str(formula['name'])
|
local_path = str(formulas_dir) + '/' + str(formula['name'])
|
||||||
elif isinstance(formula, str):
|
elif isinstance(formula, str):
|
||||||
# entry is a string
|
# entry is a string
|
||||||
|
Loading…
Reference in New Issue
Block a user