Skip to content

Commit

Permalink
Update os.py (#175)
Browse files Browse the repository at this point in the history
* Update os.py

Check if os provides link

* Add a changelog entry  - os.link check
  • Loading branch information
Deshdeepak1 committed Aug 17, 2023
1 parent 1456aa9 commit 3f7638b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -167,6 +167,8 @@ async def test_stuff():

#### 23.2.2 (UNRELEASED)

- Import `os.link` conditionally to fix importing on android.
[#175](https://github.com/Tinche/aiofiles/issues/175)
- Remove spurious items from `aiofiles.os.__all__` when running on Windows.

#### 23.2.1 (2023-08-09)
Expand Down
6 changes: 4 additions & 2 deletions src/aiofiles/os.py
Expand Up @@ -16,14 +16,15 @@
"makedirs",
"rmdir",
"removedirs",
"link",
"symlink",
"readlink",
"listdir",
"scandir",
"access",
"wrap",
]
if hasattr(os, "link"):
__all__ += ["link"]
if hasattr(os, "sendfile"):
__all__ += ["sendfile"]
if hasattr(os, "statvfs"):
Expand All @@ -40,13 +41,14 @@
makedirs = wrap(os.makedirs)
rmdir = wrap(os.rmdir)
removedirs = wrap(os.removedirs)
link = wrap(os.link)
symlink = wrap(os.symlink)
readlink = wrap(os.readlink)
listdir = wrap(os.listdir)
scandir = wrap(os.scandir)
access = wrap(os.access)

if hasattr(os, "link"):
link = wrap(os.link)
if hasattr(os, "sendfile"):
sendfile = wrap(os.sendfile)
if hasattr(os, "statvfs"):
Expand Down

0 comments on commit 3f7638b

Please sign in to comment.