grim/local-pipelines

Initial revision

2016-06-28, Gary Kramlich
2720e8db93d6
Parents
Children e6e9f8ad528d
Initial revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore Tue Jun 28 15:27:03 2016 -0500
@@ -0,0 +1,7 @@
+syntax: regexp
+^venv/
+
+syntax: glob
+*.pyc
+.*.swp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pipelines/__main__.py Tue Jun 28 15:27:03 2016 -0500
@@ -0,0 +1,4 @@
+from pipelines.core import main
+
+main()
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pipelines/core.py Tue Jun 28 15:27:03 2016 -0500
@@ -0,0 +1,35 @@
+# vi:et:ts=4 sw=4 sts=4
+
+from __future__ import print_function
+
+import argparse
+import sys
+
+import yaml
+
+def parse_args():
+ parser = argparse.ArgumentParser()
+
+ parser.add_argument(
+ "-f", "--pipeline",
+ help="The filename of the pipeline file to use",
+ metavar="FILENAME",
+ default="bitbucket-pipelines.yml",
+ dest="pipeline_filename",
+ )
+
+ return parser.parse_args()
+
+def main():
+ args = parse_args()
+
+ pipeline = {}
+ try:
+ with open(args.pipeline_filename) as ifp:
+ pipeline = yaml.load(ifp.read())
+ except IOError:
+ print("failed to find {}".format(args.pipeline_filename))
+ sys.exit(1)
+
+ print(pipeline)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/requirements.txt Tue Jun 28 15:27:03 2016 -0500
@@ -0,0 +1,1 @@
+PyYAML==3.11