Description: <short summary of the patch>
 This patch fixes the remaining python 3.5 issues. I'll apply the patch to
 trunk of plainbox so if you are trying to refresh this patch in Debian or
 Ubuntu, just drop it and get the most recent release instead.
Origin: vendor
Forwarded: not-needed
Last-Update: 2015-09-02

--- plainbox-0.22.2.orig/plainbox/impl/secure/qualifiers.py
+++ plainbox-0.22.2/plainbox/impl/secure/qualifiers.py
@@ -32,6 +32,7 @@ import logging
 import operator
 import os
 import re
+import sre_constants
 
 from plainbox.abc import IJobQualifier
 from plainbox.i18n import gettext as _
@@ -140,7 +141,15 @@ class RegExpJobQualifier(SimpleQualifier
         Initialize a new RegExpJobQualifier with the specified pattern.
         """
         super().__init__(origin, inclusive)
-        self._pattern = re.compile(pattern)
+        try:
+            self._pattern = re.compile(pattern)
+        except sre_constants.error as exc:
+            assert len(exc.args) == 1
+            # XXX: This is a bit crazy but this lets us have identical error
+            # messages across python3.2 all the way to 3.5. I really really
+            # wish there was a better way at fixing this.
+            exc.args = (re.sub(" at position \d+", "", exc.args[0]), )
+            raise exc
         self._pattern_text = pattern
 
     def get_simple_match(self, job):
--- plainbox-0.22.2.orig/plainbox/impl/unit/validators.py
+++ plainbox-0.22.2/plainbox/impl/unit/validators.py
@@ -27,6 +27,7 @@ import itertools
 import logging
 import os
 import shlex
+import sys
 
 from plainbox.i18n import gettext as _
 from plainbox.i18n import ngettext
@@ -271,9 +272,12 @@ class CorrectFieldValueValidator(FieldVa
             perform its check.
         """
         super().__init__(message)
-        spec = inspect.getargspec(correct_fn)
+        if sys.version_info[:2] >= (3, 5):
+            has_two_args = len(inspect.signature(correct_fn).parameters) == 2
+        else:
+            has_two_args = len(inspect.getargspec(correct_fn).args) == 2
         self.correct_fn = correct_fn
-        self.correct_fn_needs_unit = len(spec.args) == 2
+        self.correct_fn_needs_unit = has_two_args
         self.kind = kind or self.default_kind
         self.severity = severity or self.default_severity
         self.onlyif = onlyif
--- plainbox-0.22.2.orig/plainbox/impl/xparsers.py
+++ plainbox-0.22.2/plainbox/impl/xparsers.py
@@ -61,6 +61,7 @@ import itertools
 import re
 import sre_constants
 import sre_parse
+import sys
 
 from plainbox.i18n import gettext as _
 from plainbox.impl import pod
@@ -231,12 +232,19 @@ class Re(Node):
         try:
             pyre_ast = sre_parse.parse(text)
         except sre_constants.error as exc:
+            assert len(exc.args) == 1
+            # XXX: This is a bit crazy but this lets us have identical error
+            # messages across python3.2 all the way to 3.5. I really really
+            # wish there was a better way at fixing this.
+            exc.args = (re.sub(" at position \d+", "", exc.args[0]), )
             return ReErr(lineno, col_offset, text, exc)
         else:
             # Check if the AST of this regular expression is composed
             # of just a flat list of 'literal' nodes. In other words,
             # check if it is a simple string match in disguise
-            if all(t == 'literal' for t, rest in pyre_ast):
+            if ((sys.version_info[:2] >= (3, 5) and
+                    all(t == sre_constants.LITERAL for t, rest in pyre_ast)) or
+                    all(t == 'literal' for t, rest in pyre_ast)):
                 return ReFixed(lineno, col_offset, text)
             else:
                 # NOTE: we might save time by calling some internal function to
