/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: teddy at bsnet
  • Date: 2011-03-15 19:15:24 UTC
  • Revision ID: teddy@fukt.bsnet.se-20110315191524-jc3ajgqu2za7dcly
* mandos: Use the new argparse library instead of optparse.
* debian/control (mandos): Depend on python (<=2.7) | python-argparse

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 
37
37
import SocketServer as socketserver
38
38
import socket
39
 
import optparse
 
39
import argparse
40
40
import datetime
41
41
import errno
42
42
import gnutls.crypto
1673
1673
    ##################################################################
1674
1674
    # Parsing of options, both command line and config file
1675
1675
    
1676
 
    parser = optparse.OptionParser(version = "%%prog %s" % version)
1677
 
    parser.add_option("-i", "--interface", type="string",
1678
 
                      metavar="IF", help="Bind to interface IF")
1679
 
    parser.add_option("-a", "--address", type="string",
1680
 
                      help="Address to listen for requests on")
1681
 
    parser.add_option("-p", "--port", type="int",
1682
 
                      help="Port number to receive requests on")
1683
 
    parser.add_option("--check", action="store_true",
1684
 
                      help="Run self-test")
1685
 
    parser.add_option("--debug", action="store_true",
1686
 
                      help="Debug mode; run in foreground and log to"
1687
 
                      " terminal")
1688
 
    parser.add_option("--debuglevel", type="string", metavar="LEVEL",
1689
 
                      help="Debug level for stdout output")
1690
 
    parser.add_option("--priority", type="string", help="GnuTLS"
1691
 
                      " priority string (see GnuTLS documentation)")
1692
 
    parser.add_option("--servicename", type="string",
1693
 
                      metavar="NAME", help="Zeroconf service name")
1694
 
    parser.add_option("--configdir", type="string",
1695
 
                      default="/etc/mandos", metavar="DIR",
1696
 
                      help="Directory to search for configuration"
1697
 
                      " files")
1698
 
    parser.add_option("--no-dbus", action="store_false",
1699
 
                      dest="use_dbus", help="Do not provide D-Bus"
1700
 
                      " system bus interface")
1701
 
    parser.add_option("--no-ipv6", action="store_false",
1702
 
                      dest="use_ipv6", help="Do not use IPv6")
1703
 
    options = parser.parse_args()[0]
 
1676
    parser = argparse.ArgumentParser()
 
1677
    parser.add_argument("-v", "--version", action="version",
 
1678
                        version = "%%(prog)s %s" % version,
 
1679
                        help="show version number and exit")
 
1680
    parser.add_argument("-i", "--interface", metavar="IF",
 
1681
                        help="Bind to interface IF")
 
1682
    parser.add_argument("-a", "--address",
 
1683
                        help="Address to listen for requests on")
 
1684
    parser.add_argument("-p", "--port", type=int,
 
1685
                        help="Port number to receive requests on")
 
1686
    parser.add_argument("--check", action="store_true",
 
1687
                        help="Run self-test")
 
1688
    parser.add_argument("--debug", action="store_true",
 
1689
                        help="Debug mode; run in foreground and log"
 
1690
                        " to terminal")
 
1691
    parser.add_argument("--debuglevel", metavar="LEVEL",
 
1692
                        help="Debug level for stdout output")
 
1693
    parser.add_argument("--priority", help="GnuTLS"
 
1694
                        " priority string (see GnuTLS documentation)")
 
1695
    parser.add_argument("--servicename",
 
1696
                        metavar="NAME", help="Zeroconf service name")
 
1697
    parser.add_argument("--configdir",
 
1698
                        default="/etc/mandos", metavar="DIR",
 
1699
                        help="Directory to search for configuration"
 
1700
                        " files")
 
1701
    parser.add_argument("--no-dbus", action="store_false",
 
1702
                        dest="use_dbus", help="Do not provide D-Bus"
 
1703
                        " system bus interface")
 
1704
    parser.add_argument("--no-ipv6", action="store_false",
 
1705
                        dest="use_ipv6", help="Do not use IPv6")
 
1706
    options = parser.parse_args()
1704
1707
    
1705
1708
    if options.check:
1706
1709
        import doctest