1 |
commit: e1740d9d85492ec628a2c63242e1eec929da2bd7 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jul 12 22:53:13 2021 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jul 12 22:53:13 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e1740d9d |
7 |
|
8 |
dev-python/pyfakefs: Remove old |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-python/pyfakefs/Manifest | 1 - |
13 |
.../pyfakefs/files/pyfakefs-4.4.0-py310.patch | 265 --------------------- |
14 |
dev-python/pyfakefs/pyfakefs-4.4.0.ebuild | 27 --- |
15 |
3 files changed, 293 deletions(-) |
16 |
|
17 |
diff --git a/dev-python/pyfakefs/Manifest b/dev-python/pyfakefs/Manifest |
18 |
index 0cb16f29f83..8faef02f6a1 100644 |
19 |
--- a/dev-python/pyfakefs/Manifest |
20 |
+++ b/dev-python/pyfakefs/Manifest |
21 |
@@ -1,2 +1 @@ |
22 |
-DIST pyfakefs-4.4.0.tar.gz 196236 BLAKE2B d19fb44320d9c7eab1e97ee4123da548f1e3b2f8f6b0e3be762b6228677fa165ed1b60364481c53f54e79e50a2f98d298e7ff6e65f40aa9c4e372a0f72e19d52 SHA512 774e5e213ee8ce17759cdeaa4ce1d70c43df25f0885c73c7e8aa923973a43f48d9fb19d45105a6a5c5d1c6a0c54c22fe4d80ec3ec92ac7cd97c50fb532af90bc |
23 |
DIST pyfakefs-4.5.0.tar.gz 198107 BLAKE2B ee055ba5e5b53fc91cfb83a29b6fe77f6ea89576c1f3f13e46cd71ddcfe81630f3639000de1ca14bd9a56bcf4a09046fce313f65722327b63098142e5c0030cf SHA512 24a4555b197d089c2a039354f693748415035a587d0194d7d6494b83b507db2dd7e34f748fccb18f151b2673f06ce290fab02f6eb56d2691d5ab72ac12b2b233 |
24 |
|
25 |
diff --git a/dev-python/pyfakefs/files/pyfakefs-4.4.0-py310.patch b/dev-python/pyfakefs/files/pyfakefs-4.4.0-py310.patch |
26 |
deleted file mode 100644 |
27 |
index 6ef35df7d1f..00000000000 |
28 |
--- a/dev-python/pyfakefs/files/pyfakefs-4.4.0-py310.patch |
29 |
+++ /dev/null |
30 |
@@ -1,265 +0,0 @@ |
31 |
-From a8a70bb7746ba24aa60c9915311e1ff5b402146c Mon Sep 17 00:00:00 2001 |
32 |
-From: Carl Montanari <8515611+carlmontanari@××××××××××××××××××××.com> |
33 |
-Date: Thu, 13 May 2021 22:44:45 -0700 |
34 |
-Subject: [PATCH] Add support for Python 3.10 beta1 (#594) |
35 |
- |
36 |
-- add Python 3.10-beta1 to CI |
37 |
-- adapt fake pathlib, fix pathlib.Path methods link_to, getcwd, lchmod |
38 |
-- handle dummy encoding "locale" introduced in Python 3.10 |
39 |
-- do not test extra dependencies with Python 3.10 (some are not available) |
40 |
---- |
41 |
- pyfakefs/fake_filesystem.py | 15 ++++--- |
42 |
- pyfakefs/fake_pathlib.py | 64 ++++++++++++++++++++++------- |
43 |
- pyfakefs/helpers.py | 9 ++++ |
44 |
- pyfakefs/tests/fake_pathlib_test.py | 27 +++++++++--- |
45 |
- 6 files changed, 109 insertions(+), 32 deletions(-) |
46 |
- |
47 |
-diff --git a/pyfakefs/fake_filesystem.py b/pyfakefs/fake_filesystem.py |
48 |
-index 1e9bfc8..971dc93 100644 |
49 |
---- a/pyfakefs/fake_filesystem.py |
50 |
-+++ b/pyfakefs/fake_filesystem.py |
51 |
-@@ -114,7 +114,7 @@ from pyfakefs.fake_scandir import scandir, walk |
52 |
- from pyfakefs.helpers import ( |
53 |
- FakeStatResult, BinaryBufferIO, TextBufferIO, |
54 |
- is_int_type, is_byte_string, is_unicode_string, |
55 |
-- make_string_path, IS_WIN, to_string, matching_string |
56 |
-+ make_string_path, IS_WIN, to_string, matching_string, real_encoding |
57 |
- ) |
58 |
- from pyfakefs import __version__ # noqa: F401 for upwards compatibility |
59 |
- |
60 |
-@@ -293,7 +293,7 @@ class FakeFile: |
61 |
- if st_mode >> 12 == 0: |
62 |
- st_mode |= S_IFREG |
63 |
- self.stat_result.st_mode = st_mode |
64 |
-- self.encoding = encoding |
65 |
-+ self.encoding = real_encoding(encoding) |
66 |
- self.errors = errors or 'strict' |
67 |
- self._byte_contents = self._encode_contents(contents) |
68 |
- self.stat_result.st_size = ( |
69 |
-@@ -430,7 +430,7 @@ class FakeFile: |
70 |
- OSError: if `st_size` is not a non-negative integer, |
71 |
- or if it exceeds the available file system space. |
72 |
- """ |
73 |
-- self.encoding = encoding |
74 |
-+ self.encoding = real_encoding(encoding) |
75 |
- changed = self._set_initial_contents(contents) |
76 |
- if self._side_effect is not None: |
77 |
- self._side_effect(self) |
78 |
-@@ -1177,9 +1177,12 @@ class FakeFilesystem: |
79 |
- OSError: if the filesystem object doesn't exist. |
80 |
- """ |
81 |
- # stat should return the tuple representing return value of os.stat |
82 |
-- file_object = self.resolve( |
83 |
-- entry_path, follow_symlinks, |
84 |
-- allow_fd=True, check_read_perm=False) |
85 |
-+ try: |
86 |
-+ file_object = self.resolve( |
87 |
-+ entry_path, follow_symlinks, |
88 |
-+ allow_fd=True, check_read_perm=False) |
89 |
-+ except TypeError: |
90 |
-+ file_object = self.resolve(entry_path) |
91 |
- if not is_root(): |
92 |
- # make sure stat raises if a parent dir is not readable |
93 |
- parent_dir = file_object.parent_dir |
94 |
-diff --git a/pyfakefs/fake_pathlib.py b/pyfakefs/fake_pathlib.py |
95 |
-index b43b178..09933fa 100644 |
96 |
---- a/pyfakefs/fake_pathlib.py |
97 |
-+++ b/pyfakefs/fake_pathlib.py |
98 |
-@@ -53,8 +53,8 @@ def init_module(filesystem): |
99 |
- |
100 |
- def _wrap_strfunc(strfunc): |
101 |
- @functools.wraps(strfunc) |
102 |
-- def _wrapped(pathobj, *args): |
103 |
-- return strfunc(pathobj.filesystem, str(pathobj), *args) |
104 |
-+ def _wrapped(pathobj, *args, **kwargs): |
105 |
-+ return strfunc(pathobj.filesystem, str(pathobj), *args, **kwargs) |
106 |
- |
107 |
- return staticmethod(_wrapped) |
108 |
- |
109 |
-@@ -94,19 +94,24 @@ class _FakeAccessor(accessor): |
110 |
- |
111 |
- listdir = _wrap_strfunc(FakeFilesystem.listdir) |
112 |
- |
113 |
-- chmod = _wrap_strfunc(FakeFilesystem.chmod) |
114 |
-- |
115 |
- if use_scandir: |
116 |
- scandir = _wrap_strfunc(fake_scandir.scandir) |
117 |
- |
118 |
- if hasattr(os, "lchmod"): |
119 |
- lchmod = _wrap_strfunc(lambda fs, path, mode: FakeFilesystem.chmod( |
120 |
- fs, path, mode, follow_symlinks=False)) |
121 |
-+ chmod = _wrap_strfunc(FakeFilesystem.chmod) |
122 |
- else: |
123 |
-- def lchmod(self, pathobj, mode): |
124 |
-+ def lchmod(self, pathobj, *args, **kwargs): |
125 |
- """Raises not implemented for Windows systems.""" |
126 |
- raise NotImplementedError("lchmod() not available on this system") |
127 |
- |
128 |
-+ def chmod(self, pathobj, *args, **kwargs): |
129 |
-+ if "follow_symlinks" in kwargs and not kwargs["follow_symlinks"]: |
130 |
-+ raise NotImplementedError( |
131 |
-+ "lchmod() not available on this system") |
132 |
-+ return pathobj.filesystem.chmod(str(pathobj), *args, **kwargs) |
133 |
-+ |
134 |
- mkdir = _wrap_strfunc(FakeFilesystem.makedir) |
135 |
- |
136 |
- unlink = _wrap_strfunc(FakeFilesystem.remove) |
137 |
-@@ -124,13 +129,21 @@ class _FakeAccessor(accessor): |
138 |
- FakeFilesystem.create_symlink(fs, file_path, link_target, |
139 |
- create_missing_dirs=False)) |
140 |
- |
141 |
-- if sys.version_info >= (3, 8): |
142 |
-+ if (3, 8) <= sys.version_info < (3, 10): |
143 |
- link_to = _wrap_binary_strfunc( |
144 |
- lambda fs, file_path, link_target: |
145 |
- FakeFilesystem.link(fs, file_path, link_target)) |
146 |
- |
147 |
-- if sys.version_info >= (3, 9): |
148 |
-- readlink = _wrap_strfunc(FakeFilesystem.readlink) |
149 |
-+ if sys.version_info >= (3, 10): |
150 |
-+ link = _wrap_binary_strfunc( |
151 |
-+ lambda fs, file_path, link_target: |
152 |
-+ FakeFilesystem.link(fs, file_path, link_target)) |
153 |
-+ |
154 |
-+ # this will use the fake filesystem because os is patched |
155 |
-+ def getcwd(self): |
156 |
-+ return os.getcwd() |
157 |
-+ |
158 |
-+ readlink = _wrap_strfunc(FakeFilesystem.readlink) |
159 |
- |
160 |
- utime = _wrap_strfunc(FakeFilesystem.utime) |
161 |
- |
162 |
-@@ -461,19 +474,42 @@ class FakePath(pathlib.Path): |
163 |
- cls = (FakePathlibModule.WindowsPath |
164 |
- if cls.filesystem.is_windows_fs |
165 |
- else FakePathlibModule.PosixPath) |
166 |
-- self = cls._from_parts(args, init=True) |
167 |
-+ self = cls._from_parts(args) |
168 |
- return self |
169 |
- |
170 |
-- def _path(self): |
171 |
-- """Returns the underlying path string as used by the fake filesystem. |
172 |
-- """ |
173 |
-- return str(self) |
174 |
-+ @classmethod |
175 |
-+ def _from_parts(cls, args, init=False): # pylint: disable=unused-argument |
176 |
-+ # Overwritten to call _init to set the fake accessor, |
177 |
-+ # which is not done since Python 3.10 |
178 |
-+ self = object.__new__(cls) |
179 |
-+ self._init() |
180 |
-+ drv, root, parts = self._parse_args(args) |
181 |
-+ self._drv = drv |
182 |
-+ self._root = root |
183 |
-+ self._parts = parts |
184 |
-+ return self |
185 |
-+ |
186 |
-+ @classmethod |
187 |
-+ def _from_parsed_parts(cls, drv, root, parts): |
188 |
-+ # Overwritten to call _init to set the fake accessor, |
189 |
-+ # which is not done since Python 3.10 |
190 |
-+ self = object.__new__(cls) |
191 |
-+ self._init() |
192 |
-+ self._drv = drv |
193 |
-+ self._root = root |
194 |
-+ self._parts = parts |
195 |
-+ return self |
196 |
- |
197 |
- def _init(self, template=None): |
198 |
- """Initializer called from base class.""" |
199 |
- self._accessor = _fake_accessor |
200 |
- self._closed = False |
201 |
- |
202 |
-+ def _path(self): |
203 |
-+ """Returns the underlying path string as used by the fake filesystem. |
204 |
-+ """ |
205 |
-+ return str(self) |
206 |
-+ |
207 |
- @classmethod |
208 |
- def cwd(cls): |
209 |
- """Return a new path pointing to the current working directory |
210 |
-@@ -722,7 +758,7 @@ class RealPath(pathlib.Path): |
211 |
- if cls is RealPathlibModule.Path: |
212 |
- cls = (RealPathlibModule.WindowsPath if os.name == 'nt' |
213 |
- else RealPathlibModule.PosixPath) |
214 |
-- self = cls._from_parts(args, init=True) |
215 |
-+ self = cls._from_parts(args) |
216 |
- return self |
217 |
- |
218 |
- |
219 |
-diff --git a/pyfakefs/helpers.py b/pyfakefs/helpers.py |
220 |
-index aa3959d..08962fc 100644 |
221 |
---- a/pyfakefs/helpers.py |
222 |
-+++ b/pyfakefs/helpers.py |
223 |
-@@ -57,6 +57,15 @@ def to_string(path): |
224 |
- return path |
225 |
- |
226 |
- |
227 |
-+def real_encoding(encoding): |
228 |
-+ """Since Python 3.10, the new function ``io.text_encoding`` returns |
229 |
-+ "locale" as the encoding if None is defined. This will be handled |
230 |
-+ as no encoding in pyfakefs.""" |
231 |
-+ if sys.version_info >= (3, 10): |
232 |
-+ return encoding if encoding != "locale" else None |
233 |
-+ return encoding |
234 |
-+ |
235 |
-+ |
236 |
- def matching_string(matched, string): |
237 |
- """Return the string as byte or unicode depending |
238 |
- on the type of matched, assuming string is an ASCII string. |
239 |
-diff --git a/pyfakefs/tests/fake_pathlib_test.py b/pyfakefs/tests/fake_pathlib_test.py |
240 |
-index 5dcc57f..efea509 100644 |
241 |
---- a/pyfakefs/tests/fake_pathlib_test.py |
242 |
-+++ b/pyfakefs/tests/fake_pathlib_test.py |
243 |
-@@ -378,10 +378,11 @@ class FakePathlibFileObjectPropertyTest(RealPathlibTestCase): |
244 |
- # we get stat.S_IFLNK | 0o755 under MacOs |
245 |
- self.assertEqual(link_stat.st_mode, stat.S_IFLNK | 0o777) |
246 |
- |
247 |
-- @unittest.skipIf(sys.platform == 'darwin', |
248 |
-- 'Different behavior under MacOs') |
249 |
- def test_lchmod(self): |
250 |
- self.skip_if_symlink_not_supported() |
251 |
-+ if (sys.version_info >= (3, 10) and self.use_real_fs() and |
252 |
-+ 'chmod' not in os.supports_follow_symlinks): |
253 |
-+ raise unittest.SkipTest('follow_symlinks not available for chmod') |
254 |
- file_stat = self.os.stat(self.file_path) |
255 |
- link_stat = self.os.lstat(self.file_link_path) |
256 |
- if not hasattr(os, "lchmod"): |
257 |
-@@ -390,8 +391,9 @@ class FakePathlibFileObjectPropertyTest(RealPathlibTestCase): |
258 |
- else: |
259 |
- self.path(self.file_link_path).lchmod(0o444) |
260 |
- self.assertEqual(file_stat.st_mode, stat.S_IFREG | 0o666) |
261 |
-- # we get stat.S_IFLNK | 0o755 under MacOs |
262 |
-- self.assertEqual(link_stat.st_mode, stat.S_IFLNK | 0o444) |
263 |
-+ # the exact mode depends on OS and Python version |
264 |
-+ self.assertEqual(link_stat.st_mode & 0o777700, |
265 |
-+ stat.S_IFLNK | 0o700) |
266 |
- |
267 |
- def test_resolve(self): |
268 |
- self.create_dir(self.make_path('antoine', 'docs')) |
269 |
-@@ -968,7 +970,22 @@ class FakePathlibUsageInOsFunctionsTest(RealPathlibTestCase): |
270 |
- def test_stat(self): |
271 |
- path = self.make_path('foo', 'bar', 'baz') |
272 |
- self.create_file(path, contents='1234567') |
273 |
-- self.assertEqual(self.os.stat(path), self.os.stat(self.path(path))) |
274 |
-+ self.assertEqual(self.os.stat(path), self.path(path).stat()) |
275 |
-+ |
276 |
-+ @unittest.skipIf(sys.version_info < (3, 10), "New in Python 3.10") |
277 |
-+ def test_stat_follow_symlinks(self): |
278 |
-+ self.check_posix_only() |
279 |
-+ directory = self.make_path('foo') |
280 |
-+ base_name = 'bar' |
281 |
-+ file_path = self.path(self.os.path.join(directory, base_name)) |
282 |
-+ link_path = self.path(self.os.path.join(directory, 'link')) |
283 |
-+ contents = "contents" |
284 |
-+ self.create_file(file_path, contents=contents) |
285 |
-+ self.create_symlink(link_path, base_name) |
286 |
-+ self.assertEqual(len(contents), |
287 |
-+ link_path.stat(follow_symlinks=True)[stat.ST_SIZE]) |
288 |
-+ self.assertEqual(len(base_name), |
289 |
-+ link_path.stat(follow_symlinks=False)[stat.ST_SIZE]) |
290 |
- |
291 |
- def test_utime(self): |
292 |
- path = self.make_path('some_file') |
293 |
--- |
294 |
-2.31.1 |
295 |
- |
296 |
|
297 |
diff --git a/dev-python/pyfakefs/pyfakefs-4.4.0.ebuild b/dev-python/pyfakefs/pyfakefs-4.4.0.ebuild |
298 |
deleted file mode 100644 |
299 |
index 5e06b22143d..00000000000 |
300 |
--- a/dev-python/pyfakefs/pyfakefs-4.4.0.ebuild |
301 |
+++ /dev/null |
302 |
@@ -1,27 +0,0 @@ |
303 |
-# Copyright 1999-2021 Gentoo Authors |
304 |
-# Distributed under the terms of the GNU General Public License v2 |
305 |
- |
306 |
-EAPI=7 |
307 |
- |
308 |
-PYTHON_COMPAT=( python3_{7..10} pypy3 ) |
309 |
-DISTUTILS_IN_SOURCE_BUILD=1 |
310 |
- |
311 |
-inherit distutils-r1 |
312 |
- |
313 |
-DESCRIPTION="a fake file system that mocks the Python file system modules" |
314 |
-HOMEPAGE="https://github.com/jmcgeheeiv/pyfakefs/ https://pypi.org/project/pyfakefs/" |
315 |
-SRC_URI="https://github.com/jmcgeheeiv/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" |
316 |
- |
317 |
-LICENSE="Apache-2.0" |
318 |
-SLOT="0" |
319 |
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-macos" |
320 |
- |
321 |
-distutils_enable_tests pytest |
322 |
- |
323 |
-PATCHES=( |
324 |
- "${FILESDIR}"/${P}-py310.patch |
325 |
-) |
326 |
- |
327 |
-python_test() { |
328 |
- "${EPYTHON}" -m pyfakefs.tests.all_tests -v || die "tests failed under ${EPYTHON}" |
329 |
-} |