public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/pyfakefs/files/, dev-python/pyfakefs/
@ 2018-03-24 13:18 Tim Harder
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Harder @ 2018-03-24 13:18 UTC (permalink / raw
  To: gentoo-commits

commit:     42e4ca2d9fad0bb9fff378bc17abf45a2c8af9e3
Author:     Tim Harder <radhermit <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 24 13:00:27 2018 +0000
Commit:     Tim Harder <radhermit <AT> gentoo <DOT> org>
CommitDate: Sat Mar 24 13:17:31 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=42e4ca2d

dev-python/pyfakefs: version bump to 3.4.1

 dev-python/pyfakefs/Manifest                       |  1 +
 .../pyfakefs/files/pyfakefs-3.4.1-tests.patch      | 40 ++++++++++++++++++++++
 dev-python/pyfakefs/pyfakefs-3.4.1.ebuild          | 26 ++++++++++++++
 3 files changed, 67 insertions(+)

diff --git a/dev-python/pyfakefs/Manifest b/dev-python/pyfakefs/Manifest
index 4119d7c6310..b60e61ccabc 100644
--- a/dev-python/pyfakefs/Manifest
+++ b/dev-python/pyfakefs/Manifest
@@ -1 +1,2 @@
 DIST pyfakefs-3.3.tar.gz 141704 BLAKE2B f805146024d9886ce6cb25b23f6f818bb37cac00a51528375b3da3e728515cb5ffd292352888861ff2b434ff71dd730bfbd84874fee0ae1f4d2cfca974f73771 SHA512 0044643964a4f2329d777476940b38d2d63c6de8f854992b4fba7b7e49f1186e7ce9811f83c9870655cbe33b7dda816c1aa1ce685e800e55c06d175c281748b7
+DIST pyfakefs-3.4.1.tar.gz 151662 BLAKE2B cbfdd7ab4c2936d484b5ff1e22852438c5c653e8875b7d363324e0a1aed0bfc5c492c2cd5c64a47052fcb4d043f567819f32067527b870ab42da8cfd92d40be3 SHA512 1be0254455f6046f1d28bf4377d17e0fb943b4b0db09e933c114f587f3d917877b23ee1610cf83a6330b406bb9ae66fe79dea31a6bf75c0b9c2b79a88d07e753

diff --git a/dev-python/pyfakefs/files/pyfakefs-3.4.1-tests.patch b/dev-python/pyfakefs/files/pyfakefs-3.4.1-tests.patch
new file mode 100644
index 00000000000..d893a3adcb7
--- /dev/null
+++ b/dev-python/pyfakefs/files/pyfakefs-3.4.1-tests.patch
@@ -0,0 +1,40 @@
+Drop checks that fail due to sandboxing and skip failing tell check.
+
+--- pyfakefs-3.4.1/tests/fake_os_test.py
++++ pyfakefs-3.4.1/tests/fake_os_test.py
+@@ -449,7 +449,6 @@
+         self.os.chdir(directory)
+         self.assert_raises_os_error(dir_error, self.os.remove, dir_path)
+         self.assertTrue(self.os.path.exists(dir_path))
+-        self.assert_raises_os_error(errno.ENOENT, self.os.remove, '/plugh')
+ 
+     def test_remove_dir_linux(self):
+         self.check_linux_only()
+@@ -963,6 +962,8 @@
+             self.assertEqual(b'\0\0abcde', f.read())
+ 
+     def test_append_mode_tell_linux_windows(self):
++        # skipping real fs test - python2 on the actual filesystem is also 7
++        self.skip_real_fs()
+         self.check_linux_and_windows()
+         tell_result = 5 if self.is_python2 else 7
+         self.check_append_mode_tell_after_truncate(tell_result)
+@@ -1885,8 +1886,8 @@
+         # trying to create a link from a non-existent file should fail
+         self.skip_if_symlink_not_supported()
+         self.assert_raises_os_error(errno.ENOENT,
+-                                    self.os.link, '/nonexistent_source',
+-                                    '/link_dest')
++                                    self.os.link, 'nonexistent_source',
++                                    'link_dest')
+ 
+     def test_link_delete(self):
+         self.skip_if_symlink_not_supported()
+@@ -2233,7 +2234,6 @@
+         self.os.chdir(directory)
+         self.assert_raises_os_error(dir_error, self.os.remove, dir_path)
+         self.assertTrue(self.os.path.exists(dir_path))
+-        self.assert_raises_os_error(errno.ENOENT, self.os.remove, '/Plugh')
+ 
+     def test_remove_dir_mac_os(self):
+         self.check_macos_only()

