webcheck commit: r468 - in webcheck: . webcheck
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
webcheck commit: r468 - in webcheck: . webcheck
- From: Commits of the webcheck project <webcheck-commits [at] lists.arthurdejong.org>
- To: webcheck-commits [at] lists.arthurdejong.org
- Reply-to: webcheck-users [at] lists.arthurdejong.org
- Subject: webcheck commit: r468 - in webcheck: . webcheck
- Date: Wed, 16 Nov 2011 13:07:52 +0100 (CET)
Author: devin
Date: Wed Nov 16 13:07:51 2011
New Revision: 468
URL: http://arthurdejong.org/viewvc/webcheck?revision=468&view=revision
Log:
cleanup after introduction of entry_point
Modified:
webcheck/ (props changed)
webcheck/cmd.py (contents, props changed)
webcheck/webcheck/cmd.py
Modified: webcheck/cmd.py
==============================================================================
--- webcheck/cmd.py Wed Nov 16 12:40:39 2011 (r467)
+++ webcheck/cmd.py Wed Nov 16 13:07:51 2011 (r468)
@@ -23,13 +23,25 @@
# The files produced as output from the software do not automatically fall
# under the copyright of the software, unless explicitly stated otherwise.
-"""This is the main webcheck module."""
+"""Alternative entry_point for development."""
-from webcheck.cmd import entry_point
+import sys, os, logging
+
+from webcheck.cmd import Crawler, parse_args, main
+from webcheck import config
+
+# Whether to produce profiling information. This is for development
+# purposes and as such undocumented.
+# http://docs.python.org/lib/profile.html
+PROFILE = False
if __name__ == '__main__':
try:
- if PROFILE:
+ # initialize crawler object
+ crawler = Crawler()
+ # parse command-line arguments
+ parse_args(crawler)
+ if PROFILE or '--profile' in sys.argv:
fname = os.path.join(config.OUTPUT_DIR, 'webcheck.prof')
try:
import cProfile
@@ -40,12 +52,12 @@
sqltap.start()
except ImportError:
pass
- cProfile.run('entry_point()', fname)
+ cProfile.run('main(crawler)', fname)
if 'sqltap' in locals():
statistics = sqltap.collect()
sqltap.report(statistics, os.path.join(config.OUTPUT_DIR,
'sqltap.html'))
else:
- entry_point()
+ main(crawler)
except KeyboardInterrupt:
sys.stderr.write('Interrupted\n')
sys.exit(1)
Modified: webcheck/webcheck/cmd.py
==============================================================================
--- webcheck/webcheck/cmd.py Wed Nov 16 12:40:39 2011 (r467)
+++ webcheck/webcheck/cmd.py Wed Nov 16 13:07:51 2011 (r468)
@@ -42,12 +42,6 @@
LOGLEVEL = logging.INFO
-# Whether to produce profiling information. This is for development
-# purposes and as such undocumented.
-# http://docs.python.org/lib/profile.html
-PROFILE = False
-
-
def print_version():
"""Print version information."""
sys.stdout.write(
@@ -100,11 +94,9 @@
' -h, --help display this help and exit\n'
% {'redirects': config.REDIRECT_DEPTH})
-
def parse_args(crawler):
"""Parse command-line arguments."""
# these global options are set here
- global PROFILE
global LOGLEVEL
try:
optlist, args = getopt.gnu_getopt(sys.argv[1:],
@@ -135,7 +127,7 @@
LOGLEVEL = logging.DEBUG
elif flag in ('--profile',):
# undocumented on purpose
- PROFILE = True
+ pass
elif flag in ('-o', '--output'):
config.OUTPUT_DIR = arg
elif flag in ('-c', '--continue'):
@@ -181,6 +173,8 @@
def main(crawler):
"""Main program."""
+ # configure logging
+ logging.basicConfig(format='webcheck: %(levelname)s: %(message)s',
level=LOGLEVEL)
# crawl through the website
logging.info('checking site....')
crawler.crawl() # this will take a while
@@ -202,7 +196,5 @@
crawler = Crawler()
# parse command-line arguments
parse_args(crawler)
- # configure logging
- logging.basicConfig(format='webcheck: %(levelname)s: %(message)s',
level=LOGLEVEL)
# run the main program
main(crawler)
--
To unsubscribe send an email to
webcheck-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/webcheck-commits/
- webcheck commit: r468 - in webcheck: . webcheck,
Commits of the webcheck project