~ubuntu-branches/ubuntu/precise/virtinst/precise-updates

« back to all changes in this revision

Viewing changes to .pc/0003-Fix-path-to-keyboard-configuration.patch/virtinst/util.py

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-11 11:47:53 UTC
  • mfrom: (1.6.6 sid)
  • Revision ID: package-import@ubuntu.com-20120211114753-sq9f3xayrma8px2h
Tags: 0.600.1-1ubuntu1
* Merge from debian unstable. Remaining changes:
  - debian/patches/9003-fix-path-to-hvmloader-in-testsuite.patch: adjust
    testsuite for 0001-fix-path-to-hvmloader.patch and
    0002-Fix-path-to-pygrub.patch.
  - debian/patches/9004_ubuntu_fix_tree_support.patch: Fix tree detection
    for all ISO/HTTP source, to not longer fail with cobbler/koan.
  - debian/patches/9005_ubuntu_precise.patch: Add Ubuntu precise as a
    supported distro.
  - debian/{control,rules,pyversions}: Build using dh_python2, use
    debhelper v8 instead of cdbs; for some reason the package build an
    empty binary package when using dh_python2.
  - debian/control: added acl package to depends.
  - debian/control: added libvirt-bin to recommends

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
    for line in d.xreadlines():
67
67
        info = line.split()
68
68
        if (len(info) != 11): # 11 = typical num of fields in the file
69
 
            logging.warn(_("Invalid line length while parsing %s.") %
70
 
                         (route_file))
71
 
            logging.warn(_("Defaulting bridge to xenbr%d") % (defn))
 
69
            logging.warn(_("Invalid line length while parsing %s."),
 
70
                         route_file)
 
71
            logging.warn(_("Defaulting bridge to xenbr%d"), defn)
72
72
            break
73
73
        try:
74
74
            route = int(info[1], 16)
275
275
 
276
276
def xml_escape(str):
277
277
    """Replaces chars ' " < > & with xml safe counterparts"""
 
278
    if str is None:
 
279
        return None
 
280
 
278
281
    str = str.replace("&", "&amp;")
279
282
    str = str.replace("'", "&apos;")
280
283
    str = str.replace("\"", "&quot;")
309
312
    try:
310
313
        f = open(XORG_CONF, "r")
311
314
    except IOError, e:
312
 
        logging.debug('Could not open "%s": %s ' % (XORG_CONF, str(e)))
 
315
        logging.debug('Could not open "%s": %s ', XORG_CONF, str(e))
313
316
    else:
314
317
        keymap_re = re.compile(r'\s*Option\s+"XkbLayout"\s+"(?P<kt>[a-z-]+)"')
315
318
        for line in f:
318
321
                kt = m.group('kt')
319
322
                break
320
323
        else:
321
 
            logging.debug("Didn't find keymap in '%s'!" % XORG_CONF)
 
324
            logging.debug("Didn't find keymap in '%s'!", XORG_CONF)
322
325
        f.close()
323
326
    return kt
324
327
 
369
372
    keymap = check_keytable(kt)
370
373
 
371
374
    if not keymap:
372
 
        logging.debug("Didn't match keymap '%s' in keytable!" % kt)
 
375
        logging.debug("Didn't match keymap '%s' in keytable!", kt)
373
376
        return default
374
377
 
375
378
    return keymap
436
439
            return False
437
440
        return True
438
441
    except Exception, e:
439
 
        logging.exception("Error parsing URI in is_remote: %s" % e)
 
442
        logging.exception("Error parsing URI in is_remote: %s", e)
440
443
        return True
441
444
 
442
445
def get_uri_hostname(uri):
447
450
        if netloc != "":
448
451
            return netloc
449
452
    except Exception, e:
450
 
        logging.warning("Cannot parse URI %s: %s" % (uri, str(e)))
 
453
        logging.warning("Cannot parse URI %s: %s", uri, str(e))
451
454
    return "localhost"
452
455
 
453
456
def get_uri_transport(uri):