diff --git a/dev-python/pyfakefs/pyfakefs-3.4.1.ebuild b/dev-python/pyfakefs/pyfakefs-3.4.1.ebuild
new file mode 100644
index 00000000000..36f46d577c5
--- /dev/null
+++ b/dev-python/pyfakefs/pyfakefs-3.4.1.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} pypy{,3} )
+DISTUTILS_IN_SOURCE_BUILD=1
+
+inherit distutils-r1
+
+DESCRIPTION="a fake file system that mocks the Python file system modules"
+HOMEPAGE="https://github.com/jmcgeheeiv/pyfakefs/ https://pypi.python.org/pypi/pyfakefs"
+SRC_URI="https://github.com/jmcgeheeiv/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
+RDEPEND=""
+
+PATCHES=( "${FILESDIR}"/${P}-tests.patch )
+
+python_test() {
+	"${PYTHON}" tests/all_tests.py || die "tests failed under ${EPYTHON}"
+}


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/pyfakefs/files/, dev-python/pyfakefs/
@ 2018-06-17 11:25 Tim Harder
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Harder @ 2018-06-17 11:25 UTC (permalink / raw
  To: gentoo-commits

commit:     8eb09c83d6906084538403b8f72392799df784ac
Author:     Tim Harder <radhermit <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 17 11:11:25 2018 +0000
Commit:     Tim Harder <radhermit <AT> gentoo <DOT> org>
CommitDate: Sun Jun 17 11:24:51 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8eb09c83

dev-python/pyfakefs: version bump to 3.4.3

 dev-python/pyfakefs/Manifest                       |  1 +
 .../pyfakefs/files/pyfakefs-3.4.3-tests.patch      | 40 ++++++++++++++++++++++
 dev-python/pyfakefs/pyfakefs-3.4.3.ebuild          | 26 ++++++++++++++
 3 files changed, 67 insertions(+)

diff --git a/dev-python/pyfakefs/Manifest b/dev-python/pyfakefs/Manifest
index b60e61ccabc..62329512cd3 100644
--- a/dev-python/pyfakefs/Manifest
+++ b/dev-python/pyfakefs/Manifest
@@ -1,2 +1,3 @@
 DIST pyfakefs-3.3.tar.gz 141704 BLAKE2B f805146024d9886ce6cb25b23f6f818bb37cac00a51528375b3da3e728515cb5ffd292352888861ff2b434ff71dd730bfbd84874fee0ae1f4d2cfca974f73771 SHA512 0044643964a4f2329d777476940b38d2d63c6de8f854992b4fba7b7e49f1186e7ce9811f83c9870655cbe33b7dda816c1aa1ce685e800e55c06d175c281748b7
 DIST pyfakefs-3.4.1.tar.gz 151662 BLAKE2B cbfdd7ab4c2936d484b5ff1e22852438c5c653e8875b7d363324e0a1aed0bfc5c492c2cd5c64a47052fcb4d043f567819f32067527b870ab42da8cfd92d40be3 SHA512 1be0254455f6046f1d28bf4377d17e0fb943b4b0db09e933c114f587f3d917877b23ee1610cf83a6330b406bb9ae66fe79dea31a6bf75c0b9c2b79a88d07e753
+DIST pyfakefs-3.4.3.tar.gz 156896 BLAKE2B 2450cb67dbb25d2029a113dd95c3d51e60ef66c6683a5898ea73800ce1269d628af9f8daa85195d5b473f18b7c3262f2f26fc9c17caf80ce2f5159c247ebea5b SHA512 aafcad5d801f625273239221c56e46229ff8ab622cfb474d92f8555cfff90279ad9a092c20878279454c59033ad23d53cfe877023ac5d20c5a67a610b62ba7f1

diff --git a/dev-python/pyfakefs/files/pyfakefs-3.4.3-tests.patch b/dev-python/pyfakefs/files/pyfakefs-3.4.3-tests.patch
new file mode 100644
index 00000000000..c87005b054c
--- /dev/null
+++ b/dev-python/pyfakefs/files/pyfakefs-3.4.3-tests.patch
@@ -0,0 +1,40 @@
+Drop checks that fail due to sandboxing and skip failing tell check.
+
+--- pyfakefs-3.4.3/pyfakefs/tests/fake_os_test.py
++++ pyfakefs-3.4.3/pyfakefs/tests/fake_os_test.py
+@@ -688,7 +688,6 @@
+         self.os.chdir(directory)
+         self.assert_raises_os_error(dir_error, self.os.remove, dir_path)
+         self.assertTrue(self.os.path.exists(dir_path))
+-        self.assert_raises_os_error(errno.ENOENT, self.os.remove, '/plugh')
+ 
+     def test_remove_dir_linux(self):
+         self.check_linux_only()
+@@ -1202,6 +1201,8 @@
+             self.assertEqual(b'\0\0abcde', f.read())
+ 
+     def test_append_mode_tell_linux_windows(self):
++        # skipping real fs test - python2 on the actual filesystem is also 7
++        self.skip_real_fs()
+         # Regression test for #300
+         self.check_linux_and_windows()
+         tell_result = 5 if self.is_python2 else 7
+@@ -2443,8 +2444,8 @@
+         # trying to create a link from a non-existent file should fail
+         self.skip_if_symlink_not_supported()
+         self.assert_raises_os_error(errno.ENOENT,
+-                                    self.os.link, '/nonexistent_source',
+-                                    '/link_dest')
++                                    self.os.link, 'nonexistent_source',
++                                    'link_dest')
+ 
+     def test_link_delete(self):
+         self.skip_if_symlink_not_supported()
+@@ -2791,7 +2792,6 @@
+         self.os.chdir(directory)
+         self.assert_raises_os_error(dir_error, self.os.remove, dir_path)
+         self.assertTrue(self.os.path.exists(dir_path))
+-        self.assert_raises_os_error(errno.ENOENT, self.os.remove, '/Plugh')
+ 
+     def test_remove_dir_mac_os(self):
+         self.check_macos_only()

