check for -O option which disables debugging

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2989 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2005-12-18 09:13:34 +00:00
parent c84a33c7ce
commit 50120e88b6

View file

@ -42,6 +42,7 @@ import linkcheck.checker
import linkcheck.checker.cache
import linkcheck.checker.consumer
import linkcheck.configuration
import linkcheck.fileutil
import linkcheck.strformat
# optional modules
has_optcomplete = linkcheck.fileutil.has_module("optcomplete")
@ -490,8 +491,8 @@ if options.trace:
options.psyco = False
config.init_logging(debug=options.debug)
linkcheck.log.debug(linkcheck.LOG_CMDLINE, _("Python %s on %s"),
sys.version, sys.platform)
assert linkcheck.log.debug(linkcheck.LOG_CMDLINE, _("Python %s on %s"),
sys.version, sys.platform)
# read configuration files
try:
files = []
@ -505,6 +506,10 @@ try:
except linkcheck.LinkCheckerError, msg:
# config error
print_usage(str(msg))
# test if running with -O
if options.debug and not __debug__:
linkcheck.log.warn(linkcheck.LOG_CMDLINE,
_("Running with python -O disables debugging."))
# apply commandline options and arguments
constructauth = False
do_profile = False
@ -630,7 +635,7 @@ if constructauth:
'user': _username,
'password': _password})
linkcheck.log.debug(linkcheck.LOG_CMDLINE, "configuration: %s",
assert linkcheck.log.debug(linkcheck.LOG_CMDLINE, "configuration: %s",
pprint.pformat(config.items()))
# warn about sitemap loggers and verbose output
klasses = [c.__class__ for c in [config['logger']] + config['fileoutput']]