[PATCHv2] Read /etc/os-release to get product title (#1000426)
Brian C. Lane
bcl at redhat.com
Thu Sep 5 21:22:30 UTC 2013
On Thu, Sep 05, 2013 at 11:42:13AM +0200, Vratislav Podzimek wrote:
> +def collect_spokes(mask_paths):
> + """Return a list of all spoke subclasses that should appear for a given
> + category. Look for them in files imported as module_path % basename(f)
> +
> + :param mask_paths: list of mask, path tuples to search for classes
> + :type mask_paths: list of (mask, path)
> +
> + :return: list of Spoke classes belonging to category
> + :rtype: list of Spoke classes
> +
> + """
> + spokes = []
> + for mask, path in mask_paths:
> + spokes.extend(collect(mask, path,
> + lambda obj: issubclass(obj, Spoke) and obj.should_run("firstboot", None)))
> +
> + print spokes
> + return spokes
leftover debugging print?
> +def product_title():
> + """
> + Get product title.
> +
> + :return: product title
> + :rtype: str
> +
> + """
> +
> + try:
> + with open(RELEASE_STRING_FILE, "r") as fobj:
> + for line in fobj:
> + (key, _eq, value) = line.strip().partition("=")
> + if not key or not _eq or not value:
> + continue
> + if key == "PRETTY_NAME":
> + return value.strip('"')
> + except IOError:
> + return ""
It says the return type is str, so it should return "" at the end
instead of dropping out with None. Maybe something like:
except IOError:
pass
finally:
return ""
> +
> + print spokes
> + return spokes
Leftover print again :)
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/anaconda-patches/attachments/20130905/5a1f7dcd/attachment.sig>
More information about the anaconda-patches
mailing list