Ejemplo n.º 1
0
 def parse_args(self, args=None, values=None):
     opt, arglist = OptionParser.parse_args(self, args, values)
     if opt.implicit_deps_changed or opt.implicit_deps_unchanged:
         opt.implicit_cache = 1
     return opt, arglist
Ejemplo n.º 2
0
    def __init__(self):
        import __main__
        import SCons
        parts = ["SCons by Steven Knight et al.:\n"]
        try:
            parts.append("\tscript: v%s.%s, %s, by %s on %s\n" % (__main__.__version__,
                                                                  __main__.__build__,
                                                                  __main__.__date__,
                                                                  __main__.__developer__,
                                                                  __main__.__buildsys__))
        except KeyboardInterrupt:
            raise
        except:
            # On win32 there is no scons.py, so there is no __main__.__version__,
            # hence there is no script version.
            pass 
        parts.append("\tengine: v%s.%s, %s, by %s on %s\n" % (SCons.__version__,
                                                              SCons.__build__,
                                                              SCons.__date__,
                                                              SCons.__developer__,
                                                              SCons.__buildsys__))
        parts.append("Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation")
        OptionParser.__init__(self, version=string.join(parts, ''),
                              usage="usage: scons [OPTION] [TARGET] ...")

        # options ignored for compatibility
        def opt_ignore(option, opt, value, parser):
            sys.stderr.write("Warning:  ignoring %s option\n" % opt)
        self.add_option("-b", "-m", "-S", "-t", "--no-keep-going", "--stop",
                        "--touch", action="callback", callback=opt_ignore,
                        help="Ignored for compatibility.")

        self.add_option('-c', '--clean', '--remove', action="store_true",
                        dest="clean",
                        help="Remove specified targets and dependencies.")

        self.add_option('-C', '--directory', type="string", action = "append",
                        metavar="DIR",
                        help="Change to DIR before doing anything.")

        self.add_option('--cache-disable', '--no-cache',
                        action="store_true", dest='cache_disable', default=0,
                        help="Do not retrieve built targets from CacheDir.")

        self.add_option('--cache-force', '--cache-populate',
                        action="store_true", dest='cache_force', default=0,
                        help="Copy already-built targets into the CacheDir.")

        self.add_option('--cache-show',
                        action="store_true", dest='cache_show', default=0,
                        help="Print build actions for files from CacheDir.")

        def opt_not_yet(option, opt, value, parser):
            sys.stderr.write("Warning:  the %s option is not yet implemented\n" % opt)
            sys.exit(0)
        self.add_option('-d', action="callback",
                        callback=opt_not_yet,
                        help = "Print file dependency information.")
        
        self.add_option('-D', action="store_const", const=2, dest="climb_up",
                        help="Search up directory tree for SConstruct,       "
                             "build all Default() targets.")

        debug_options = ["count", "dtree", "explain",
                         "includes", "memory", "objects",
                         "pdb", "presub", "time", "tree"]

        def opt_debug(option, opt, value, parser, debug_options=debug_options):
            if value in debug_options:
                parser.values.debug = value
            else:
                raise OptionValueError("Warning:  %s is not a valid debug type" % value)
        self.add_option('--debug', action="callback", type="string",
                        callback=opt_debug, nargs=1, dest="debug",
                        metavar="TYPE",
                        help="Print various types of debugging information: "
                             "%s." % string.join(debug_options, ", "))

        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)
            parser.values.duplicate = value
            # Set the duplicate style 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('-f', '--file', '--makefile', '--sconstruct',
                        action="append", nargs=1,
                        help="Read FILE as the top-level SConstruct file.")

        self.add_option('-h', '--help', action="store_true", default=0,
                        dest="help_msg",
                        help="Print defined help message, or this one.")

        self.add_option("-H", "--help-options",
                        action="help",
                        help="Print this message and exit.")

        self.add_option('-i', '--ignore-errors', action="store_true",
                        default=0, dest='ignore_errors',
                        help="Ignore errors from build actions.")

        self.add_option('-I', '--include-dir', action="append",
                        dest='include_dir', metavar="DIR",
                        help="Search DIR for imported Python modules.")

        self.add_option('--implicit-cache', action="store_true",
                        dest='implicit_cache',
                        help="Cache implicit dependencies")

        self.add_option('--implicit-deps-changed', action="store_true",
                        default=0, dest='implicit_deps_changed',
                        help="Ignore cached implicit dependencies.")
        self.add_option('--implicit-deps-unchanged', action="store_true",
                        default=0, dest='implicit_deps_unchanged',
                        help="Ignore changes in implicit dependencies.")

        def opt_j(option, opt, value, parser):
            value = int(value)
            parser.values.num_jobs = value
        self.add_option('-j', '--jobs', action="callback", type="int",
                        callback=opt_j, metavar="N",
                        help="Allow N jobs at once.")

        self.add_option('-k', '--keep-going', action="store_true", default=0,
                        dest='keep_going',
                        help="Keep going when a target can't be made.")

        self.add_option('--max-drift', type="int", action="store",
                        dest='max_drift', metavar="N",
                        help="Set maximum system clock drift to N seconds.")

        self.add_option('-n', '--no-exec', '--just-print', '--dry-run',
                        '--recon', action="store_true", dest='noexec',
                        default=0, help="Don't build; just print commands.")

        def opt_profile(option, opt, value, parser):
            global profiling
            if not profiling:
                profiling = 1
                import profile
                profile.run('SCons.Script.main()', value)
                sys.exit(exit_status)
        self.add_option('--profile', nargs=1, action="callback",
                        callback=opt_profile, type="string", dest="profile",
                        metavar="FILE",
                        help="Profile SCons and put results in FILE.")

        self.add_option('-q', '--question', action="store_true", default=0,
                        help="Don't build; exit status says if up to date.")

        self.add_option('-Q', dest='no_progress', action="store_true",
                        default=0,
                        help="Suppress \"Reading/Building\" progress messages.")

        self.add_option('--random', dest="random", action="store_true",
                        default=0, help="Build dependencies in random order.")

        self.add_option('-s', '--silent', '--quiet', action="store_true",
                        default=0, help="Don't print commands.")

        self.add_option('-u', '--up', '--search-up', action="store_const",
                        dest="climb_up", default=0, const=1,
                        help="Search up directory tree for SConstruct,       "
                             "build targets at or below current directory.")
        self.add_option('-U', action="store_const", dest="climb_up",
                        default=0, const=3,
                        help="Search up directory tree for SConstruct,       "
                             "build Default() targets from local SConscript.")

        self.add_option("-v", "--version",
                        action="version",
                        help="Print the SCons version number and exit.")

        self.add_option('--warn', '--warning', nargs=1, action="store",
                        metavar="WARNING-SPEC",
                        help="Enable or disable warnings.")

        self.add_option('-Y', '--repository', nargs=1, action="append",
                        help="Search REPOSITORY for source and target files.")

        self.add_option('-e', '--environment-overrides', action="callback",
                        callback=opt_not_yet,
                        # help="Environment variables override makefiles."
                        help=SUPPRESS_HELP)
        self.add_option('-l', '--load-average', '--max-load', action="callback",
                        callback=opt_not_yet, type="int", dest="load_average",
                        # action="store",
                        # help="Don't start multiple jobs unless load is below "
                        #      "LOAD-AVERAGE."
                        # type="int",
                        help=SUPPRESS_HELP)
        self.add_option('--list-derived', action="callback",
                        callback=opt_not_yet,
                        # help="Don't build; list files that would be built."
                        help=SUPPRESS_HELP)
        self.add_option('--list-actions', action="callback",
                        callback=opt_not_yet,
                        # help="Don't build; list files and build actions."
                        help=SUPPRESS_HELP)
        self.add_option('--list-where', action="callback",
                        callback=opt_not_yet,
                        # help="Don't build; list files and where defined."
                        help=SUPPRESS_HELP)
        self.add_option('-o', '--old-file', '--assume-old', action="callback",
                        callback=opt_not_yet, type="string", dest="old_file",
                        # help = "Consider FILE to be old; don't rebuild it."
                        help=SUPPRESS_HELP)
        self.add_option('--override', action="callback", dest="override",
                        callback=opt_not_yet, type="string",
                        # help="Override variables as specified in FILE."
                        help=SUPPRESS_HELP)
        self.add_option('-p', action="callback",
                        callback=opt_not_yet,
                        # help="Print internal environments/objects."
                        help=SUPPRESS_HELP)
        self.add_option('-r', '-R', '--no-builtin-rules',
                        '--no-builtin-variables', action="callback",
                        callback=opt_not_yet,
                        # help="Clear default environments and variables."
                        help=SUPPRESS_HELP)
        self.add_option('-w', '--print-directory', action="callback",
                        callback=opt_not_yet,
                        # help="Print the current directory."
                        help=SUPPRESS_HELP)
        self.add_option('--no-print-directory', action="callback",
                        callback=opt_not_yet,
                        # help="Turn off -w, even if it was turned on implicitly."
                        help=SUPPRESS_HELP)
        self.add_option('--write-filenames', action="callback",
                        callback=opt_not_yet, type="string", dest="write_filenames",
                        # help="Write all filenames examined into FILE."
                        help=SUPPRESS_HELP)
        self.add_option('-W', '--what-if', '--new-file', '--assume-new',
                        dest="new_file",
                        action="callback", callback=opt_not_yet, type="string",
                        # help="Consider FILE to be changed."
                        help=SUPPRESS_HELP)
        self.add_option('--warn-undefined-variables', action="callback",
                        callback=opt_not_yet,
                        # help="Warn when an undefined variable is referenced."
                        help=SUPPRESS_HELP)
