Skip to content

Commit aea33fd

Browse files
committed
dev-python/httpheader: Added patch from dmeranda/httpheader#7 to support python3
Package-Manager: portage-2.2.20.1
1 parent 0dfc244 commit aea33fd

4 files changed

Lines changed: 131 additions & 0 deletions

File tree

dev-python/httpheader/ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
33
# $Id$
44

5+
*httpheader-1.1_p1 (05 Dec 2015)
6+
7+
05 Dec 2015; Johann Schmitz <ercpe@gentoo.org>
8+
+files/httpheader-1.1-python3.patch, +httpheader-1.1_p1.ebuild:
9+
dev-python/httpheader: Added patch from
10+
https://github.com/dmeranda/httpheader/pull/7 to support python3
11+
512
*httpheader-1.1 (05 Dec 2015)
613

714
05 Dec 2015; Johann Schmitz <ercpe@gentoo.org> +httpheader-1.1.ebuild,

dev-python/httpheader/Manifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
DIST httpheader-1.1.tar.gz 30404 SHA256 eac1d1cea15fbbf1aead6ff099e4d7ab1623f8dbfb04c1824d7bb0672c351987 SHA512 f95ae510c9840b47d49df763cb12bc3a318f8bb83393ab185e34a41a60eeee2f8fbfa52e5105ac7326692187817d2e25354f7b5c78a3deec82cfc4997aa5442a WHIRLPOOL 4123217b5549f96a7fa83afa65876dab5e7ca84113227b45751bf9e2e2508147e179db2d22979dc8c2e16d367af8ee39785bd97f26c1635d90ec876bb3f84db8
2+
DIST httpheader-1.1_p1.tar.gz 30404 SHA256 eac1d1cea15fbbf1aead6ff099e4d7ab1623f8dbfb04c1824d7bb0672c351987 SHA512 f95ae510c9840b47d49df763cb12bc3a318f8bb83393ab185e34a41a60eeee2f8fbfa52e5105ac7326692187817d2e25354f7b5c78a3deec82cfc4997aa5442a WHIRLPOOL 4123217b5549f96a7fa83afa65876dab5e7ca84113227b45751bf9e2e2508147e179db2d22979dc8c2e16d367af8ee39785bd97f26c1635d90ec876bb3f84db8
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
From 5804d7a276ef156dd0e977228b631dd1f543ca96 Mon Sep 17 00:00:00 2001
2+
From: Johann Schmitz <johann@j-schmitz.net>
3+
Date: Sat, 5 Dec 2015 07:15:18 +0100
4+
Subject: [PATCH] Python3 support (via 2to3). May need some extra work.
5+
6+
---
7+
httpheader.py | 23 ++++++++++++++---------
8+
1 file changed, 14 insertions(+), 9 deletions(-)
9+
10+
diff --git a/httpheader.py b/httpheader.py
11+
index e07bff4..abc5a6e 100644
12+
--- a/httpheader.py
13+
+++ b/httpheader.py
14+
@@ -100,6 +100,8 @@
15+
DIGIT = '0123456789'
16+
HEX = '0123456789ABCDEFabcdef'
17+
18+
+import sys
19+
+
20+
# Try to get a set/frozenset implementation if possible
21+
try:
22+
type(frozenset)
23+
@@ -126,7 +128,7 @@
24+
25+
def _is_string( obj ):
26+
"""Returns True if the object is a string or unicode type."""
27+
- return isinstance(obj,str) or isinstance(obj,unicode)
28+
+ return isinstance(obj, str) or isinstance(obj, unicode) if sys.version_info.major == 2 else isinstance(obj, str)
29+
30+
31+
def http_datetime( dt=None ):
32+
@@ -496,10 +498,10 @@ def _test_comments():
33+
def _testrm( a, b, collapse ):
34+
b2 = remove_comments( a, collapse )
35+
if b != b2:
36+
- print 'Comment test failed:'
37+
- print ' remove_comments( %s, collapse_spaces=%s ) -> %s' \
38+
- % (repr(a), repr(collapse), repr(b2))
39+
- print ' expected %s' % repr(b)
40+
+ print('Comment test failed:')
41+
+ print(' remove_comments( %s, collapse_spaces=%s ) -> %s' \
42+
+ % (repr(a), repr(collapse), repr(b2)))
43+
+ print(' expected %s' % repr(b))
44+
return 1
45+
return 0
46+
failures = 0
47+
@@ -1333,6 +1335,9 @@ def _set_minor(self, s):
48+
minor = property(_get_minor,_set_minor,doc="Minor media sub-classification")
49+
50+
def __nonzero__(self):
51+
+ return self.__bool__()
52+
+
53+
+ def __bool__(self):
54+
return True
55+
56+
def __str__(self):
57+
@@ -1340,13 +1345,13 @@ def __str__(self):
58+
s = '%s/%s' % (self.major, self.minor)
59+
if self.parmdict:
60+
extra = '; '.join([ '%s=%s' % (a[0],quote_string(a[1],False)) \
61+
- for a in self.parmdict.items()])
62+
+ for a in list(self.parmdict.items())])
63+
s += '; ' + extra
64+
return s
65+
66+
def __unicode__(self):
67+
"""Unicode string value."""
68+
- return unicode(self.__str__())
69+
+ return str(self.__str__())
70+
71+
def __repr__(self):
72+
"""Python representation of this object."""
73+
@@ -1509,7 +1514,7 @@ def acceptable_content_type( accept_header, content_types, ignore_wildcard=True
74+
elif client_ct.minor == server_ct.minor: # something/something is a 3
75+
matchlen = 3
76+
# must make sure all the parms match too
77+
- for pname, pval in client_ct.parmdict.items():
78+
+ for pname, pval in list(client_ct.parmdict.items()):
79+
sval = server_ct.parmdict.get(pname)
80+
if pname == 'charset':
81+
# special case for charset to match aliases
82+
@@ -1764,7 +1769,7 @@ def __str__(self):
83+
84+
def __unicode__(self):
85+
"""The unicode string form of this language tag."""
86+
- return unicode(self.__str__())
87+
+ return str(self.__str__())
88+
89+
def __repr__(self):
90+
"""The python representation of this language tag."""
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 1999-2015 Gentoo Foundation
2+
# Distributed under the terms of the GNU General Public License v2
3+
# $Id$
4+
5+
EAPI=5
6+
PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} )
7+
8+
inherit python-r1 vcs-snapshot
9+
10+
DESCRIPTION="Python module to deal with HTTP headers and content negotiation"
11+
HOMEPAGE="http://deron.meranda.us/python/httpheader/ https://github.com/dmeranda/httpheader"
12+
SRC_URI="https://github.com/dmeranda/httpheader/archive/release-${PV/_p1/}.tar.gz -> ${P}.tar.gz"
13+
14+
SLOT="0"
15+
LICENSE="GPL-2"
16+
KEYWORDS="~amd64 ~x86"
17+
IUSE="doc"
18+
19+
S="${WORKDIR}/${P}"
20+
21+
src_prepare() {
22+
epatch "${FILESDIR}"/${P/_p1/}-python3.patch
23+
}
24+
25+
src_compile() {
26+
use doc && make pydoc
27+
}
28+
29+
src_install() {
30+
python_foreach_impl python_domodule ${PN}.py
31+
32+
use doc && dodoc ${PN}.html
33+
}

0 commit comments

Comments
 (0)