[mod] refactor

This commit is contained in:
Laurent Peuch 2015-12-08 07:04:07 +01:00
parent f8f71ee98b
commit 263757a278

View File

@ -2,13 +2,19 @@
import os import os
import sys import sys
import yaml
SETTINGS_NAME = ("settings.yaml", "settings.yml")
def main(): 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.stderr.write("I can't find a settings.yaml or settings.yml, abort\n")
sys.exit(1) 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"): if not os.path.exists("build"):
os.makedirs("build") os.makedirs("build")