Ejemplo n.º 3
0
    def __init__(self):
        import __main__
        import SCons
        parts = ["SCons by Steven Knight et al.:\n"]
        try:
            parts.append(
                "\tscript: v%s.%s, %s, by %s on %s\n" %
                (__main__.__version__, __main__.__build__, __main__.__date__,
                 __main__.__developer__, __main__.__buildsys__))
        except:
            # On win32 there is no scons.py, so there is no __main__.__version__,
            # hence there is no script version.
            pass
        parts.append("\tengine: v%s.%s, %s, by %s on %s\n" %
                     (SCons.__version__, SCons.__build__, SCons.__date__,
                      SCons.__developer__, SCons.__buildsys__))
        parts.append("Copyright (c) 2001, 2002, 2003 Steven Knight")
        OptionParser.__init__(self,
                              version=string.join(parts, ''),
                              usage="usage: scons [OPTION] [TARGET] ...")

        # options ignored for compatibility
        def opt_ignore(option, opt, value, parser):
            sys.stderr.write("Warning:  ignoring %s option\n" % opt)

        self.add_option("-b",
                        "-m",
                        "-S",
                        "-t",
                        "--no-keep-going",
                        "--stop",
                        "--touch",
                        action="callback",
                        callback=opt_ignore,
                        help="Ignored for compatibility.")

        self.add_option('-c',
                        '--clean',
                        '--remove',
                        action="store_true",
                        dest="clean",
                        help="Remove specified targets and dependencies.")

        self.add_option('-C',
                        '--directory',
                        type="string",
                        action="append",
                        help="Change to DIRECTORY before doing anything.")

        self.add_option('--cache-disable',
                        '--no-cache',
                        action="store_true",
                        dest='cache_disable',
                        default=0,
                        help="Do not retrieve built targets from CacheDir.")

        self.add_option('--cache-force',
                        '--cache-populate',
                        action="store_true",
                        dest='cache_force',
                        default=0,
                        help="Copy already-built targets into the CacheDir.")

        self.add_option('--cache-show',
                        action="store_true",
                        dest='cache_show',
                        default=0,
                        help="Print build actions for files from CacheDir.")

        def opt_not_yet(option, opt, value, parser):
            sys.stderr.write(
                "Warning:  the %s option is not yet implemented\n" % opt)
            sys.exit(0)

        self.add_option('-d',
                        action="callback",
                        callback=opt_not_yet,
                        help="Print file dependency information.")

        self.add_option('-D',
                        action="store_const",
                        const=2,
                        dest="climb_up",
                        help="Search up directory tree for SConstruct, "
                        "build all Default() targets.")

        def opt_debug(option, opt, value, parser):
            if value == "pdb":
                if os.name == 'java':
                    python = os.path.join(sys.prefix, 'jython')
                else:
                    python = sys.executable
                args = [ python, "pdb.py" ] + \
                       filter(lambda x: x != "--debug=pdb", sys.argv)
                if sys.platform == 'win32':
                    args[1] = os.path.join(sys.prefix, "lib", "pdb.py")
                    sys.exit(os.spawnve(os.P_WAIT, args[0], args, os.environ))
                else:
                    args[1] = os.path.join(sys.prefix, "lib",
                                           "python" + sys.version[0:3],
                                           "pdb.py")
                os.execvpe(args[0], args, os.environ)
            elif value in ["tree", "dtree", "time", "includes"]:
                setattr(parser.values, 'debug', value)
            else:
                raise OptionValueError(
                    "Warning:  %s is not a valid debug type" % value)

        self.add_option('--debug',
                        action="callback",
                        type="string",
                        callback=opt_debug,
                        nargs=1,
                        dest="debug",
                        help="Print various types of debugging information.")

        self.add_option('-f',
                        '--file',
                        '--makefile',
                        '--sconstruct',
                        action="append",
                        nargs=1,
                        help="Read FILE as the top-level SConstruct file.")

        self.add_option('-h',
                        '--help',
                        action="store_true",
                        default=0,
                        dest="help_msg",
                        help="Print defined help message, or this one.")

        self.add_option("-H",
                        "--help-options",
                        action="help",
                        help="Print this message and exit.")

        self.add_option('-i',
                        '--ignore-errors',
                        action="store_true",
                        default=0,
                        dest='ignore_errors',
                        help="Ignore errors from build actions.")

        self.add_option('-I',
                        '--include-dir',
                        action="append",
                        dest='include_dir',
                        metavar="DIRECTORY",
                        help="Search DIRECTORY for imported Python modules.")

        self.add_option('--implicit-cache',
                        action="store_true",
                        dest='implicit_cache',
                        help="Cache implicit dependencies")

        self.add_option('--implicit-deps-changed',
                        action="store_true",
                        default=0,
                        dest='implicit_deps_changed',
                        help="Ignore the cached implicit deps.")
        self.add_option('--implicit-deps-unchanged',
                        action="store_true",
                        default=0,
                        dest='implicit_deps_unchanged',
                        help="Ignore changes in implicit deps.")

        def opt_j(option, opt, value, parser):
            value = int(value)
            setattr(parser.values, 'num_jobs', value)

        self.add_option('-j',
                        '--jobs',
                        action="callback",
                        type="int",
                        callback=opt_j,
                        metavar="N",
                        help="Allow N jobs at once.")

        self.add_option('-k',
                        '--keep-going',
                        action="store_true",
                        default=0,
                        dest='keep_going',
                        help="Keep going when a target can't be made.")

        self.add_option('--max-drift',
                        type="int",
                        action="store",
                        dest='max_drift',
                        help="Set the maximum system clock drift to be"
                        " MAX_DRIFT seconds.")

        self.add_option('-n',
                        '--no-exec',
                        '--just-print',
                        '--dry-run',
                        '--recon',
                        action="store_true",
                        dest='noexec',
                        default=0,
                        help="Don't build; just print commands.")

        def opt_profile(option, opt, value, parser):
            global profiling
            if not profiling:
                profiling = 1
                import profile
                profile.run('SCons.Script.main()', value)
                sys.exit(exit_status)

        self.add_option('--profile',
                        nargs=1,
                        action="callback",
                        callback=opt_profile,
                        type="string",
                        dest="profile",
                        help="Profile SCons and put results in PROFILE.")

        self.add_option('-q',
                        '--question',
                        action="store_true",
                        default=0,
                        help="Don't build; exit status says if up to date.")

        self.add_option('-Q',
                        dest='no_progress',
                        action="store_true",
                        default=0,
                        help="Don't print SCons progress messages.")

        self.add_option('--random',
                        dest="random",
                        action="store_true",
                        default=0,
                        help="Build dependencies in random order.")

        self.add_option('-s',
                        '--silent',
                        '--quiet',
                        action="store_true",
                        default=0,
                        help="Don't print commands.")

        self.add_option('-u',
                        '--up',
                        '--search-up',
                        action="store_const",
                        dest="climb_up",
                        default=0,
                        const=1,
                        help="Search up directory tree for SConstruct, "
                        "build targets at or below current directory.")
        self.add_option('-U',
                        action="store_const",
                        dest="climb_up",
                        default=0,
                        const=3,
                        help="Search up directory tree for SConstruct, "
                        "build Default() targets from local SConscript.")

        self.add_option("-v",
                        "--version",
                        action="version",
                        help="Print the SCons version number and exit.")

        self.add_option('--warn',
                        '--warning',
                        nargs=1,
                        action="store",
                        metavar="WARNING-SPEC",
                        help="Enable or disable warnings.")

        self.add_option('-Y',
                        '--repository',
                        nargs=1,
                        action="append",
                        help="Search REPOSITORY for source and target files.")

        self.add_option(
            '-e',
            '--environment-overrides',
            action="callback",
            callback=opt_not_yet,
            # help="Environment variables override makefiles."
            help=SUPPRESS_HELP)
        self.add_option(
            '-l',
            '--load-average',
            '--max-load',
            action="callback",
            callback=opt_not_yet,
            type="int",
            dest="load_average",
            # action="store",
            # help="Don't start multiple jobs unless load is below "
            #      "LOAD-AVERAGE."
            # type="int",
            help=SUPPRESS_HELP)
        self.add_option(
            '--list-derived',
            action="callback",
            callback=opt_not_yet,
            # help="Don't build; list files that would be built."
            help=SUPPRESS_HELP)
        self.add_option(
            '--list-actions',
            action="callback",
            callback=opt_not_yet,
            # help="Don't build; list files and build actions."
            help=SUPPRESS_HELP)
        self.add_option(
            '--list-where',
            action="callback",
            callback=opt_not_yet,
            # help="Don't build; list files and where defined."
            help=SUPPRESS_HELP)
        self.add_option(
            '-o',
            '--old-file',
            '--assume-old',
            action="callback",
            callback=opt_not_yet,
            type="string",
            dest="old_file",
            # help = "Consider FILE to be old; don't rebuild it."
            help=SUPPRESS_HELP)
        self.add_option(
            '--override',
            action="callback",
            dest="override",
            callback=opt_not_yet,
            type="string",
            # help="Override variables as specified in FILE."
            help=SUPPRESS_HELP)
        self.add_option(
            '-p',
            action="callback",
            callback=opt_not_yet,
            # help="Print internal environments/objects."
            help=SUPPRESS_HELP)
        self.add_option(
            '-r',
            '-R',
            '--no-builtin-rules',
            '--no-builtin-variables',
            action="callback",
            callback=opt_not_yet,
            # help="Clear default environments and variables."
            help=SUPPRESS_HELP)
        self.add_option(
            '-w',
            '--print-directory',
            action="callback",
            callback=opt_not_yet,
            # help="Print the current directory."
            help=SUPPRESS_HELP)
        self.add_option(
            '--no-print-directory',
            action="callback",
            callback=opt_not_yet,
            # help="Turn off -w, even if it was turned on implicitly."
            help=SUPPRESS_HELP)
        self.add_option(
            '--write-filenames',
            action="callback",
            callback=opt_not_yet,
            type="string",
            dest="write_filenames",
            # help="Write all filenames examined into FILE."
            help=SUPPRESS_HELP)
        self.add_option(
            '-W',
            '--what-if',
            '--new-file',
            '--assume-new',
            dest="new_file",
            action="callback",
            callback=opt_not_yet,
            type="string",
            # help="Consider FILE to be changed."
            help=SUPPRESS_HELP)
        self.add_option(
            '--warn-undefined-variables',
            action="callback",
            callback=opt_not_yet,
            # help="Warn when an undefined variable is referenced."
            help=SUPPRESS_HELP)
