Skip to content

Commit

Permalink
Revert switch from appdirs to platformdirs for backward compatibi…
Browse files Browse the repository at this point in the history
…lity
  • Loading branch information
althonos committed May 2, 2022
1 parent 62d2def commit 2b3b0b0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Replaced `appdirs` with `platformdirs` dependency
([#489](https://github.com/PyFilesystem/pyfilesystem2/pull/489)).
- Make `fs.zipfs._ZipExtFile` use the seeking mechanism implemented
in the Python standard library in Python version 3.7 and later
([#527](https://github.com/PyFilesystem/pyfilesystem2/pull/527)).
Expand Down
6 changes: 3 additions & 3 deletions fs/appfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
subclasses of `~fs.osfs.OSFS`.
"""
# Thanks to authors of https://pypi.org/project/platformdirs
# Thanks to authors of https://pypi.org/project/appdirs

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

Expand All @@ -16,7 +16,7 @@

from .osfs import OSFS
from ._repr import make_repr
from platformdirs import PlatformDirs
from appdirs import AppDirs

if typing.TYPE_CHECKING:
from typing import Optional, Text
Expand Down Expand Up @@ -78,7 +78,7 @@ def __init__(
will be created if it does not exist.
"""
self.app_dirs = PlatformDirs(appname, author, version, roaming)
self.app_dirs = AppDirs(appname, author, version, roaming)
self._create = create
super(_AppFS, self).__init__(
getattr(self.app_dirs, self.app_dir), create=create
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ packages = find:
setup_requires =
setuptools >=38.3.0
install_requires =
platformdirs~=2.0.2
appdirs~=1.4.3
setuptools
six ~=1.10
enum34 ~=1.1.6 ; python_version < '3.4'
Expand Down
2 changes: 1 addition & 1 deletion tests/test_appfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def tearDownClass(cls):

def make_fs(self):
with mock.patch(
"platformdirs.{}".format(self.AppFS.app_dir),
"appdirs.{}".format(self.AppFS.app_dir),
autospec=True,
spec_set=True,
return_value=tempfile.mkdtemp(dir=self.tmpdir),
Expand Down
6 changes: 3 additions & 3 deletions tests/test_opener.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def test_open_fs(self):
mem_fs_2 = opener.open_fs(mem_fs)
self.assertEqual(mem_fs, mem_fs_2)

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

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

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

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

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

Expand Down

0 comments on commit 2b3b0b0

Please sign in to comment.