summaryrefslogtreecommitdiff
path: root/bin/test_dep_rewrite
diff options
context:
space:
mode:
authorV3n3RiX <venerix@rogentos.ro>2015-10-03 16:29:43 +0100
committerV3n3RiX <venerix@rogentos.ro>2015-10-03 16:29:43 +0100
commit01e0750c93427cde2b2d19261fefa5d1373e9c37 (patch)
treeb7fb870ea7cf41fbf9174bac1d3f024656b7ccc0 /bin/test_dep_rewrite
parentdfec061a2da2a936da146db7f261a840faed73ac (diff)
drop any entropy shit in here
Diffstat (limited to 'bin/test_dep_rewrite')
-rwxr-xr-xbin/test_dep_rewrite41
1 files changed, 0 insertions, 41 deletions
diff --git a/bin/test_dep_rewrite b/bin/test_dep_rewrite
deleted file mode 100755
index b8efb72..0000000
--- a/bin/test_dep_rewrite
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/python
-import sys
-import re
-
-
-if __name__ == "__main__":
- args = sys.argv[1:]
- if not args or len(args) < 3:
- sys.stderr.write(
- "%s <target dependency> <rewrite rule> "
- "<replace 1> [<replace 2> ...\n" % (sys.argv[0],))
- raise SystemExit(1)
-
- target, pattern, replaces = args[0], args[1], args[2:]
- sys.stdout.write("Target: %s\n" % (target,))
- sys.stdout.write("Pattern: %s\n" % (pattern,))
- sys.stdout.write("Rewrites: %s\n" % (", ".join(replaces),))
-
- if pattern.startswith("++"):
- sys.stderr.write("You are just asking to add dep, meh!\n")
- raise SystemExit(1)
-
- sys.stdout.write("\n")
-
- compiled_pattern = re.compile(pattern)
- if not compiled_pattern.match(target):
- sys.stderr.write("Error: Pattern does not match target dep\n")
- raise SystemExit(1)
-
- exit_st = 0
- for replace in replaces:
- new_target, number_of_subs = compiled_pattern.subn(
- replace, target)
- if number_of_subs:
- sys.stdout.write("%s -> %s\n" % (target, new_target))
- else:
- sys.stderr.write("Error, not replaced: %s -> %s\n" % (
- target, replace,))
- exit_st = 1
-
- raise SystemExit(exit_st)