Skip to content

Commit 69df0d5

Browse files
committed
wwww/py-hyper: Update to 0.8.0.dev0 (g20171217)
Latest PyPI released (0.7.0) fails several tests that have been resolved in branch:development but not yet released. - Add patches to make hyper work with h2 > 3.0 [1] Changelog: https://github.com/Lukasa/hyper/blob/development/HISTORY.rst [1] python-hyper/hyper#402 git-svn-id: svn+ssh://svn.freebsd.org/ports/head@501865 35697150-7ecd-e111-bb59-0022644237b5
1 parent ec0010d commit 69df0d5

File tree

6 files changed

+101
-200
lines changed

6 files changed

+101
-200
lines changed

www/py-hyper/Makefile

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
# $FreeBSD$
33

44
PORTNAME= hyper
5-
PORTVERSION= 0.5.0
5+
DISTVERSION= 0.8.0.g20171217
66
CATEGORIES= www python
7-
MASTER_SITES= CHEESESHOP
87
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
98

109
MAINTAINER= [email protected]
@@ -13,22 +12,33 @@ COMMENT= HTTP/2 Client for Python
1312
LICENSE= MIT
1413
LICENSE_FILE= ${WRKSRC}/LICENSE
1514

15+
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}h2>=2.4:www/py-h2@${PY_FLAVOR} \
16+
${PYTHON_PKGNAMEPREFIX}hyperframe>=3.2:www/py-hyperframe@${PY_FLAVOR} \
17+
${PYTHON_PKGNAMEPREFIX}brotlipy>=0.7.0:archivers/py-brotlipy@${PY_FLAVOR} \
18+
${PYTHON_PKGNAMEPREFIX}rfc3986>=1.1.0,<2.0:www/py-rfc3986@${PY_FLAVOR}
1619
TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR} \
1720
${PYTHON_PKGNAMEPREFIX}requests>0:www/py-requests@${PY_FLAVOR} \
18-
${PYTHON_PKGNAMEPREFIX}mock>0:devel/py-mock@${PY_FLAVOR}
21+
${PYTHON_PKGNAMEPREFIX}mock>0:devel/py-mock@${PY_FLAVOR} \
22+
${PYTHON_PKGNAMEPREFIX}hpack>0:www/py-hpack@${PY_FLAVOR}
1923

2024
USES= python
21-
USE_PYTHON= autoplist distutils
25+
USE_GITHUB= yes
26+
USE_PYTHON= autoplist concurrent distutils
27+
28+
GH_ACCOUNT= Lukasa
29+
GH_TAGNAME= 18b629b
2230

2331
NO_ARCH= yes
2432

25-
post-extract:
26-
@${MKDIR} ${WRKSRC}/test/certs/
27-
@${CP} ${FILESDIR}/files-server.py ${WRKSRC}/test/server.py
28-
@${CP} ${FILESDIR}/files-server.key ${WRKSRC}/test/certs/server.key
29-
@${CP} ${FILESDIR}/files-server.crt ${WRKSRC}/test/certs/server.crt
33+
py27_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}enum34>=1.0.4,<2:devel/py-enum34@${PY_FLAVOR}
3034

3135
do-test:
32-
@cd ${WRKSRC} && ${PYTHON_CMD} ${PYDISTUTILS_SETUP} test --pytest-args "-k 'not test_integration'"
36+
@cd ${WRKSRC} && ${PYTHON_CMD} -m pytest -v -rs -k 'not test_HTTPConnection_with_custom_context' test
37+
38+
.include <bsd.port.pre.mk>
39+
40+
.if ${PYTHON_VER} < 3.0
41+
TEST_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}futures>0:devel/py-futures@${PY_FLAVOR}
42+
.endif
3343

34-
.include <bsd.port.mk>
44+
.include <bsd.port.post.mk>

www/py-hyper/distinfo

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
SHA256 (hyper-0.5.0.tar.gz) = 034b6ad6d0ba2dafa948e5d893337ffa376ececa5725f7cc59f9319a11b0b3f3
2-
SIZE (hyper-0.5.0.tar.gz) = 255589
1+
TIMESTAMP = 1558088018
2+
SHA256 (Lukasa-hyper-0.8.0.g20171217-18b629b_GH0.tar.gz) = 2a3f656de9d6824ea3f70c8f3ca9857794e225e647698f5df9b20b33e2694a6e
3+
SIZE (Lukasa-hyper-0.8.0.g20171217-18b629b_GH0.tar.gz) = 402869

www/py-hyper/files/files-server.py

