Skip to content

Commit 2b3b0b0

Browse files
committed
Revert switch from appdirs to platformdirs for backward compatibility
1 parent 62d2def commit 2b3b0b0

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

CHANGELOG.md

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010

1111
### Changed
1212

13-
- Replaced `appdirs` with `platformdirs` dependency
14-
([#489](https://github.com/PyFilesystem/pyfilesystem2/pull/489)).
1513
- Make `fs.zipfs._ZipExtFile` use the seeking mechanism implemented
1614
in the Python standard library in Python version 3.7 and later
1715
([#527](https://github.com/PyFilesystem/pyfilesystem2/pull/527)).

fs/appfs.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
subclasses of `~fs.osfs.OSFS`.
66
77
"""
8-
# Thanks to authors of https://pypi.org/project/platformdirs
8+
# Thanks to authors of https://pypi.org/project/appdirs
99

1010
# see http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx
1111

@@ -16,7 +16,7 @@
1616

1717
from .osfs import OSFS
1818
from ._repr import make_repr
19-
from platformdirs import PlatformDirs
19+
from appdirs import AppDirs
2020

2121
if typing.TYPE_CHECKING:
2222
from typing import Optional, Text
@@ -78,7 +78,7 @@ def __init__(
7878
will be created if it does not exist.
7979
8080
"""
81-
self.app_dirs = PlatformDirs(appname, author, version, roaming)
81+
self.app_dirs = AppDirs(appname, author, version, roaming)
8282
self._create = create
8383
super(_AppFS, self).__init__(
8484
getattr(self.app_dirs, self.app_dir), create=create

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ packages = find:
4242
setup_requires =
4343
setuptools >=38.3.0
4444
install_requires =
45-
platformdirs~=2.0.2
45+
appdirs~=1.4.3
4646
setuptools
4747
six ~=1.10
4848
enum34 ~=1.1.6 ; python_version < '3.4'

tests/test_appfs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def tearDownClass(cls):
3030

3131
def make_fs(self):
3232
with mock.patch(
33-
"platformdirs.{}".format(self.AppFS.app_dir),
33+
"appdirs.{}".format(self.AppFS.app_dir),
3434
autospec=True,
3535
spec_set=True,
3636
return_value=tempfile.mkdtemp(dir=self.tmpdir),

tests/test_opener.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def test_open_fs(self):
264264
mem_fs_2 = opener.open_fs(mem_fs)
265265
self.assertEqual(mem_fs, mem_fs_2)
266266

267-
@mock.patch("platformdirs.{}".format(UserDataFS.app_dir), autospec=True, spec_set=True)
267+
@mock.patch("appdirs.{}".format(UserDataFS.app_dir), autospec=True, spec_set=True)
268268
def test_open_userdata(self, app_dir):
269269
app_dir.return_value = self.tmpdir
270270

@@ -276,7 +276,7 @@ def test_open_userdata(self, app_dir):
276276
self.assertEqual(app_fs.app_dirs.appauthor, "willmcgugan")
277277
self.assertEqual(app_fs.app_dirs.version, "1.0")
278278

279-
@mock.patch("platformdirs.{}".format(UserDataFS.app_dir), autospec=True, spec_set=True)
279+
@mock.patch("appdirs.{}".format(UserDataFS.app_dir), autospec=True, spec_set=True)
280280
def test_open_userdata_no_version(self, app_dir):
281281
app_dir.return_value = self.tmpdir
282282

@@ -285,7 +285,7 @@ def test_open_userdata_no_version(self, app_dir):
285285
self.assertEqual(app_fs.app_dirs.appauthor, "willmcgugan")
286286
self.assertEqual(app_fs.app_dirs.version, None)
287287

288-
@mock.patch("platformdirs.{}".format(UserDataFS.app_dir), autospec=True, spec_set=True)
288+
@mock.patch("appdirs.{}".format(UserDataFS.app_dir), autospec=True, spec_set=True)
289289
def test_user_data_opener(self, app_dir):
290290
app_dir.return_value = self.tmpdir
291291

0 commit comments

Comments
 (0)