Skip to content

Commit

Permalink
Dactyl v0.6.2: better error on duplicate targets
Browse files Browse the repository at this point in the history
  • Loading branch information
mDuo13 committed Jun 9, 2017
1 parent 5c9ee0b commit d3964aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions dactyl/dactyl_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,16 @@ def load_config(config_file=DEFAULT_CONFIG_FILE, bypass_errors=False):

config.update(loaded_config)

targetnames = set([t["name"] for t in config["targets"]])
if len(targetnames) != len(config["targets"]):
recoverable_error("Duplicate or missing target name in config file",
bypass_errors)
targetnames = set()
for t in config["targets"]:
if "name" not in t:
logger.error("Target does not have required 'name' field: %s" % t)
exit(1)
elif t["name"] in targetnames:
recoverable_error("Duplicate target name in config file: '%s'" %
t["name"], bypass_errors)
targetnames.add(t["name"])

# Check page list for consistency and provide default values
for page in config["pages"]:
if "targets" not in page:
Expand Down
2 changes: 1 addition & 1 deletion dactyl/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.6.1'
__version__ = '0.6.2'

0 comments on commit d3964aa

Please sign in to comment.