2 # Copyright (C) 2007, Thomas Leonard
3 # See the README file for details, or visit http://0install.net.
5 from optparse
import OptionParser
7 from zeroinstall
import SafeException
8 from zeroinstall
.injector
import reader
, model
12 parser
= OptionParser(usage
= """usage: %prog [options] LOCAL-FEED
14 Run this command from a new empty directory to set things up.""")
16 parser
.add_option("-k", "--key", help="GPG key to use for signing", action
='store', metavar
='KEYID')
17 parser
.add_option("-v", "--verbose", help="more verbose output", action
='count')
18 parser
.add_option("-r", "--release", help="make a new release", action
='store_true')
19 parser
.add_option("", "--archive-dir-public-url", help="remote directory for releases", metavar
='URL')
20 parser
.add_option("", "--master-feed-file", help="local file to extend with new releases", metavar
='PATH')
21 parser
.add_option("", "--archive-upload-command", help="shell command to upload releases", metavar
='COMMAND')
22 parser
.add_option("", "--master-feed-upload-command", help="shell command to upload feed", metavar
='COMMAND')
23 parser
.add_option("", "--public-scm-repository", help="the name of the repository to push to", metavar
='REPOS')
24 parser
.add_option("-V", "--version", help="display version information", action
='store_true')
26 (options
, args
) = parser
.parse_args()
29 print "0release (zero-install) " + version
30 print "Copyright (C) 2007 Thomas Leonard"
31 print "This program comes with ABSOLUTELY NO WARRANTY,"
32 print "to the extent permitted by law."
33 print "You may redistribute copies of this program"
34 print "under the terms of the GNU General Public License."
35 print "For more information about these matters, see the file named COPYING."
40 logger
= logging
.getLogger()
41 if options
.verbose
== 1:
42 logger
.setLevel(logging
.INFO
)
44 logger
.setLevel(logging
.DEBUG
)
50 local_feed_path
= args
[0]
53 if not os
.path
.exists(local_feed_path
):
54 raise SafeException("Local feed file '%s' does not exist" % local_feed_path
)
56 iface
= model
.Interface(model
.canonical_iface_uri(local_feed_path
))
57 reader
.update(iface
, local_feed_path
, local
= True)
61 release
.do_release(iface
, options
)
64 setup
.init_releases_directory(iface
)
65 except KeyboardInterrupt, ex
:
66 print >>sys
.stderr
, "Interrupted"
69 if options
.verbose
: raise
70 print >>sys
.stderr
, str(ex
)
73 if options
.verbose
: raise
74 print >>sys
.stderr
, str(ex
)
76 except SafeException
, ex
:
77 if options
.verbose
: raise
78 print >>sys
.stderr
, str(ex
)