summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-09-26 12:12:25 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2013-09-26 12:12:25 +0000
commit8307902395d075e834a53e4c7d87cd31c0fe863e (patch)
treebf208bd041448929a258841a55ce345132fa063a
parent151050c5b15e83cbfc6ac9fcd786dcb957022185 (diff)
downloaddefinitions-8307902395d075e834a53e4c7d87cd31c0fe863e.tar.gz
Move helper script to scripts for use in cmdtests
-rwxr-xr-xscripts/nullify-local-refs18
-rw-r--r--yarns/morph.shell-lib18
2 files changed, 19 insertions, 17 deletions
diff --git a/scripts/nullify-local-refs b/scripts/nullify-local-refs
new file mode 100755
index 00000000..5db5c587
--- /dev/null
+++ b/scripts/nullify-local-refs
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+
+import yaml, sys
+repo = sys.argv[1]
+ref = sys.argv[2]
+for filename in sys.argv[3:]:
+ with open(filename, "r") as f:
+ d = yaml.load(f)
+ if "strata" in d:
+ for spec in d["strata"]:
+ if spec["repo"] == repo and spec["ref"] == ref:
+ spec["repo"] = spec["ref"] = None
+ if "build-depends" in d:
+ for spec in d["build-depends"]:
+ if spec["repo"] == repo and spec["ref"] == ref:
+ spec["repo"] = spec["ref"] = None
+ with open(filename, "w") as f:
+ yaml.dump(d, f)
diff --git a/yarns/morph.shell-lib b/yarns/morph.shell-lib
index 41ffbbbd..448c60ce 100644
--- a/yarns/morph.shell-lib
+++ b/yarns/morph.shell-lib
@@ -146,23 +146,7 @@ assert_morphologies_are_petrified()
nullify_local_refs()
{
- python -c 'import yaml, sys
-repo = sys.argv[1]
-ref = sys.argv[2]
-for filename in sys.argv[3:]:
- with open(filename, "r") as f:
- d = yaml.load(f)
- if "strata" in d:
- for spec in d["strata"]:
- if spec["repo"] == repo and spec["ref"] == ref:
- spec["repo"] = spec["ref"] = None
- if "build-depends" in d:
- for spec in d["build-depends"]:
- if spec["repo"] == repo and spec["ref"] == ref:
- spec["repo"] = spec["ref"] = None
- with open(filename, "w") as f:
- yaml.dump(d, f)
-' "$@"
+ "$SRCDIR/scripts/nullify-local-refs" "$@"
}
# Currently, yarn isn't setting $SRCDIR to point at the project source