diff --git a/dev-python/pyfakefs/pyfakefs-3.4.3.ebuild b/dev-python/pyfakefs/pyfakefs-3.4.3.ebuild
new file mode 100644
index 00000000000..4c18bdf736f
--- /dev/null
+++ b/dev-python/pyfakefs/pyfakefs-3.4.3.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} pypy{,3} )
+DISTUTILS_IN_SOURCE_BUILD=1
+
+inherit distutils-r1
+
+DESCRIPTION="a fake file system that mocks the Python file system modules"
+HOMEPAGE="https://github.com/jmcgeheeiv/pyfakefs/ https://pypi.org/project/pyfakefs/"
+SRC_URI="https://github.com/jmcgeheeiv/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+
+DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
+RDEPEND=""
+
+PATCHES=( "${FILESDIR}"/${P}-tests.patch )
+
+python_test() {
+	"${PYTHON}" -m ${PN}.tests.all_tests || die "tests failed under ${EPYTHON}"
+}


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/pyfakefs/files/, dev-python/pyfakefs/
@ 2021-06-02 16:12 Michał Górny
  0 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2021-06-02 16:12 UTC (permalink / raw
  To: gentoo-commits

commit:     e9107ff787011fc48d4d8a48499242f4d4f7c889
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  2 15:23:48 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun  2 16:12:37 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e9107ff7

dev-python/pyfakefs: Enable py3.10

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../pyfakefs/files/pyfakefs-4.4.0-py310.patch      | 265 +++++++++++++++++++++
 dev-python/pyfakefs/pyfakefs-4.4.0.ebuild          |   6 +-
 2 files changed, 270 insertions(+), 1 deletion(-)

diff --git a/dev-python/pyfakefs/files/pyfakefs-4.4.0-py310.patch b/dev-python/pyfakefs/files/pyfakefs-4.4.0-py310.patch
new file mode 100644
index 00000000000..6ef35df7d1f
--- /dev/null
+++ b/dev-python/pyfakefs/files/pyfakefs-4.4.0-py310.patch
@@ -0,0 +1,265 @@
+From a8a70bb7746ba24aa60c9915311e1ff5b402146c Mon Sep 17 00:00:00 2001
+From: Carl Montanari <8515611+carlmontanari@users.noreply.github.com>
+Date: Thu, 13 May 2021 22:44:45 -0700
+Subject: [PATCH] Add support for Python 3.10 beta1 (#594)
+
+- add Python 3.10-beta1 to CI
+- adapt fake pathlib, fix pathlib.Path methods link_to, getcwd, lchmod
+- handle dummy encoding "locale" introduced in Python 3.10
+- do not test extra dependencies with Python 3.10 (some are not available)
+---
+ pyfakefs/fake_filesystem.py         | 15 ++++---
+ pyfakefs/fake_pathlib.py            | 64 ++++++++++++++++++++++-------
+ pyfakefs/helpers.py                 |  9 ++++
+ pyfakefs/tests/fake_pathlib_test.py | 27 +++++++++---
+ 6 files changed, 109 insertions(+), 32 deletions(-)
+
+diff --git a/pyfakefs/fake_filesystem.py b/pyfakefs/fake_filesystem.py
+index 1e9bfc8..971dc93 100644
+--- a/pyfakefs/fake_filesystem.py
++++ b/pyfakefs/fake_filesystem.py
+@@ -114,7 +114,7 @@ from pyfakefs.fake_scandir import scandir, walk
+ from pyfakefs.helpers import (
+     FakeStatResult, BinaryBufferIO, TextBufferIO,
+     is_int_type, is_byte_string, is_unicode_string,
+-    make_string_path, IS_WIN, to_string, matching_string
++    make_string_path, IS_WIN, to_string, matching_string, real_encoding
+ )
+ from pyfakefs import __version__  # noqa: F401 for upwards compatibility
+ 
+@@ -293,7 +293,7 @@ class FakeFile:
+         if st_mode >> 12 == 0:
+             st_mode |= S_IFREG
+         self.stat_result.st_mode = st_mode
+-        self.encoding = encoding
++        self.encoding = real_encoding(encoding)
+         self.errors = errors or 'strict'
+         self._byte_contents = self._encode_contents(contents)
+         self.stat_result.st_size = (
+@@ -430,7 +430,7 @@ class FakeFile:
+           OSError: if `st_size` is not a non-negative integer,
+                    or if it exceeds the available file system space.
+         """
+-        self.encoding = encoding
++        self.encoding = real_encoding(encoding)
+         changed = self._set_initial_contents(contents)
+         if self._side_effect is not None:
+             self._side_effect(self)
+@@ -1177,9 +1177,12 @@ class FakeFilesystem:
+             OSError: if the filesystem object doesn't exist.
+         """
+         # stat should return the tuple representing return value of os.stat
+-        file_object = self.resolve(
+-            entry_path, follow_symlinks,
+-            allow_fd=True, check_read_perm=False)
++        try:
++            file_object = self.resolve(
++                entry_path, follow_symlinks,
++                allow_fd=True, check_read_perm=False)
++        except TypeError:
++            file_object = self.resolve(entry_path)
+         if not is_root():
+             # make sure stat raises if a parent dir is not readable
+             parent_dir = file_object.parent_dir
+diff --git a/pyfakefs/fake_pathlib.py b/pyfakefs/fake_pathlib.py
+index b43b178..09933fa 100644
+--- a/pyfakefs/fake_pathlib.py
++++ b/pyfakefs/fake_pathlib.py
+@@ -53,8 +53,8 @@ def init_module(filesystem):
+ 
+ def _wrap_strfunc(strfunc):
+     @functools.wraps(strfunc)
+-    def _wrapped(pathobj, *args):
+-        return strfunc(pathobj.filesystem, str(pathobj), *args)
++    def _wrapped(pathobj, *args, **kwargs):
++        return strfunc(pathobj.filesystem, str(pathobj), *args, **kwargs)
+ 
+     return staticmethod(_wrapped)
+ 
+@@ -94,19 +94,24 @@ class _FakeAccessor(accessor):
+ 
+     listdir = _wrap_strfunc(FakeFilesystem.listdir)
+ 
+-    chmod = _wrap_strfunc(FakeFilesystem.chmod)
+-
+     if use_scandir:
+         scandir = _wrap_strfunc(fake_scandir.scandir)
+ 
+     if hasattr(os, "lchmod"):
+         lchmod = _wrap_strfunc(lambda fs, path, mode: FakeFilesystem.chmod(
+             fs, path, mode, follow_symlinks=False))
++        chmod = _wrap_strfunc(FakeFilesystem.chmod)
+     else:
+-        def lchmod(self, pathobj, mode):
++        def lchmod(self, pathobj,  *args, **kwargs):
+             """Raises not implemented for Windows systems."""
+             raise NotImplementedError("lchmod() not available on this system")
+ 
++        def chmod(self, pathobj, *args, **kwargs):
++            if "follow_symlinks" in kwargs and not kwargs["follow_symlinks"]:
++                raise NotImplementedError(
++                    "lchmod() not available on this system")
++            return pathobj.filesystem.chmod(str(pathobj), *args, **kwargs)
++
+     mkdir = _wrap_strfunc(FakeFilesystem.makedir)
+ 
+     unlink = _wrap_strfunc(FakeFilesystem.remove)
+@@ -124,13 +129,21 @@ class _FakeAccessor(accessor):
+         FakeFilesystem.create_symlink(fs, file_path, link_target,
+                                       create_missing_dirs=False))
+ 
+-    if sys.version_info >= (3, 8):
++    if (3, 8) <= sys.version_info < (3, 10):
+         link_to = _wrap_binary_strfunc(
+             lambda fs, file_path, link_target:
+             FakeFilesystem.link(fs, file_path, link_target))
+ 
+-    if sys.version_info >= (3, 9):
+-        readlink = _wrap_strfunc(FakeFilesystem.readlink)
++    if sys.version_info >= (3, 10):
++        link = _wrap_binary_strfunc(
++            lambda fs, file_path, link_target:
++            FakeFilesystem.link(fs, file_path, link_target))
++
++        # this will use the fake filesystem because os is patched
++        def getcwd(self):
++            return os.getcwd()
++
++    readlink = _wrap_strfunc(FakeFilesystem.readlink)
+ 
+     utime = _wrap_strfunc(FakeFilesystem.utime)
+ 
+@@ -461,19 +474,42 @@ class FakePath(pathlib.Path):
+             cls = (FakePathlibModule.WindowsPath
+                    if cls.filesystem.is_windows_fs
+                    else FakePathlibModule.PosixPath)
+-        self = cls._from_parts(args, init=True)
++        self = cls._from_parts(args)
+         return self
+ 
+-    def _path(self):
+-        """Returns the underlying path string as used by the fake filesystem.
+-        """
+-        return str(self)
++    @classmethod
++    def _from_parts(cls, args, init=False):  # pylint: disable=unused-argument
++        # Overwritten to call _init to set the fake accessor,
++        # which is not done since Python 3.10
++        self = object.__new__(cls)
++        self._init()
++        drv, root, parts = self._parse_args(args)
++        self._drv = drv
++        self._root = root
++        self._parts = parts
++        return self
++
++    @classmethod
++    def _from_parsed_parts(cls, drv, root, parts):
++        # Overwritten to call _init to set the fake accessor,
++        # which is not done since Python 3.10
++        self = object.__new__(cls)
++        self._init()
++        self._drv = drv
++        self._root = root
++        self._parts = parts
++        return self
+ 
+     def _init(self, template=None):
+         """Initializer called from base class."""
+         self._accessor = _fake_accessor
+         self._closed = False
+ 
++    def _path(self):
++        """Returns the underlying path string as used by the fake filesystem.
++        """
++        return str(self)
++
+     @classmethod
+     def cwd(cls):
+         """Return a new path pointing to the current working directory
+@@ -722,7 +758,7 @@ class RealPath(pathlib.Path):
+         if cls is RealPathlibModule.Path:
+             cls = (RealPathlibModule.WindowsPath if os.name == 'nt'
+                    else RealPathlibModule.PosixPath)
+-        self = cls._from_parts(args, init=True)
++        self = cls._from_parts(args)
+         return self
+ 
+ 
+diff --git a/pyfakefs/helpers.py b/pyfakefs/helpers.py
+index aa3959d..08962fc 100644
+--- a/pyfakefs/helpers.py
++++ b/pyfakefs/helpers.py
+@@ -57,6 +57,15 @@ def to_string(path):
+     return path
+ 
+ 
++def real_encoding(encoding):
++    """Since Python 3.10, the new function ``io.text_encoding`` returns
++    "locale" as the encoding if None is defined. This will be handled
++    as no encoding in pyfakefs."""
++    if sys.version_info >= (3, 10):
++        return encoding if encoding != "locale" else None
++    return encoding
++
++
+ def matching_string(matched, string):
+     """Return the string as byte or unicode depending
+     on the type of matched, assuming string is an ASCII string.
+diff --git a/pyfakefs/tests/fake_pathlib_test.py b/pyfakefs/tests/fake_pathlib_test.py
+index 5dcc57f..efea509 100644
+--- a/pyfakefs/tests/fake_pathlib_test.py
++++ b/pyfakefs/tests/fake_pathlib_test.py
+@@ -378,10 +378,11 @@ class FakePathlibFileObjectPropertyTest(RealPathlibTestCase):
+         # we get stat.S_IFLNK | 0o755 under MacOs
+         self.assertEqual(link_stat.st_mode, stat.S_IFLNK | 0o777)
+ 
+-    @unittest.skipIf(sys.platform == 'darwin',
+-                     'Different behavior under MacOs')
+     def test_lchmod(self):
+         self.skip_if_symlink_not_supported()
++        if (sys.version_info >= (3, 10) and self.use_real_fs() and
++                'chmod' not in os.supports_follow_symlinks):
++            raise unittest.SkipTest('follow_symlinks not available for chmod')
+         file_stat = self.os.stat(self.file_path)
+         link_stat = self.os.lstat(self.file_link_path)
+         if not hasattr(os, "lchmod"):
+@@ -390,8 +391,9 @@ class FakePathlibFileObjectPropertyTest(RealPathlibTestCase):
+         else:
+             self.path(self.file_link_path).lchmod(0o444)
+             self.assertEqual(file_stat.st_mode, stat.S_IFREG | 0o666)
+-            # we get stat.S_IFLNK | 0o755 under MacOs
+-            self.assertEqual(link_stat.st_mode, stat.S_IFLNK | 0o444)
++            # the exact mode depends on OS and Python version
++            self.assertEqual(link_stat.st_mode & 0o777700,
++                             stat.S_IFLNK | 0o700)
+ 
+     def test_resolve(self):
+         self.create_dir(self.make_path('antoine', 'docs'))
+@@ -968,7 +970,22 @@ class FakePathlibUsageInOsFunctionsTest(RealPathlibTestCase):
+     def test_stat(self):
+         path = self.make_path('foo', 'bar', 'baz')
+         self.create_file(path, contents='1234567')
+-        self.assertEqual(self.os.stat(path), self.os.stat(self.path(path)))
++        self.assertEqual(self.os.stat(path), self.path(path).stat())
++
++    @unittest.skipIf(sys.version_info < (3, 10), "New in Python 3.10")
++    def test_stat_follow_symlinks(self):
++        self.check_posix_only()
++        directory = self.make_path('foo')
++        base_name = 'bar'
++        file_path = self.path(self.os.path.join(directory, base_name))
++        link_path = self.path(self.os.path.join(directory, 'link'))
++        contents = "contents"
++        self.create_file(file_path, contents=contents)
++        self.create_symlink(link_path, base_name)
++        self.assertEqual(len(contents),
++                         link_path.stat(follow_symlinks=True)[stat.ST_SIZE])
++        self.assertEqual(len(base_name),
++                         link_path.stat(follow_symlinks=False)[stat.ST_SIZE])
+ 
+     def test_utime(self):
+         path = self.make_path('some_file')
+-- 
+2.31.1
+

diff --git a/dev-python/pyfakefs/pyfakefs-4.4.0.ebuild b/dev-python/pyfakefs/pyfakefs-4.4.0.ebuild
index e7a85e83b59..5e06b22143d 100644
--- a/dev-python/pyfakefs/pyfakefs-4.4.0.ebuild
+++ b/dev-python/pyfakefs/pyfakefs-4.4.0.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7..9} pypy3 )
+PYTHON_COMPAT=( python3_{7..10} pypy3 )
 DISTUTILS_IN_SOURCE_BUILD=1
 
 inherit distutils-r1
