2 from zeroinstall
import SafeException
3 from optparse
import OptionParser
5 from logging
import info
, debug
9 parser
= OptionParser(usage
="usage: %prog [options] PUBLIC-DIR")
10 parser
.add_option("-v", "--verbose", help="more verbose output", action
='count')
11 parser
.add_option("-V", "--version", help="display version information", action
='store_true')
13 (options
, args
) = parser
.parse_args()
16 print "0mirror (zero-install) " + version
17 print "Copyright (C) 2007 Thomas Leonard"
18 print "This program comes with ABSOLUTELY NO WARRANTY,"
19 print "to the extent permitted by law."
20 print "You may redistribute copies of this program"
21 print "under the terms of the GNU General Public License."
22 print "For more information about these matters, see the file named COPYING."
27 logger
= logging
.getLogger()
28 if options
.verbose
== 1:
29 logger
.setLevel(logging
.INFO
)
31 logger
.setLevel(logging
.DEBUG
)
38 FEED_FILE
= os
.path
.join(public_dir
, 'feedlist')
41 if not os
.path
.isfile(FEED_FILE
):
42 raise SafeException("File '%s' does not exist. It should contain a list of feed URLs, one per line")
43 feeds
= file(options
.feed_file
).read().split('\n')
46 except KeyboardInterrupt, ex
:
47 print >>sys
.stderr
, "Aborted at user's request"
49 except SafeException
, ex
:
50 if options
.verbose
: raise
51 print >>sys
.stderr
, ex