Skip to content

Commit

Permalink
Merge f98abb5 into 84719be
Browse files Browse the repository at this point in the history
  • Loading branch information
dargueta committed Aug 8, 2019
2 parents 84719be + f98abb5 commit f5b2926
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Expand Up @@ -26,6 +26,14 @@ matrix:
- python: "3.4"
env:
- SETUPTOOLS=setuptools PIP=pip
- python: "pypy"
sudo: true
env:
- SETUPTOOLS=setuptools PIP=pip
- python: "pypy3.5-7.1.1"
sudo: true
env:
- SETUPTOOLS=setuptools PIP=pip

before_install:
- pip install $SETUPTOOLS $PIP -U
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fixed tests leaving tmp files
- Fixed typing issues
- Fixed link namespace returning bytes
- Fixed missing `errno.ENOTSUP` on PyPy. Closes [#338](https://github.com/PyFilesystem/pyfilesystem2/issues/338).

## [2.4.10] - 2019-07-29

Expand Down
24 changes: 12 additions & 12 deletions fs/osfs.py
Expand Up @@ -39,7 +39,6 @@
sendfile = None # type: ignore # pragma: no cover

from . import errors
from .errors import FileExists
from .base import FS
from .enums import ResourceType
from ._fscompat import fsencode, fsdecode, fspath
Expand Down Expand Up @@ -420,17 +419,18 @@ def _check_copy(self, src_path, dst_path, overwrite=False):

if sys.version_info[:2] < (3, 8) and sendfile is not None:

_sendfile_error_codes = frozenset(
{
errno.EIO,
errno.EINVAL,
errno.ENOSYS,
errno.ENOTSUP, # type: ignore
errno.EBADF,
errno.ENOTSOCK,
errno.EOPNOTSUPP,
}
)
_sendfile_error_codes = {
errno.EIO,
errno.EINVAL,
errno.ENOSYS,
errno.EBADF,
errno.ENOTSOCK,
errno.EOPNOTSUPP,
}

# PyPy doesn't define ENOTSUP so we have to add it conditionally.
if hasattr(errno, "ENOTSUP"):
_sendfile_error_codes.add(errno.ENOTSUP)

def copy(self, src_path, dst_path, overwrite=False):
# type: (Text, Text, bool) -> None
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Expand Up @@ -16,6 +16,8 @@
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: System :: Filesystems",
]

Expand Down
3 changes: 1 addition & 2 deletions tests/test_osfs.py
Expand Up @@ -10,7 +10,6 @@
import unittest

from fs import osfs
from fs import fsencode, fsdecode
from fs.path import relpath
from fs import errors

Expand Down Expand Up @@ -88,7 +87,7 @@ def test_expand_vars(self):
def test_copy_sendfile(self):
# try copying using sendfile
with mock.patch.object(osfs, "sendfile") as sendfile:
sendfile.side_effect = OSError(errno.ENOTSUP, "sendfile not supported")
sendfile.side_effect = OSError(errno.ENOSYS, "sendfile not supported")
self.test_copy()
# check other errors are transmitted
self.fs.touch("foo")
Expand Down

0 comments on commit f5b2926

Please sign in to comment.