Пример #1
0
    bus = None
    timeout=10
    ttl=4
    filter = []
    search = ''
    method = 'slp'

    for o, a in opts:
        if o in ('-b', '--bus'):
            try:
                bus = [x.lower().strip() for x in a.split(',')]
            except TypeError:
                bus = ['usb']

            if not device.validateBusList(bus):
                mod.usage(error_msg=['Invalid bus name'])

        elif o in ('-m', '--method'):
            method = a.lower().strip()

            if method not in ('slp', 'mdns', 'bonjour'):
                mod.usage(error_msg=["Invalid network search protocol name. Must be 'slp' or 'mdns'."])
            else:
                bus = ['net']

        elif o in ('-t', '--ttl'):
            try:
                ttl = int(a)
            except ValueError:
                ttl = 4
Пример #2
0
for o, a in opts:
    if o == '-x':
        testpage_in_auto_mode = False

    elif o in ('-P', '-p', '--printer'):
        printer_name = a

    elif o in ('-f', '--fax'):
        fax_name = a

    elif o in ('-d', '--device'):
        device_uri = a

    elif o in ('-b', '--bus'):
        bus = [x.lower().strip() for x in a.split(',')]
        if not device.validateBusList(bus, False):
            mod.usage(error_msg=['Invalid bus name'])

    elif o in ('-t', '--type'):
        setup_fax, setup_print = False, False
        a = a.strip().lower()
        for aa in a.split(','):
            if aa.strip() not in ('print', 'fax'):
                mod.usage(error_msg=['Invalid type.'])

            if aa.strip() == 'print':
                setup_print = True

            elif aa.strip() == 'fax':
                if not prop.fax_build:
                    log.error("Cannot enable fax setup - HPLIP not built with fax enabled.")
Пример #3
0
    bus = None
    timeout=10
    ttl=4
    filter = []
    search = ''
    method = 'slp'

    for o, a in opts:
        if o in ('-b', '--bus'):
            try:
                bus = [x.lower().strip() for x in a.split(',')]
            except TypeError:
                bus = ['usb']

            if not device.validateBusList(bus):
                mod.usage(error_msg=['Invalid bus name'])

        elif o in ('-m', '--method'):
            method = a.lower().strip()

            if method not in ('slp', 'mdns', 'bonjour'):
                mod.usage(error_msg=["Invalid network search protocol name. Must be 'slp' or 'mdns'."])
            else:
                bus = ['net']

        elif o in ('-t', '--ttl'):
            try:
                ttl = int(a)
            except ValueError:
                ttl = 4