diff options
author | Steven Knight <knight@baldmt.com> | 2004-09-24 14:23:40 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-09-24 14:23:40 (GMT) |
commit | b5fb7056061b2a3d8ee97b05a4fc1a92beb0f13d (patch) | |
tree | f139aee5ab2c3a82b3fae7bc57ad63a962a5e0dd /doc/man | |
parent | db9601646dfa4e7848e239e7a935a0d36d821027 (diff) | |
download | SCons-b5fb7056061b2a3d8ee97b05a4fc1a92beb0f13d.zip SCons-b5fb7056061b2a3d8ee97b05a4fc1a92beb0f13d.tar.gz SCons-b5fb7056061b2a3d8ee97b05a4fc1a92beb0f13d.tar.bz2 |
Add validator functions for PathOption. (Steve Christensen)
Diffstat (limited to 'doc/man')
-rw-r--r-- | doc/man/scons.1 | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1 index 6399568..5cad3f2 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -7201,7 +7201,7 @@ or to disable use of the specified option. .TP -.RI PathOption( key ", " help ", " default ) +.RI PathOption( key ", " help ", " default ", [" validator ]) Return a tuple of arguments to set up an option whose value is expected to be a path name. @@ -7213,6 +7213,38 @@ have a default value of and display the specified .I help text. +An additional +.I validator +may be specified +that will be called to +verify that the specified path +is acceptable. +SCons supplies the +following ready-made validators: +.BR PathOption.PathExists +(the default), +which verifies that the specified path exists; +.BR PathOption.PathIsFile , +which verifies that the specified path is an existing file; +.BR PathOption.PathIsDir , +which verifies that the specified path is an existing directory; +and +.BR PathOption.PathIsDirCreate , +which verifies that the specified path is a directory, +and will create the specified directory if the path exist. +You may supply your own +.I validator +function, +which must take three arguments +.RI ( key , +the name of the options variable to be set; +.IR val , +the specified value being checked; +and +.IR env , +the construction environment) +and should raise an exception +if the specified value is not acceptable. .RE These functions make it @@ -7236,6 +7268,9 @@ opts.AddOptions( 'use X11 installed here (yes = search some places)', 'yes'), PathOption('qtdir', 'where the root of Qt is installed', qtdir), + PathOption('foopath', 'where the foo library is installed', foopath, + PathOption.PathIsDir), + ) .EE |