Lines changed: 0 additions & 144 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# HTTP20Connection: Fix use of ENABLE_PUSH
2+
# https://github.com/Lukasa/hyper/pull/402
3+
4+
--- hyper/http20/connection.py.orig 2019-05-17 10:15:20 UTC
5+
+++ hyper/http20/connection.py
6+
@@ -7,7 +7,7 @@ Objects that build hyper's connection-level HTTP/2 abs
7+
"""
8+
import h2.connection
9+
import h2.events
10+
-import h2.settings
11+
+from h2.settings import SettingCodes
12+
13+
from ..compat import ssl
14+
from ..tls import wrap_socket, H2_NPN_PROTOCOLS, H2C_PROTOCOL
15+
@@ -403,7 +403,7 @@ class HTTP20Connection(object):
16+
with self._conn as conn:
17+
conn.initiate_upgrade_connection()
18+
conn.update_settings(
19+
- {h2.settings.ENABLE_PUSH: int(self._enable_push)}
20+
+ {SettingCodes.ENABLE_PUSH: int(self._enable_push)}
21+
)
22+
self._send_outstanding_data()
23+
24+
@@ -424,7 +424,7 @@ class HTTP20Connection(object):
25+
with self._conn as conn:
26+
conn.initiate_connection()
27+
conn.update_settings(
28+
- {h2.settings.ENABLE_PUSH: int(self._enable_push)}
29+
+ {SettingCodes.ENABLE_PUSH: int(self._enable_push)}
30+
)
31+
self._send_outstanding_data()
32+

www/py-hyper/files/patch-setup.py

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,11 @@
1-
--- setup.py.orig 2015-10-28 10:21:14 UTC
1+
--- setup.py.orig 2019-05-17 11:59:54 UTC
22
+++ setup.py
3-
@@ -7,6 +7,7 @@ import sys
4-
5-
try:
6-
from setuptools import setup
7-
+ from setuptools.command.test import test as TestCommand
8-
except ImportError:
9-
from distutils.core import setup
10-
11-
@@ -48,6 +49,24 @@ def resolve_install_requires():
12-
return deps
13-
return []
14-
15-
+class PyTest(TestCommand):
16-
+ user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
17-
+
18-
+ def initialize_options(self):
19-
+ TestCommand.initialize_options(self)
20-
+ self.pytest_args = []
21-
+
22-
+ def finalize_options(self):
23-
+ TestCommand.finalize_options(self)
24-
+ self.test_args = []
25-
+ self.test_suite = True
26-
+
27-
+ def run_tests(self):
28-
+ #import here, cause outside the eggs aren't loaded
29-
+ import pytest
30-
+ errno = pytest.main(self.pytest_args)
31-
+ sys.exit(errno)
32-
+
33-
packages = [
34-
'hyper',
35-
'hyper.http20',
36-
@@ -90,5 +109,7 @@ setup(
37-
},
38-
extras_require={
39-
'fast': ['pycohttpparser'],
40-
- }
41-
+ },
42-
+ tests_require=['pytest'],
43-
+ cmdclass = {'test': PyTest},
44-
)
3+
@@ -77,7 +77,7 @@ setup(
4+
'Programming Language :: Python :: Implementation :: CPython',
5+
],
6+
install_requires=[
7+
- 'h2>=2.4,<3.0,!=2.5.0', 'hyperframe>=3.2,<4.0', 'rfc3986>=1.1.0,<2.0', 'brotlipy>=0.7.0,<1.0'
8+
+ 'h2>=2.4,!=2.5.0', 'hyperframe>=3.2', 'rfc3986>=1.1.0,<2.0', 'brotlipy>=0.7.0,<1.0'
9+
],
10+
tests_require=['pytest', 'requests', 'mock'],
11+
cmdclass={'test': PyTest},
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Fix use of h2.settings -> h2.settings.SettingCodes.* Based on:
2+
# HTTP20Connection: Fix use of ENABLE_PUSH
3+
# https://github.com/Lukasa/hyper/pull/402
4+
5+
# Fix hpack import (hpack_compat is gone now)
6+
# https://github.com/python-hyper/hpack/pull/60
7+
8+
--- test/test_hyper.py.orig 2019-05-17 10:17:07 UTC
9+
+++ test/test_hyper.py
10+
@@ -1,14 +1,13 @@
11+
# -*- coding: utf-8 -*-
12+
-import h2.settings
13+
-
14+
from h2.frame_buffer import FrameBuffer
15+
from h2.connection import ConnectionState
16+
+from h2.settings import SettingCodes
17+
from hyperframe.frame import (
18+
Frame, DataFrame, RstStreamFrame, SettingsFrame, PushPromiseFrame,
19+
WindowUpdateFrame, HeadersFrame, ContinuationFrame, GoAwayFrame,
20+
PingFrame, FRAME_MAX_ALLOWED_LEN
21+
)
22+
-from hpack.hpack_compat import Encoder
23+
+from hpack import Encoder
24+
from hyper.common.connection import HTTPConnection
25+
from hyper.http20.connection import HTTP20Connection
26+
from hyper.http20.response import HTTP20Response, HTTP20Push
27+
@@ -766,7 +765,7 @@ class TestHyperConnection(object):
28+
# the default max frame size (16,384 bytes). That will, on the third
29+
# frame, trigger the processing to increment the flow control window,
30+
# which should then not happen.
31+
- f = SettingsFrame(0, settings={h2.settings.INITIAL_WINDOW_SIZE: 100})
32+
+ f = SettingsFrame(0, settings={SettingCodes.INITIAL_WINDOW_SIZE: 100})
33+
34+
c = HTTP20Connection('www.google.com')
35+
c._sock = DummySocket()

0 commit comments

Comments
 (0)