summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSreepathi Pai <sree314@gmail.com>2009-03-05 17:03:13 +1100
committerAndrew Bartlett <abartlet@samba.org>2009-03-05 17:03:13 +1100
commit8352650fee1233e68b489efe635f3661cab2b190 (patch)
tree2069ee10b7fc1e8f0640e86a166620453c7a0939
parent17aac8cad2b3fe4b23eaebd869b1538735a1954a (diff)
downloadsamba-8352650fee1233e68b489efe635f3661cab2b190.tar.gz
samba-8352650fee1233e68b489efe635f3661cab2b190.tar.bz2
samba-8352650fee1233e68b489efe635f3661cab2b190.zip
Allow ms_schema.py to produce output much like minschema_wspp
I've patched the new ms_schema.py (which was intended to be used as a library) to function as minschema_wspp if invoked standalone. Although this is less robust than minschema_wspp on incorrect data, having two programs doing the same thing might not be good idea. Signed-off-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source4/scripting/python/samba/ms_schema.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/ms_schema.py b/source4/scripting/python/samba/ms_schema.py
index 1dbab4c947..f23bf0cdfe 100644
--- a/source4/scripting/python/samba/ms_schema.py
+++ b/source4/scripting/python/samba/ms_schema.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
#
# create schema.ldif (as a string) from WSPP documentation
#
@@ -252,3 +253,17 @@ def read_ms_schema(attr_file, classes_file, dump_attributes = True, dump_classes
classes_ldif = __parse_schema_file(classes_file, "classSchema")
return attr_ldif + "\n\n" + classes_ldif + "\n\n"
+
+if __name__ == '__main__':
+ import sys
+
+ try:
+ attr_file = sys.argv[1]
+ classes_file = sys.argv[2]
+ except IndexError:
+ print >>sys.stderr, "Usage: %s attr-file.txt classes-file.txt" % (sys.argv[0])
+ sys.exit(1)
+
+ print read_ms_schema(attr_file, classes_file)
+
+