2 from zeroinstall
.injector
import gpg
3 from optparse
import OptionParser
9 parser
= OptionParser(usage
="usage: %prog [options] interface")
10 parser
.add_option("-k", "--key", help="key to use for signing")
11 parser
.add_option("-e", "--edit", help="edit with $EDITOR", action
='store_true')
12 parser
.add_option("-x", "--xmlsign", help="add an XML signature block", action
='store_true')
13 parser
.add_option("-V", "--version", help="display version information", action
='store_true')
15 (options
, args
) = parser
.parse_args()
18 print "0publish (zero-install) " + version
19 print "Copyright (C) 2005 Thomas Leonard"
20 print "This program comes with ABSOLUTELY NO WARRANTY,"
21 print "to the extent permitted by law."
22 print "You may redistribute copies of this program"
23 print "under the terms of the GNU General Public License."
24 print "For more information about these matters, see the file named COPYING."
34 ans
= raw_input(q
+ " [Y/N] ").lower()
35 if ans
in ('y', 'yes'): return True
36 if ans
in ('n', 'no'): return False
38 # Load or create the starting data...
40 if os
.path
.exists(interface
):
41 contents
= file(interface
).read()
42 data
, sign_fn
, key
= signing
.check_signature(interface
)
44 if confirm("Interface file '%s' does not exist. Create it?" % interface
):
45 from create
import create
46 data
= create(interface
)
47 sign_fn
= signing
.sign_unsigned
54 sign_fn
= signing
.sign_xml
56 print "Changing key from '%s' to '%s'" % (key
, options
.key
)
60 data
= edit
.edit(data
)
66 # Validate the result...
69 sign_fn(interface
, data
, key
)