diff options
-rwxr-xr-x[-rw-r--r--] | bin/glsa-check | 7 | ||||
-rw-r--r-- | pym/portage/glsa.py | 13 |
2 files changed, 14 insertions, 6 deletions
diff --git a/bin/glsa-check b/bin/glsa-check index 2b21d717f..3d047b54d 100644..100755 --- a/bin/glsa-check +++ b/bin/glsa-check @@ -142,6 +142,13 @@ for p in params[:]: glsalist.extend([g for g in params if g not in glsalist]) def summarylist(myglsalist, fd1=sys.stdout, fd2=sys.stderr, encoding="utf-8"): + # Get to the raw streams in py3k before wrapping them with an encoded writer + # to avoid writing bytes to a text stream (stdout/stderr are text streams + # by default in py3k) + if hasattr(fd1, "buffer"): + fd1 = fd1.buffer + if hasattr(fd2, "buffer"): + fd2 = fd2.buffer fd1 = codecs.getwriter(encoding)(fd1) fd2 = codecs.getwriter(encoding)(fd2) fd2.write(white("[A]")+" means this GLSA was marked as applied (injected),\n") diff --git a/pym/portage/glsa.py b/pym/portage/glsa.py index 155d3e543..c0c69dd2d 100644 --- a/pym/portage/glsa.py +++ b/pym/portage/glsa.py @@ -14,6 +14,7 @@ import re import operator import xml.dom.minidom from io import StringIO +from functools import reduce import portage from portage import os @@ -526,17 +527,17 @@ class Glsa: self.synopsis = getText(myroot.getElementsByTagName("synopsis")[0], format="strip") self.announced = format_date(getText(myroot.getElementsByTagName("announced")[0], format="strip")) - count = 1 # Support both formats of revised: # <revised>December 30, 2007: 02</revised> # <revised count="2">2007-12-30</revised> revisedEl = myroot.getElementsByTagName("revised")[0] self.revised = getText(revisedEl, format="strip") - if ((sys.hexversion >= 0x3000000 and "count" in revisedEl.attributes) or - (sys.hexversion < 0x3000000 and revisedEl.attributes.has_key("count"))): - count = revisedEl.getAttribute("count") - elif (self.revised.find(":") >= 0): - (self.revised, count) = self.revised.split(":") + count = revisedEl.attributes.get("count") + if count is None: + if self.revised.find(":") >= 0: + (self.revised, count) = self.revised.split(":") + else: + count = 1 self.revised = format_date(self.revised) |