Ejemplo n.º 4
0
 def parse_args(self, args=None, values=None):
     opt, arglist = OptionParser.parse_args(self, args, values)
     if opt.implicit_deps_changed or opt.implicit_deps_unchanged:
         opt.implicit_cache = 1
     return opt, arglist
Ejemplo n.º 5
0
    def __init__(self):
        import __main__
        import SCons
        parts = ["SCons by Steven Knight et al.:\n"]
        try:
            parts.append(
                "\tscript: v%s.%s, %s, by %s on %s\n" %
                (__main__.__version__, __main__.__build__, __main__.__date__,
                 __main__.__developer__, __main__.__buildsys__))
        except KeyboardInterrupt:
            raise
        except:
            # On win32 there is no scons.py, so there is no __main__.__version__,
            # hence there is no script version.
            pass
        parts.append("\tengine: v%s.%s, %s, by %s on %s\n" %
                     (SCons.__version__, SCons.__build__, SCons.__date__,
                      SCons.__developer__, SCons.__buildsys__))
        parts.append(
            "Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation")
        OptionParser.__init__(self,
                              version=string.join(parts, ''),
                              usage="usage: scons [OPTION] [TARGET] ...")

        # options ignored for compatibility
        def opt_ignore(option, opt, value, parser):
            sys.stderr.write("Warning:  ignoring %s option\n" % opt)

        self.add_option("-b",
                        "-m",
                        "-S",
                        "-t",
                        "--no-keep-going",
                        "--stop",
                        "--touch",
                        action="callback",
                        callback=opt_ignore,
                        help="Ignored for compatibility.")

        self.add_option('-c',
                        '--clean',
                        '--remove',
                        action="store_true",
                        dest="clean",
                        help="Remove specified targets and dependencies.")

        self.add_option('-C',
                        '--directory',
                        type="string",
                        action="append",
                        metavar="DIR",
                        help="Change to DIR before doing anything.")

        self.add_option('--cache-disable',
                        '--no-cache',
                        action="store_true",
                        dest='cache_disable',
                        default=0,
                        help="Do not retrieve built targets from CacheDir.")

        self.add_option('--cache-force',
                        '--cache-populate',
                        action="store_true",
                        dest='cache_force',
                        default=0,
                        help="Copy already-built targets into the CacheDir.")

        self.add_option('--cache-show',
                        action="store_true",
                        dest='cache_show',
                        default=0,
                        help="Print build actions for files from CacheDir.")

        config_options = ["auto", "force", "cache"]

        def opt_config(option, opt, value, parser, c_options=config_options):
            if value in c_options:
                parser.values.config = value
            else:
                raise OptionValueError(
                    "Warning:  %s is not a valid config type" % value)

        self.add_option('--config',
                        action="callback",
                        type="string",
                        callback=opt_config,
                        nargs=1,
                        dest="config",
                        metavar="MODE",
                        default="auto",
                        help="Controls Configure subsystem: "
                        "%s." % string.join(config_options, ", "))

        def opt_not_yet(option, opt, value, parser):
            sys.stderr.write(
                "Warning:  the %s option is not yet implemented\n" % opt)
            sys.exit(0)

        self.add_option('-d',
                        action="callback",
                        callback=opt_not_yet,
                        help="Print file dependency information.")

        self.add_option('-D',
                        action="store_const",
                        const=2,
                        dest="climb_up",
                        help="Search up directory tree for SConstruct,       "
                        "build all Default() targets.")

        debug_options = [
            "count", "dtree", "explain", "findlibs", "includes", "memoizer",
            "memory", "objects", "pdb", "presub", "stacktrace", "stree",
            "time", "tree"
        ]

        def opt_debug(option, opt, value, parser, debug_options=debug_options):
            if value in debug_options:
                try:
                    if parser.values.debug is None:
                        parser.values.debug = []
                except AttributeError:
                    parser.values.debug = []
                parser.values.debug.append(value)
            else:
                raise OptionValueError(
                    "Warning:  %s is not a valid debug type" % value)

        self.add_option('--debug',
                        action="callback",
                        type="string",
                        callback=opt_debug,
                        nargs=1,
                        dest="debug",
                        metavar="TYPE",
                        help="Print various types of debugging information: "
                        "%s." % string.join(debug_options, ", "))

        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)
            parser.values.duplicate = value
            # Set the duplicate style 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('-f',
                        '--file',
                        '--makefile',
                        '--sconstruct',
                        action="append",
                        nargs=1,
                        help="Read FILE as the top-level SConstruct file.")

        self.add_option('-h',
                        '--help',
                        action="store_true",
                        default=0,
                        dest="help_msg",
                        help="Print defined help message, or this one.")

        self.add_option("-H",
                        "--help-options",
                        action="help",
                        help="Print this message and exit.")

        self.add_option('-i',
                        '--ignore-errors',
                        action="store_true",
                        default=0,
                        dest='ignore_errors',
                        help="Ignore errors from build actions.")

        self.add_option('-I',
                        '--include-dir',
                        action="append",
                        dest='include_dir',
                        metavar="DIR",
                        help="Search DIR for imported Python modules.")

        self.add_option('--implicit-cache',
                        action="store_true",
                        dest='implicit_cache',
                        help="Cache implicit dependencies")

        self.add_option('--implicit-deps-changed',
                        action="store_true",
                        default=0,
                        dest='implicit_deps_changed',
                        help="Ignore cached implicit dependencies.")
        self.add_option('--implicit-deps-unchanged',
                        action="store_true",
                        default=0,
                        dest='implicit_deps_unchanged',
                        help="Ignore changes in implicit dependencies.")

        def opt_j(option, opt, value, parser):
            value = int(value)
            parser.values.num_jobs = value

        self.add_option('-j',
                        '--jobs',
                        action="callback",
                        type="int",
                        callback=opt_j,
                        metavar="N",
                        help="Allow N jobs at once.")

        self.add_option('-k',
                        '--keep-going',
                        action="store_true",
                        default=0,
                        dest='keep_going',
                        help="Keep going when a target can't be made.")

        self.add_option('--max-drift',
                        type="int",
                        action="store",
                        dest='max_drift',
                        metavar="N",
                        help="Set maximum system clock drift to N seconds.")

        self.add_option('-n',
                        '--no-exec',
                        '--just-print',
                        '--dry-run',
                        '--recon',
                        action="store_true",
                        dest='noexec',
                        default=0,
                        help="Don't build; just print commands.")

        def opt_profile(option, opt, value, parser):
            global profiling
            if not profiling:
                profiling = 1
                import profile
                profile.run('SCons.Script.Main.main()', value)
                sys.exit(exit_status)

        self.add_option('--profile',
                        nargs=1,
                        action="callback",
                        callback=opt_profile,
                        type="string",
                        dest="profile",
                        metavar="FILE",
                        help="Profile SCons and put results in FILE.")

        self.add_option('-q',
                        '--question',
                        action="store_true",
                        default=0,
                        help="Don't build; exit status says if up to date.")

        self.add_option(
            '-Q',
            dest='no_progress',
            action="store_true",
            default=0,
            help="Suppress \"Reading/Building\" progress messages.")

        self.add_option('--random',
                        dest="random",
                        action="store_true",
                        default=0,
                        help="Build dependencies in random order.")

        self.add_option('-s',
                        '--silent',
                        '--quiet',
                        action="store_true",
                        default=0,
                        help="Don't print commands.")

        self.add_option('-u',
                        '--up',
                        '--search-up',
                        action="store_const",
                        dest="climb_up",
                        default=0,
                        const=1,
                        help="Search up directory tree for SConstruct,       "
                        "build targets at or below current directory.")
        self.add_option('-U',
                        action="store_const",
                        dest="climb_up",
                        default=0,
                        const=3,
                        help="Search up directory tree for SConstruct,       "
                        "build Default() targets from local SConscript.")

        self.add_option("-v",
                        "--version",
                        action="version",
                        help="Print the SCons version number and exit.")

        self.add_option('--warn',
                        '--warning',
                        nargs=1,
                        action="store",
                        metavar="WARNING-SPEC",
                        help="Enable or disable warnings.")

        self.add_option('-Y',
                        '--repository',
                        nargs=1,
                        action="append",
                        help="Search REPOSITORY for source and target files.")

        self.add_option(
            '-e',
            '--environment-overrides',
            action="callback",
            callback=opt_not_yet,
            # help="Environment variables override makefiles."
            help=SUPPRESS_HELP)
        self.add_option(
            '-l',
            '--load-average',
            '--max-load',
            action="callback",
            callback=opt_not_yet,
            type="int",
            dest="load_average",
            # action="store",
            # help="Don't start multiple jobs unless load is below "
            #      "LOAD-AVERAGE."
            # type="int",
            help=SUPPRESS_HELP)
        self.add_option(
            '--list-derived',
            action="callback",
            callback=opt_not_yet,
            # help="Don't build; list files that would be built."
            help=SUPPRESS_HELP)
        self.add_option(
            '--list-actions',
            action="callback",
            callback=opt_not_yet,
            # help="Don't build; list files and build actions."
            help=SUPPRESS_HELP)
        self.add_option(
            '--list-where',
            action="callback",
            callback=opt_not_yet,
            # help="Don't build; list files and where defined."
            help=SUPPRESS_HELP)
        self.add_option(
            '-o',
            '--old-file',
            '--assume-old',
            action="callback",
            callback=opt_not_yet,
            type="string",
            dest="old_file",
            # help = "Consider FILE to be old; don't rebuild it."
            help=SUPPRESS_HELP)
        self.add_option(
            '--override',
            action="callback",
            dest="override",
            callback=opt_not_yet,
            type="string",
            # help="Override variables as specified in FILE."
            help=SUPPRESS_HELP)
        self.add_option(
            '-p',
            action="callback",
            callback=opt_not_yet,
            # help="Print internal environments/objects."
            help=SUPPRESS_HELP)
        self.add_option(
            '-r',
            '-R',
            '--no-builtin-rules',
            '--no-builtin-variables',
            action="callback",
            callback=opt_not_yet,
            # help="Clear default environments and variables."
            help=SUPPRESS_HELP)
        self.add_option(
            '-w',
            '--print-directory',
            action="callback",
            callback=opt_not_yet,
            # help="Print the current directory."
            help=SUPPRESS_HELP)
        self.add_option(
            '--no-print-directory',
            action="callback",
            callback=opt_not_yet,
            # help="Turn off -w, even if it was turned on implicitly."
            help=SUPPRESS_HELP)
        self.add_option(
            '--write-filenames',
            action="callback",
            callback=opt_not_yet,
            type="string",
            dest="write_filenames",
            # help="Write all filenames examined into FILE."
            help=SUPPRESS_HELP)
        self.add_option(
            '-W',
            '--what-if',
            '--new-file',
            '--assume-new',
            dest="new_file",
            action="callback",
            callback=opt_not_yet,
            type="string",
            # help="Consider FILE to be changed."
            help=SUPPRESS_HELP)
        self.add_option(
            '--warn-undefined-variables',
            action="callback",
            callback=opt_not_yet,
            # help="Warn when an undefined variable is referenced."
            help=SUPPRESS_HELP)