def _update_manpages(self):
        # Update virt-install.1 with latest os type/variant values
        import virtinst.osdict as osdict

        # Build list first
        ret = []
        for t in osdict.sort_helper(osdict.OS_TYPES):
            for v in osdict.sort_helper(osdict.OS_TYPES[t]["variants"]):
                label = osdict.OS_TYPES[t]["variants"][v]["label"]
                if osdict.lookup_osdict_key(None, None, t, v, "supported"):
                    ret.append((v, label))

        output = ""
        output += "=over 2\n\n"

        for v, label in ret:
            output += "=item %-20s : %s\n\n" % (v, label)

        output += "=back\n\n"

        infile = "man/en/virt-install.pod.in"
        outfile = "man/en/virt-install.pod"

        outfd = open(outfile, "w+")
        origout = outfd.read()
        outfd.close()

        infd  = open(infile, "r")
        inp = infd.read()
        infd.close()

        outp = inp.replace("::VARIANT VALUES::", output)
        if outp != origout or not(os.path.exists(outfile)):
            outfd = open(outfile, "w")
            outfd.write(outp)
            outfd.close()

        # Generate new manpages
        if os.system("make -C man/en"):
            raise RuntimeError("Couldn't generate man pages.")

        if os.system("grep -IRq 'Hey!' man/en") == 0:
            raise RuntimeError("man pages have errors in them! "
                               "(grep for 'Hey!')")
Exemplo n.º 2
0
    def _update_manpages(self):
        # Update virt-install.1 with latest os type/variant values
        import virtinst.osdict as osdict

        # Build list first
        ret = []
        for t in osdict.sort_helper(osdict.OS_TYPES):
            for v in osdict.sort_helper(osdict.OS_TYPES[t]["variants"]):
                label = osdict.OS_TYPES[t]["variants"][v]["label"]
                if osdict.lookup_osdict_key(None, None, t, v, "supported"):
                    ret.append((v, label))

        output = ""
        output += "=over 2\n\n"

        for v, label in ret:
            output += "=item %-20s : %s\n\n" % (v, label)

        output += "=back\n\n"

        infile = "man/en/virt-install.pod.in"
        outfile = "man/en/virt-install.pod"

        outfd = open(outfile, "w+")
        origout = outfd.read()
        outfd.close()

        infd = open(infile, "r")
        inp = infd.read()
        infd.close()

        outp = inp.replace("::VARIANT VALUES::", output)
        if outp != origout or not (os.path.exists(outfile)):
            outfd = open(outfile, "w")
            outfd.write(outp)
            outfd.close()

        # Generate new manpages
        if os.system("make -C man/en"):
            raise RuntimeError("Couldn't generate man pages.")
Exemplo n.º 3
0
def _update_manpages():
    # Update virt-install.1 with latest os type/variant values
    import virtinst.osdict as osdict

    # Build list first
    ret = []
    for t in osdict.sort_helper(osdict.OS_TYPES):
        for v in osdict.sort_helper(osdict.OS_TYPES[t]["variants"]):
            label = osdict.OS_TYPES[t]["variants"][v]["label"]
            if osdict.lookup_osdict_key(None, None, t, v, "supported"):
                ret.append((v, label))

    output = ""
    output += "=over 2\n\n"

    for v, label in ret:
        output += "=item %-20s : %s\n\n" % (v, label)

    output += "=back\n\n"

    infile = "man/en/virt-install.pod.in"
    outfile = "man/en/virt-install.pod"

    outfd = open(outfile, "w+")
    origout = outfd.read()
    outfd.close()

    infd  = open(infile, "r")
    inp = infd.read()
    infd.close()

    outp = inp.replace("::VARIANT VALUES::", output)
    if outp != origout or not(os.path.exists(outfile)):
        outfd = open(outfile, "w")
        outfd.write(outp)
        outfd.close()

    _regenerate_manpages()
Exemplo n.º 4
0
 def _lookup_osdict_key(self, key, default):
     """
     Use self.os_variant to find key in OSTYPES
     @returns: dict value, or None if os_type/variant wasn't set
     """
     return osdict.lookup_osdict_key(self.os_variant, key, default)