Skip to content

Commit a5954e4

Browse files
Use platformdirs instead of appdirs (#489)
* Use platformdirs instead of appdirs Use the better maintained `platformdirs` instead of `appdirs`. * Add @felixonmars to the list of contributors * Update `CHANGELOG.md` with changes from #489 Co-authored-by: Martin Larralde <[email protected]>
1 parent 863f7e4 commit a5954e4

File tree

6 files changed

+14
-8
lines changed

6 files changed

+14
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88

99
## Unreleased
1010

11+
### Changed
12+
13+
- Replaced `appdirs` with `platformdirs` dependency
14+
([#489](https://github.com/PyFilesystem/pyfilesystem2/pull/489)).
15+
1116

1217
## [2.4.15] - 2022-02-07
1318

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Many thanks to the following developers for contributing to this project:
1414
- [Diego Argueta](https://github.com/dargueta)
1515
- [Eelke van den Bos](https://github.com/eelkevdbos)
1616
- [Egor Namakonov](https://github.com/fresheed)
17+
- [Felix Yan](https://github.com/felixonmars)
1718
- [@FooBarQuaxx](https://github.com/FooBarQuaxx)
1819
- [Geoff Jukes](https://github.com/geoffjukes)
1920
- [George Macon](https://github.com/gmacon)

fs/appfs.py

Lines changed: 3 additions & 3 deletions
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/appdirs
8+
# Thanks to authors of https://pypi.org/project/platformdirs
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 appdirs import AppDirs
19+
from platformdirs import PlatformDirs
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 = AppDirs(appname, author, version, roaming)
81+
self.app_dirs = PlatformDirs(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

Lines changed: 1 addition & 1 deletion
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-
appdirs~=1.4.3
45+
platformdirs~=2.0.2
4646
setuptools
4747
six ~=1.10
4848
enum34 ~=1.1.6 ; python_version < '3.4'

tests/test_appfs.py

Lines changed: 1 addition & 1 deletion
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-
"appdirs.{}".format(self.AppFS.app_dir),
33+
"platformdirs.{}".format(self.AppFS.app_dir),
3434
autospec=True,
3535
spec_set=True,
3636
return_value=tempfile.mkdtemp(dir=self.tmpdir),

tests/test_opener.py

Lines changed: 3 additions & 3 deletions
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("appdirs.{}".format(UserDataFS.app_dir), autospec=True, spec_set=True)
267+
@mock.patch("platformdirs.{}".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("appdirs.{}".format(UserDataFS.app_dir), autospec=True, spec_set=True)
279+
@mock.patch("platformdirs.{}".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("appdirs.{}".format(UserDataFS.app_dir), autospec=True, spec_set=True)
288+
@mock.patch("platformdirs.{}".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)