@@ -18,6 +18,10 @@ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x
 
 distutils_enable_tests pytest
 
+PATCHES=(
+	"${FILESDIR}"/${P}-py310.patch
+)
+
 python_test() {
 	"${EPYTHON}" -m pyfakefs.tests.all_tests -v || die "tests failed under ${EPYTHON}"
 }


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/pyfakefs/files/, dev-python/pyfakefs/
@ 2021-07-12 22:53 Michał Górny
  0 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2021-07-12 22:53 UTC (permalink / raw
  To: gentoo-commits

commit:     e1740d9d85492ec628a2c63242e1eec929da2bd7
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 12 22:53:13 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jul 12 22:53:13 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e1740d9d

dev-python/pyfakefs: Remove old

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/pyfakefs/Manifest                       |   1 -
 .../pyfakefs/files/pyfakefs-4.4.0-py310.patch      | 265 ---------------------
 dev-python/pyfakefs/pyfakefs-4.4.0.ebuild          |  27 ---
 3 files changed, 293 deletions(-)

diff --git a/dev-python/pyfakefs/Manifest b/dev-python/pyfakefs/Manifest
index 0cb16f29f83..8faef02f6a1 100644
--- a/dev-python/pyfakefs/Manifest
+++ b/dev-python/pyfakefs/Manifest
@@ -1,2 +1 @@
-DIST pyfakefs-4.4.0.tar.gz 196236 BLAKE2B d19fb44320d9c7eab1e97ee4123da548f1e3b2f8f6b0e3be762b6228677fa165ed1b60364481c53f54e79e50a2f98d298e7ff6e65f40aa9c4e372a0f72e19d52 SHA512 774e5e213ee8ce17759cdeaa4ce1d70c43df25f0885c73c7e8aa923973a43f48d9fb19d45105a6a5c5d1c6a0c54c22fe4d80ec3ec92ac7cd97c50fb532af90bc
 DIST pyfakefs-4.5.0.tar.gz 198107 BLAKE2B ee055ba5e5b53fc91cfb83a29b6fe77f6ea89576c1f3f13e46cd71ddcfe81630f3639000de1ca14bd9a56bcf4a09046fce313f65722327b63098142e5c0030cf SHA512 24a4555b197d089c2a039354f693748415035a587d0194d7d6494b83b507db2dd7e34f748fccb18f151b2673f06ce290fab02f6eb56d2691d5ab72ac12b2b233

diff --git a/dev-python/pyfakefs/files/pyfakefs-4.4.0-py310.patch b/dev-python/pyfakefs/files/pyfakefs-4.4.0-py310.patch
deleted file mode 100644
index 6ef35df7d1f..00000000000
--- a/dev-python/pyfakefs/files/pyfakefs-4.4.0-py310.patch
+++ /dev/null
@@ -1,265 +0,0 @@
-From a8a70bb7746ba24aa60c9915311e1ff5b402146c Mon Sep 17 00:00:00 2001
-From: Carl Montanari <8515611+carlmontanari@users.noreply.github.com>
-Date: Thu, 13 May 2021 22:44:45 -0700
-Subject: [PATCH] Add support for Python 3.10 beta1 (#594)
-
-- add Python 3.10-beta1 to CI
-- adapt fake pathlib, fix pathlib.Path methods link_to, getcwd, lchmod
-- handle dummy encoding "locale" introduced in Python 3.10
-- do not test extra dependencies with Python 3.10 (some are not available)
----
- pyfakefs/fake_filesystem.py         | 15 ++++---
- pyfakefs/fake_pathlib.py            | 64 ++++++++++++++++++++++-------
- pyfakefs/helpers.py                 |  9 ++++
- pyfakefs/tests/fake_pathlib_test.py | 27 +++++++++---
- 6 files changed, 109 insertions(+), 32 deletions(-)
-
-diff --git a/pyfakefs/fake_filesystem.py b/pyfakefs/fake_filesystem.py
-index 1e9bfc8..971dc93 100644
---- a/pyfakefs/fake_filesystem.py
-+++ b/pyfakefs/fake_filesystem.py
-@@ -114,7 +114,7 @@ from pyfakefs.fake_scandir import scandir, walk
- from pyfakefs.helpers import (
-     FakeStatResult, BinaryBufferIO, TextBufferIO,
-     is_int_type, is_byte_string, is_unicode_string,
--    make_string_path, IS_WIN, to_string, matching_string
-+    make_string_path, IS_WIN, to_string, matching_string, real_encoding
- )
- from pyfakefs import __version__  # noqa: F401 for upwards compatibility
- 
-@@ -293,7 +293,7 @@ class FakeFile:
-         if st_mode >> 12 == 0:
-             st_mode |= S_IFREG
-         self.stat_result.st_mode = st_mode
--        self.encoding = encoding
-+        self.encoding = real_encoding(encoding)
-         self.errors = errors or 'strict'
-         self._byte_contents = self._encode_contents(contents)
-         self.stat_result.st_size = (
-@@ -430,7 +430,7 @@ class FakeFile:
-           OSError: if `st_size` is not a non-negative integer,
-                    or if it exceeds the available file system space.
-         """
--        self.encoding = encoding
-+        self.encoding = real_encoding(encoding)
-         changed = self._set_initial_contents(contents)
-         if self._side_effect is not None:
-             self._side_effect(self)
-@@ -1177,9 +1177,12 @@ class FakeFilesystem:
-             OSError: if the filesystem object doesn't exist.
-         """
-         # stat should return the tuple representing return value of os.stat
--        file_object = self.resolve(
--            entry_path, follow_symlinks,
--            allow_fd=True, check_read_perm=False)
-+        try:
-+            file_object = self.resolve(
-+                entry_path, follow_symlinks,
-+                allow_fd=True, check_read_perm=False)
-+        except TypeError:
-+            file_object = self.resolve(entry_path)
-         if not is_root():
-             # make sure stat raises if a parent dir is not readable
-             parent_dir = file_object.parent_dir
-diff --git a/pyfakefs/fake_pathlib.py b/pyfakefs/fake_pathlib.py
-index b43b178..09933fa 100644
---- a/pyfakefs/fake_pathlib.py
-+++ b/pyfakefs/fake_pathlib.py
-@@ -53,8 +53,8 @@ def init_module(filesystem):
- 
- def _wrap_strfunc(strfunc):
-     @functools.wraps(strfunc)
--    def _wrapped(pathobj, *args):
--        return strfunc(pathobj.filesystem, str(pathobj), *args)
-+    def _wrapped(pathobj, *args, **kwargs):
-+        return strfunc(pathobj.filesystem, str(pathobj), *args, **kwargs)
- 
-     return staticmethod(_wrapped)
- 
-@@ -94,19 +94,24 @@ class _FakeAccessor(accessor):
- 
-     listdir = _wrap_strfunc(FakeFilesystem.listdir)
- 
--    chmod = _wrap_strfunc(FakeFilesystem.chmod)
--
-     if use_scandir:
-         scandir = _wrap_strfunc(fake_scandir.scandir)
- 
-     if hasattr(os, "lchmod"):
-         lchmod = _wrap_strfunc(lambda fs, path, mode: FakeFilesystem.chmod(
-             fs, path, mode, follow_symlinks=False))
-+        chmod = _wrap_strfunc(FakeFilesystem.chmod)
-     else:
--        def lchmod(self, pathobj, mode):
-+        def lchmod(self, pathobj,  *args, **kwargs):
-             """Raises not implemented for Windows systems."""
-             raise NotImplementedError("lchmod() not available on this system")
- 
-+        def chmod(self, pathobj, *args, **kwargs):
-+            if "follow_symlinks" in kwargs and not kwargs["follow_symlinks"]:
-+                raise NotImplementedError(
-+                    "lchmod() not available on this system")
-+            return pathobj.filesystem.chmod(str(pathobj), *args, **kwargs)
-+
-     mkdir = _wrap_strfunc(FakeFilesystem.makedir)
- 
-     unlink = _wrap_strfunc(FakeFilesystem.remove)
-@@ -124,13 +129,21 @@ class _FakeAccessor(accessor):
-         FakeFilesystem.create_symlink(fs, file_path, link_target,
-                                       create_missing_dirs=False))
- 
--    if sys.version_info >= (3, 8):
-+    if (3, 8) <= sys.version_info < (3, 10):
-         link_to = _wrap_binary_strfunc(
-             lambda fs, file_path, link_target:
-             FakeFilesystem.link(fs, file_path, link_target))
- 
--    if sys.version_info >= (3, 9):
--        readlink = _wrap_strfunc(FakeFilesystem.readlink)
-+    if sys.version_info >= (3, 10):
-+        link = _wrap_binary_strfunc(
-+            lambda fs, file_path, link_target:
-+            FakeFilesystem.link(fs, file_path, link_target))
-+
-+        # this will use the fake filesystem because os is patched
-+        def getcwd(self):
-+            return os.getcwd()
-+
-+    readlink = _wrap_strfunc(FakeFilesystem.readlink)
- 
-     utime = _wrap_strfunc(FakeFilesystem.utime)
- 
-@@ -461,19 +474,42 @@ class FakePath(pathlib.Path):
-             cls = (FakePathlibModule.WindowsPath
-                    if cls.filesystem.is_windows_fs
-                    else FakePathlibModule.PosixPath)
--        self = cls._from_parts(args, init=True)
-+        self = cls._from_parts(args)
-         return self
- 
--    def _path(self):
--        """Returns the underlying path string as used by the fake filesystem.
--        """
--        return str(self)
-+    @classmethod
-+    def _from_parts(cls, args, init=False):  # pylint: disable=unused-argument
-+        # Overwritten to call _init to set the fake accessor,
-+        # which is not done since Python 3.10
-+        self = object.__new__(cls)
-+        self._init()
-+        drv, root, parts = self._parse_args(args)
-+        self._drv = drv
-+        self._root = root
-+        self._parts = parts
-+        return self
-+
-+    @classmethod
-+    def _from_parsed_parts(cls, drv, root, parts):
-+        # Overwritten to call _init to set the fake accessor,
-+        # which is not done since Python 3.10
-+        self = object.__new__(cls)
-+        self._init()
-+        self._drv = drv
-+        self._root = root
-+        self._parts = parts
-+        return self
- 
-     def _init(self, template=None):
-         """Initializer called from base class."""
-         self._accessor = _fake_accessor
-         self._closed = False
- 
-+    def _path(self):
-+        """Returns the underlying path string as used by the fake filesystem.
-+        """
-+        return str(self)
-+
-     @classmethod
-     def cwd(cls):
-         """Return a new path pointing to the current working directory
-@@ -722,7 +758,7 @@ class RealPath(pathlib.Path):
-         if cls is RealPathlibModule.Path:
-             cls = (RealPathlibModule.WindowsPath if os.name == 'nt'
-                    else RealPathlibModule.PosixPath)
--        self = cls._from_parts(args, init=True)
-+        self = cls._from_parts(args)
-         return self
- 
- 
-diff --git a/pyfakefs/helpers.py b/pyfakefs/helpers.py
-index aa3959d..08962fc 100644
---- a/pyfakefs/helpers.py
-+++ b/pyfakefs/helpers.py
-@@ -57,6 +57,15 @@ def to_string(path):
-     return path
- 
- 
-+def real_encoding(encoding):
-+    """Since Python 3.10, the new function ``io.text_encoding`` returns
-+    "locale" as the encoding if None is defined. This will be handled
-+    as no encoding in pyfakefs."""
-+    if sys.version_info >= (3, 10):
-+        return encoding if encoding != "locale" else None
-+    return encoding
-+
-+
- def matching_string(matched, string):
-     """Return the string as byte or unicode depending
-     on the type of matched, assuming string is an ASCII string.
-diff --git a/pyfakefs/tests/fake_pathlib_test.py b/pyfakefs/tests/fake_pathlib_test.py
-index 5dcc57f..efea509 100644
---- a/pyfakefs/tests/fake_pathlib_test.py
-+++ b/pyfakefs/tests/fake_pathlib_test.py
-@@ -378,10 +378,11 @@ class FakePathlibFileObjectPropertyTest(RealPathlibTestCase):
-         # we get stat.S_IFLNK | 0o755 under MacOs
-         self.assertEqual(link_stat.st_mode, stat.S_IFLNK | 0o777)
- 
--    @unittest.skipIf(sys.platform == 'darwin',
--                     'Different behavior under MacOs')
-     def test_lchmod(self):
-         self.skip_if_symlink_not_supported()
-+        if (sys.version_info >= (3, 10) and self.use_real_fs() and
-+                'chmod' not in os.supports_follow_symlinks):
-+            raise unittest.SkipTest('follow_symlinks not available for chmod')
-         file_stat = self.os.stat(self.file_path)
-         link_stat = self.os.lstat(self.file_link_path)
-         if not hasattr(os, "lchmod"):
-@@ -390,8 +391,9 @@ class FakePathlibFileObjectPropertyTest(RealPathlibTestCase):
-         else:
-             self.path(self.file_link_path).lchmod(0o444)
-             self.assertEqual(file_stat.st_mode, stat.S_IFREG | 0o666)
--            # we get stat.S_IFLNK | 0o755 under MacOs
--            self.assertEqual(link_stat.st_mode, stat.S_IFLNK | 0o444)
-+            # the exact mode depends on OS and Python version
-+            self.assertEqual(link_stat.st_mode & 0o777700,
-+                             stat.S_IFLNK | 0o700)
- 
-     def test_resolve(self):
-         self.create_dir(self.make_path('antoine', 'docs'))
-@@ -968,7 +970,22 @@ class FakePathlibUsageInOsFunctionsTest(RealPathlibTestCase):
-     def test_stat(self):
-         path = self.make_path('foo', 'bar', 'baz')
-         self.create_file(path, contents='1234567')
--        self.assertEqual(self.os.stat(path), self.os.stat(self.path(path)))
-+        self.assertEqual(self.os.stat(path), self.path(path).stat())
-+
-+    @unittest.skipIf(sys.version_info < (3, 10), "New in Python 3.10")
-+    def test_stat_follow_symlinks(self):
-+        self.check_posix_only()
-+        directory = self.make_path('foo')
-+        base_name = 'bar'
-+        file_path = self.path(self.os.path.join(directory, base_name))
-+        link_path = self.path(self.os.path.join(directory, 'link'))
-+        contents = "contents"
-+        self.create_file(file_path, contents=contents)
-+        self.create_symlink(link_path, base_name)
-+        self.assertEqual(len(contents),
-+                         link_path.stat(follow_symlinks=True)[stat.ST_SIZE])
-+        self.assertEqual(len(base_name),
-+                         link_path.stat(follow_symlinks=False)[stat.ST_SIZE])
- 
-     def test_utime(self):
-         path = self.make_path('some_file')
--- 
-2.31.1
-

diff --git a/dev-python/pyfakefs/pyfakefs-4.4.0.ebuild b/dev-python/pyfakefs/pyfakefs-4.4.0.ebuild
deleted file mode 100644
index 5e06b22143d..00000000000
--- a/dev-python/pyfakefs/pyfakefs-4.4.0.ebuild
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7..10} pypy3 )
-DISTUTILS_IN_SOURCE_BUILD=1
-
-inherit distutils-r1
-
-DESCRIPTION="a fake file system that mocks the Python file system modules"
-HOMEPAGE="https://github.com/jmcgeheeiv/pyfakefs/ https://pypi.org/project/pyfakefs/"
-SRC_URI="https://github.com/jmcgeheeiv/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
-
-LICENSE="Apache-2.0"
-SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-macos"
-
-distutils_enable_tests pytest
-
-PATCHES=(
-	"${FILESDIR}"/${P}-py310.patch
-)
-
-python_test() {
-	"${EPYTHON}" -m pyfakefs.tests.all_tests -v || die "tests failed under ${EPYTHON}"
-}


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-12 22:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-12 22:53 [gentoo-commits] repo/gentoo:master commit in: dev-python/pyfakefs/files/, dev-python/pyfakefs/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2021-06-02 16:12 Michał Górny
2018-06-17 11:25 Tim Harder
2018-03-24 13:18 Tim Harder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox