pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

py-rt: Update wip/py-rt to 1.0.10



Module Name:	pkgsrc-wip
Committed By:	Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By:	leot
Date:		Fri Jun 22 15:03:56 2018 +0200
Changeset:	ed532d723314f229eb1b61f4044bc25bdcd14be7

Modified Files:
	py-rt/Makefile
	py-rt/distinfo
Added Files:
	py-rt/patches/patch-rt.py

Log Message:
py-rt: Update wip/py-rt to 1.0.10

pkgsrc changes:
 - Add a patch in order to add support for `format' in search() function, in
   order to avoid transfer of a lot of data only if `id' and/or `Subject' fields
   are needed
 - Add a dependency to `nose' to reflect upstream changes (it does not seem used
   though, if I'm not missing something)
 - Also add `python' to CATEGORIES

Changes:
v1.0.10, 2017-02-22
- PEP8 fixes
- update .travis.yml to update python interpreter list and some other small changes
- prefer format over % (PEP 3101)
- Add patch from https://gitlab.labs.nic.cz/labs/python-rt/issues/9
  "Support CF search where special chars or spaces in CF names"
- Implement a fix for the issue suggested in
  https://gitlab.labs.nic.cz/labs/python-rt/issues/10 (can't create ticket
  with multi-line message)
- Implement fix for https://gitlab.labs.nic.cz/labs/python-rt/issues/7
  "returned types inconsistent in get_ticket"
  Add splitting for Cc and AdminCc

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=ed532d723314f229eb1b61f4044bc25bdcd14be7

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 py-rt/Makefile            |   5 +-
 py-rt/distinfo            |   9 ++--
 py-rt/patches/patch-rt.py | 117 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 125 insertions(+), 6 deletions(-)

diffs:
diff --git a/py-rt/Makefile b/py-rt/Makefile
index e22ea2795a..72967c2a7e 100644
--- a/py-rt/Makefile
+++ b/py-rt/Makefile
@@ -1,8 +1,8 @@
 # $NetBSD$
 
-DISTNAME=	rt-1.0.9
+DISTNAME=	rt-1.0.10
 PKGNAME=	${PYPKGPREFIX}-${DISTNAME}
-CATEGORIES=	net
+CATEGORIES=	net python
 MASTER_SITES=	${MASTER_SITE_PYPI:=r/rt/}
 
 MAINTAINER=	leot%NetBSD.org@localhost
@@ -12,6 +12,7 @@ LICENSE=	gnu-gpl-v3
 
 DIST_SUBDIR=	py-rt	# XXX: avoid possible conflicts with devel/rt{3,}
 
+DEPENDS+=	${PYPKGPREFIX}-nose-[0-9]*:../../devel/py-nose
 DEPENDS+=	${PYPKGPREFIX}-requests-[0-9]*:../../devel/py-requests
 DEPENDS+=	${PYPKGPREFIX}-six-[0-9]*:../../lang/py-six
 
diff --git a/py-rt/distinfo b/py-rt/distinfo
index c6798d27e3..f0ad4407b9 100644
--- a/py-rt/distinfo
+++ b/py-rt/distinfo
@@ -1,6 +1,7 @@
 $NetBSD$
 
-SHA1 (py-rt/rt-1.0.9.tar.gz) = 6478fecd48940d3462d9ad7fda15615044392262
-RMD160 (py-rt/rt-1.0.9.tar.gz) = 02bd75a712b3e6a9d1ddd6dc46e980a8bc8e2a3d
-SHA512 (py-rt/rt-1.0.9.tar.gz) = d76fb64addab7e288528816660b5118e586c5ffe021e2c23d60c3998534e14f01f25911767d6f422cb25e637c4ad074631b5d35e61107221166389d03d48d9db
-Size (py-rt/rt-1.0.9.tar.gz) = 35314 bytes
+SHA1 (py-rt/rt-1.0.10.tar.gz) = 84469322e28d6bb8cd3b6fb1c972014a6b011211
+RMD160 (py-rt/rt-1.0.10.tar.gz) = c33668195117608d33daf8a306f6385689dfd999
+SHA512 (py-rt/rt-1.0.10.tar.gz) = ef09818c927eb6b3c6a9b183f92a5ce2424f334dc62d098cc06cd63c5adc8d11e55f9356db6122d2dde0f841d2cfaa713161ba5ce7746e8f509fab89b832dc60
+Size (py-rt/rt-1.0.10.tar.gz) = 35402 bytes
+SHA1 (patch-rt.py) = 2747d2606e94294f247919460e2ed26e041b49f2
diff --git a/py-rt/patches/patch-rt.py b/py-rt/patches/patch-rt.py
new file mode 100644
index 0000000000..784d2f31fd
--- /dev/null
+++ b/py-rt/patches/patch-rt.py
@@ -0,0 +1,117 @@
+$NetBSD$
+
+Permit to also pass possible `format' field to search().
+
+--- rt.py.orig	2017-12-01 12:25:41.000000000 +0000
++++ rt.py
+@@ -392,7 +392,7 @@ class Rt:
+         """
+         return self.search(Queue=queue, order='-LastUpdated', LastUpdatedBy__notexact=self.default_login, LastUpdated__gt=since)
+ 
+-    def search(self, Queue=None, order=None, raw_query=None, **kwargs):
++    def search(self, Queue=None, order=None, raw_query=None, Format='l', **kwargs):
+         """ Search arbitrary needles in given fields and queue.
+ 
+         Example::
+@@ -413,6 +413,10 @@ class Rt:
+                              kwargs, so use these instead of including them in
+                              the raw query. You can refer to the RT query builder.
+                              If passing raw_query, all other **kwargs will be ignored.
++        :keyword Format:     Format of the query:
++                               - i: only `id' fields are populated
++                               - s: only `id' and `subject' fields are populated
++                               - l: multi-line format
+         :keyword kwargs:     Other arguments possible to set if not passing raw_query:
+ 
+                              Requestors, Subject, Cc, AdminCc, Owner, Status,
+@@ -471,7 +475,7 @@ class Rt:
+         get_params['query'] = ' AND '.join('(' + part + ')' for part in query)
+         if order:
+             get_params['orderby'] = order
+-        get_params['format'] = 'l'
++        get_params['format'] = Format
+ 
+         msg = self.__request(url, get_params=get_params)
+         lines = msg.split('\n')
+@@ -481,37 +485,52 @@ class Rt:
+             if lines[2].startswith('No matching results.'):
+                 return []
+ 
+-        msgs = map(lambda x: x.split('\n'), msg.split('\n--\n'))
+-        items = []
+-        for msg in msgs:
+-            pairs = {}
+-            req_matching = [i for i, m in enumerate(msg) if self.RE_PATTERNS['requestors_pattern'].match(m)]
+-            req_id = req_matching[0] if req_matching else None
+-            if not req_id:
+-                raise UnexpectedMessageFormat('Missing line starting with `Requestors:`.')
+-            for i in range(req_id):
+-                if ': ' in msg[i]:
+-                    header, content = msg[i].split(': ', 1)
+-                    pairs[header.strip()] = content.strip()
+-            requestors = [msg[req_id][12:]]
+-            req_id += 1
+-            while (req_id < len(msg)) and (msg[req_id][:12] == ' ' * 12):
+-                requestors.append(msg[req_id][12:])
++        if Format == 'l':
++            msgs = map(lambda x: x.split('\n'), msg.split('\n--\n'))
++            items = []
++            for msg in msgs:
++                pairs = {}
++                req_matching = [i for i, m in enumerate(msg) if self.RE_PATTERNS['requestors_pattern'].match(m)]
++                req_id = req_matching[0] if req_matching else None
++                if not req_id:
++                    raise UnexpectedMessageFormat('Missing line starting with `Requestors:`.')
++                for i in range(req_id):
++                    if ': ' in msg[i]:
++                        header, content = msg[i].split(': ', 1)
++                        pairs[header.strip()] = content.strip()
++                requestors = [msg[req_id][12:]]
+                 req_id += 1
+-            pairs['Requestors'] = self.__normalize_list(requestors)
+-            for i in range(req_id, len(msg)):
+-                if ': ' in msg[i]:
+-                    header, content = msg[i].split(': ', 1)
+-                    pairs[header.strip()] = content.strip()
+-            if pairs:
+-                items.append(pairs)
++                while (req_id < len(msg)) and (msg[req_id][:12] == ' ' * 12):
++                    requestors.append(msg[req_id][12:])
++                    req_id += 1
++                pairs['Requestors'] = self.__normalize_list(requestors)
++                for i in range(req_id, len(msg)):
++                    if ': ' in msg[i]:
++                        header, content = msg[i].split(': ', 1)
++                        pairs[header.strip()] = content.strip()
++                if pairs:
++                    items.append(pairs)
++
++                if 'Cc' in pairs:
++                    pairs['Cc'] = self.__normalize_list(pairs['Cc'])
++                if 'AdminCc' in pairs:
++                    pairs['AdminCc'] = self.__normalize_list(pairs['AdminCc'])
++            return items
++        elif Format == 's':
++            items = []
++            msgs = msg.splitlines()[2:]
++            for msg in msgs:
++                ticket_id, subject = msg.split(': ', 1)
++                items.append({ 'id': 'ticket/' + ticket_id, 'Subject': subject })    
++            return items
++        elif Format == 'i':
++            items = []
++            msgs = msg.splitlines()[2:]
++            for msg in msgs:
++                _, ticket_id = msg.split('/', 1)
++                items.append({ 'id': 'ticket/' + ticket_id })    
++            return items
+ 
+-            if 'Cc' in pairs:
+-                pairs['Cc'] = self.__normalize_list(pairs['Cc'])
+-            if 'AdminCc' in pairs:
+-                pairs['AdminCc'] = self.__normalize_list(pairs['AdminCc'])
+-
+-        return items
+ 
+     def get_ticket(self, ticket_id):
+         """ Fetch ticket by its ID.


Home | Main Index | Thread Index | Old Index