From 47e4c436a8046563f2387956335620189eb50e28 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sun, 1 Jul 2018 10:29:48 -0700 Subject: [PATCH 1/3] tox/travis/appveyor: enable testing on py3.7 --- .appveyor.yml | 1 + .travis.yml | 1 + tox.ini | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index ee524b9..d164111 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -18,6 +18,7 @@ environment: - PYTHON: "C:\\Python35-x64" - PYTHON: "C:\\Python36" - PYTHON: "C:\\Python36-x64" + - PYTHON: "C:\\Python37-x64" install: - | diff --git a/.travis.yml b/.travis.yml index a732aa3..4758ff0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ python: - "3.4" - "3.5" - "3.6" + - "3.7" - "nightly" install: - pip install -U pip tox virtualenv codecov diff --git a/tox.ini b/tox.ini index a9f863f..f8ac1b6 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = {py27,py34,py35,py36,pypy,flake8} +envlist = {py27,py34,py35,py36,py37,pypy,flake8} skip_missing_interpreters = True minversion = 2.4.0 From 45315136021b9cdfdfa77eb85bfaaf9677e9f256 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sun, 1 Jul 2018 14:25:22 -0700 Subject: [PATCH 2/3] cmd_send/receive: work around python3.7.0 bug See https://bugs.python.org/issue26175 . tempfile.SpooledTemporaryFile doesn't fully implement the IOBase abstract class, which breaks because py3.7.0's new zipfile module tries to delegate .seekable down to the wrapped file and causes an AttributeError. refs #306 --- src/wormhole/cli/cmd_receive.py | 9 ++++++++- src/wormhole/cli/cmd_send.py | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/wormhole/cli/cmd_receive.py b/src/wormhole/cli/cmd_receive.py index 4b18822..3e4668d 100644 --- a/src/wormhole/cli/cmd_receive.py +++ b/src/wormhole/cli/cmd_receive.py @@ -331,7 +331,14 @@ class Receiver: self._msg(u"%d files, %s (uncompressed)" % (file_data["numfiles"], naturalsize(file_data["numbytes"]))) self._ask_permission() - return tempfile.SpooledTemporaryFile() + f = tempfile.SpooledTemporaryFile() + # workaround for https://bugs.python.org/issue26175 (STF doesn't + # fully implement IOBase abstract class), which breaks the new + # zipfile in py3.7.0 that expects .seekable + if not hasattr(f, "seekable"): + # AFAICT all the filetypes that STF wraps can seek + f.seekable = lambda: True + return f def _decide_destname(self, mode, destname): # the basename() is intended to protect us against diff --git a/src/wormhole/cli/cmd_send.py b/src/wormhole/cli/cmd_send.py index ea5d69e..e97fc8b 100644 --- a/src/wormhole/cli/cmd_send.py +++ b/src/wormhole/cli/cmd_send.py @@ -314,6 +314,12 @@ class Sender: # We're sending a directory. Create a zipfile in a tempdir and # send that. fd_to_send = tempfile.SpooledTemporaryFile() + # workaround for https://bugs.python.org/issue26175 (STF doesn't + # fully implement IOBase abstract class), which breaks the new + # zipfile in py3.7.0 that expects .seekable + if not hasattr(fd_to_send, "seekable"): + # AFAICT all the filetypes that STF wraps can seek + fd_to_send.seekable = lambda: True num_files = 0 num_bytes = 0 tostrip = len(what.split(os.sep)) From eacc6fe45033cc0959c190862302bf7aa27b06f3 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sun, 1 Jul 2018 14:33:28 -0700 Subject: [PATCH 3/3] travis/appveyor: allow failures of the py3.7 build until they're actually supported by both systems. Neither has a py3.7 image available yet. --- .appveyor.yml | 5 +++++ .travis.yml | 2 ++ 2 files changed, 7 insertions(+) diff --git a/.appveyor.yml b/.appveyor.yml index d164111..c583ab2 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -20,6 +20,11 @@ environment: - PYTHON: "C:\\Python36-x64" - PYTHON: "C:\\Python37-x64" +matrix: + allow_failures: + - PYTHON: "C:\\Python37-x64" + # appveyor does not yet install python-3.7 + install: - | %PYTHON%\python.exe -m pip install wheel tox diff --git a/.travis.yml b/.travis.yml index 4758ff0..32c699d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,4 +28,6 @@ after_success: matrix: allow_failures: - python: "3.3" + # travis doesn't support py3.7 yet + - python: "3.7" - python: "nightly"