File dependencies.patch of Package python-rfc6555
From b2de6951cdae722920671a690c0c15b5f9a06d60 Mon Sep 17 00:00:00 2001
From: Kurt Mosiejczuk <kurt@cranky.work>
Date: Thu, 22 Aug 2019 18:15:23 -0400
Subject: [PATCH 1/2] Only use selectors2 if needed (Python < 3.4)
---
rfc6555.py | 5 ++++-
setup.py | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/rfc6555.py b/rfc6555.py
index 8298597..222fe6c 100644
--- a/rfc6555.py
+++ b/rfc6555.py
@@ -16,7 +16,10 @@
import errno
import socket
-from selectors2 import DefaultSelector, EVENT_WRITE
+try:
+ from selectors import DefaultSelector, EVENT_WRITE
+except (ImportError, AttributeError):
+ from selectors2 import DefaultSelector, EVENT_WRITE
# time.perf_counter() is defined in Python 3.3
try:
diff --git a/setup.py b/setup.py
index ce6517a..f6f087a 100644
--- a/setup.py
+++ b/setup.py
@@ -24,7 +24,9 @@
author_email='sethmichaellarson@protonmail.com',
maintainer='Seth Michael Larson',
maintainer_email='sethmichaellarson@protonmail.com',
- install_requires=['selectors2'],
+ install_requires=[
+ 'selectors2;python_version<"3.4"'
+ ],
py_modules=['rfc6555'],
zip_safe=False,
classifiers=['Intended Audience :: Developers',
From ba7f665a613b2450b829b231a95e936039686964 Mon Sep 17 00:00:00 2001
From: Kurt Mosiejczuk <kurt@cranky.work>
Date: Thu, 12 Sep 2019 18:25:37 -0400
Subject: [PATCH 2/2] Make tests use mock built into Python 3.x if possible
---
tests/test_create_connection.py | 6 +++++-
tests/test_ipv6.py | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/tests/test_create_connection.py b/tests/test_create_connection.py
index fe38026..0603546 100644
--- a/tests/test_create_connection.py
+++ b/tests/test_create_connection.py
@@ -1,4 +1,8 @@
-import mock
+try:
+ from unittest import mock
+except (ImportError, AttributeError):
+ import mock
+
import pytest
import socket
import rfc6555
diff --git a/tests/test_ipv6.py b/tests/test_ipv6.py
index 3ee8564..d58286c 100644
--- a/tests/test_ipv6.py
+++ b/tests/test_ipv6.py
@@ -1,7 +1,11 @@
import socket
-import mock
import rfc6555
+try:
+ from unittest import mock
+except (ImportError, AttributeError):
+ import mock
+
def test_ipv6_available():
assert rfc6555._detect_ipv6()