Commits

Paul Tan  committed 9b72e74

Added makefile.

  • Participants
  • Parent commits 9ba2491

Comments (0)

Files changed (3)

+providers_src = $(wildcard providers/*.yaml)
+
+all: providers.json
+
+providers.json: $(providers_src)
+	./build.py $^ > $@
+
+clean:
+	rm -rf providers.json
+
+.PHONY: all clean
 - Python 3
 - PyYAML
 
-Run `build.py` in the root directory. This will create a file called 
+Run `make` in the root directory. This will create a file called 
 `providers.json`. Copy (or symlink) this file to the oauth1 local
 data directory (`~/.local/share/oauth1` or `/usr/share/oauth1`).
 
 from argparse import ArgumentParser
 from os.path import splitext, basename
 import json
+import sys
 
 def main():
     p = ArgumentParser()
-    p.add_argument("-o", dest = "output", default = "providers.json")
     p.add_argument("files", nargs="+")
     args = p.parse_args()
     out = dict()
         f = open(path, "r")
         out[name] = yaml.load(f)
         f.close()
-    f = open(args.output, "w")
-    json.dump(out, f)
-    f.close()
+    json.dump(out, sys.stdout)
 if __name__ == "__main__":
     main()