magcms/prosopopoee

29 lines
862 B
Plaintext
Raw Normal View History

2015-12-03 06:09:29 +01:00
#!/usr/bin/env python
import os
2015-12-08 06:57:17 +01:00
import sys
2015-12-08 07:04:07 +01:00
import yaml
2015-12-08 06:55:01 +01:00
def main():
if not os.path.exists(os.path.join(os.getcwd(), "settings.yaml")):
2015-12-08 07:18:32 +01:00
sys.stderr.write("I can't find a settings.yaml in the current working directory, abort\n")
2015-12-08 06:57:17 +01:00
sys.exit(1)
settings = yaml.safe_load("settings.yaml")
2015-12-08 07:04:07 +01:00
assert settings.get("title"), "You should specify a title in your main settings.yaml"
2015-12-08 07:11:55 +01:00
dirs = filter(lambda x: x not in (".", "..") and os.path.isdir(x) and os.path.exists(os.path.join(os.getcwd(), x, "settings.yaml")), os.listdir(os.getcwd()))
if not dirs:
sys.stderr.write("I can't find at least one directory with a settings.yaml in the current working directory, you don't have any gallery?\nAbort\n")
sys.exit(1)
2015-12-08 06:55:01 +01:00
if not os.path.exists("build"):
os.makedirs("build")
if __name__ == '__main__':
main()