def _latestFedoraVariant(self): ret = None for var in osdict.sort_helper(osdict.OS_TYPES["linux"]["variants"]): if var.startswith("fedora"): # First fedora* occurence should be the newest ret = var break return ret, int(ret[6:])
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!')")
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.")
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()
def _update_manpages(self): # Update virt-install.1 with latest os type/variant values import virtinst.osdict as osdict output = "" output += "=over 4\n\n" for t in osdict.sort_helper(osdict.OS_TYPES): output += "=item %s\n\n" % t output += "=over 4\n\n" for v in osdict.sort_helper(osdict.OS_TYPES[t]["variants"]): output += "=item %s\n\n" % v output += osdict.OS_TYPES[t]["variants"][v]["label"] + "\n\n" output += "=back\n\n" # Add special 'none' value output += "=item none\n\n" output += "No OS version specified (disables autodetect)\n\n" output += "=back\n\n" infile = "man/en/virt-install.pod.in" outfile = "man/en/virt-install.pod" infd = open(infile, "r") outfd = open(outfile, "w") inp = infd.read() infd.close() outp = inp.replace("::VARIANT VALUES::", output) outfd.write(outp) outfd.close() # Generate new manpages if os.system("make -C man/en"): raise RuntimeError("Couldn't generate man pages.")
def _check_osvariant_valid(os_type, os_variant): return bool(_check_ostype_valid(os_type) and os_variant in osdict.sort_helper(osdict.OS_TYPES[os_type]["variants"]))
def _check_ostype_valid(os_type): return bool(os_type in osdict.sort_helper(osdict.OS_TYPES))
def _check_osvariant_valid(os_type, os_variant): return bool( _check_ostype_valid(os_type) and os_variant in osdict.sort_helper( osdict.OS_TYPES[os_type]["variants"]))