diff options
author | Steven Knight <knight@baldmt.com> | 2004-03-06 14:09:36 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-03-06 14:09:36 (GMT) |
commit | 10e229b7a8e466d9fe1d193fa66a2bcd3fec3ee6 (patch) | |
tree | 1eaf77423e1ed4a4604c215ea2e84384519f2d44 /src/engine/SCons/Script/__init__.py | |
parent | 0486b66e2cdef2d174ff9eba0198947c4f8a9635 (diff) | |
download | SCons-10e229b7a8e466d9fe1d193fa66a2bcd3fec3ee6.zip SCons-10e229b7a8e466d9fe1d193fa66a2bcd3fec3ee6.tar.gz SCons-10e229b7a8e466d9fe1d193fa66a2bcd3fec3ee6.tar.bz2 |
scons.0.92 - Implement a --duplicate= option. (Christoph Wiedemann)
Diffstat (limited to 'src/engine/SCons/Script/__init__.py')
-rw-r--r-- | src/engine/SCons/Script/__init__.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 7067ab1..47fef2b 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -608,6 +608,17 @@ class OptParser(OptionParser): # "LOAD-AVERAGE." # type="int", help=SUPPRESS_HELP) + def opt_duplicate(option, opt, value, parser): + if not value in SCons.Node.FS.Valid_Duplicates: + raise OptionValueError("`%s' is not a valid duplication style." % value) + setattr(parser.values, 'duplicate', value) + # Set the duplicate stye right away so it can affect linking + # of SConscript files. + SCons.Node.FS.set_duplicate(value) + self.add_option('--duplicate', action="callback", type="string", + callback=opt_duplicate, nargs=1, dest="duplicate", + help="Set the preferred duplication methods. Must be one of " + + string.join(SCons.Node.FS.Valid_Duplicates, ", ")) self.add_option('--list-derived', action="callback", callback=opt_not_yet, # help="Don't build; list files that would be built." @@ -683,7 +694,8 @@ class SConscriptSettableOptions: self.settable = {'num_jobs':1, 'max_drift':SCons.Sig.default_max_drift, 'implicit_cache':0, - 'clean':0} + 'clean':0, + 'duplicate':'hard-soft-copy'} def get(self, name): if not self.settable.has_key(name): @@ -709,6 +721,16 @@ class SConscriptSettableOptions: value = int(value) except ValueError, x: raise SCons.Errors.UserError, "An integer is required: %s"%repr(value) + elif name == 'duplicate': + try: + value = str(value) + except ValueError: + raise SCons.Errors.UserError, "A string is required: %s"%repr(value) + if not value in SCons.Node.FS.Valid_Duplicates: + raise SCons.Errors.UserError, "Not a valid duplication style: %s" % value + # Set the duplicate stye right away so it can affect linking + # of SConscript files. + SCons.Node.FS.set_duplicate(value) self.settable[name] = value @@ -745,7 +767,7 @@ def _main(args, parser): CleanTask.execute = CleanTask.show if options.question: SCons.SConf.dryrun = 1 - + if options.no_progress or options.silent: progress_display.set_mode(0) if options.silent: @@ -877,6 +899,7 @@ def _main(args, parser): # Now that we've read the SConscripts we can set the options # that are SConscript settable: SCons.Node.implicit_cache = ssoptions.get('implicit_cache') + SCons.Node.FS.set_duplicate(ssoptions.get('duplicate')) lookup_top = None if targets: |