[Zodb-checkins] CVS: StandaloneZConfig/ZConfig/scripts - zconfig:1.4

Fred L. Drake, Jr. fred at zope.com
Wed Apr 30 15:05:09 EDT 2003


Update of /cvs-repository/StandaloneZConfig/ZConfig/scripts
In directory cvs.zope.org:/tmp/cvs-serv11603

Modified Files:
	zconfig 
Log Message:
If only a schema is specified, check that and exit.


=== StandaloneZConfig/ZConfig/scripts/zconfig 1.3 => 1.4 ===
--- StandaloneZConfig/ZConfig/scripts/zconfig:1.3	Fri Jan 17 14:14:56 2003
+++ StandaloneZConfig/ZConfig/scripts/zconfig	Wed Apr 30 14:05:08 2003
@@ -13,7 +13,7 @@
 #
 ##############################################################################
 
-"""zconfig:  Script to check well-formedness of a configuration file.
+"""zconfig: Script to check well-formedness of a schema or configuration file.
 
 Usage:
 
@@ -28,7 +28,11 @@
     --schema file   Use the schema in 'file' to validate the configuration.
 
 Each file named on the command line is checked for syntactical errors
-and schema conformance (when the schema is specified).
+and schema conformance (when the schema is specified).  If no files
+are specified and standard input is not a TTY, standard in is treated
+as a configuration file.  Specifying a schema and no configuration
+files causes the schema to be checked.
+
 """
 
 import getopt
@@ -54,11 +58,17 @@
             usage(sys.stdout)
             return 0
         if opt in ("-s", "--schema"):
-            schema = ZConfig.loadSchema(arg)
+            try:
+                schema = ZConfig.loadSchema(arg)
+            except ZConfig.SchemaError, e:
+                print >>sys.stderr, e
+                return 1
             loader = ZConfig.loader.ConfigLoader(schema)
 
     if not args:
         if sys.stdin.isatty():
+            if schema:
+                return 0
             print >>sys.stderr, "No configuration files specified."
             usage(sys.stderr)
             return 2




More information about the Zodb-checkins mailing list