From 263757a278787ea5ef99a6782e9840351f927e1c Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Tue, 8 Dec 2015 07:04:07 +0100 Subject: [PATCH] [mod] refactor --- prosopopoee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/prosopopoee b/prosopopoee index 44b3d22..15b8229 100755 --- a/prosopopoee +++ b/prosopopoee @@ -2,13 +2,19 @@ import os import sys +import yaml + + +SETTINGS_NAME = ("settings.yaml", "settings.yml") def main(): - if not os.path.exists("settings.yaml") or not os.path.exists("settings.yml"): + if not any(map(lambda x: os.path.exists(os.path.join(os.getcwd(), x)), SETTINGS_NAME)): sys.stderr.write("I can't find a settings.yaml or settings.yml, abort\n") sys.exit(1) + settings = yaml.safe_load(filter(lambda x: os.path.exists(os.path.join(os.getcwd(), x)), SETTINGS_NAME)[0]) + if not os.path.exists("build"): os.makedirs("build")