Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of box suppor for nuitka #68

Merged
merged 4 commits into from Feb 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Expand Up @@ -12,7 +12,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
rev: v2.31.0
hooks:
- id: pyupgrade
args: [ "--py36-plus" ]
Expand All @@ -21,21 +21,21 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 21.12b0
rev: 22.1.0
hooks:
- id: black
args: [ --safe ]
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.0
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [ black==21.12b0 ]
additional_dependencies: [ black==22.1.0 ]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: rst-backticks
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "0.5.1"
rev: "0.5.2"
hooks:
- id: tox-ini-fmt
args: [ "-p", "fix" ]
Expand All @@ -49,8 +49,8 @@ repos:
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==21.11.29
- flake8-comprehensions==3.7
- flake8-bugbear==22.1.11
- flake8-comprehensions==3.8
- flake8-pytest-style==1.6
- flake8-spellcheck==0.24
- flake8-unused-arguments==0.0.9
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.rst
@@ -1,6 +1,10 @@
platformdirs Changelog
======================

platformdirs 2.5.1
------------------
- Add native support for nuitka

platformdirs 2.5.0
------------------
- Add support for Termux subsystems
Expand Down
14 changes: 7 additions & 7 deletions src/platformdirs/__init__.py
Expand Up @@ -4,7 +4,6 @@
"""
from __future__ import annotations

import importlib
import os
import sys
from pathlib import Path
Expand All @@ -19,20 +18,21 @@

def _set_platform_dir_class() -> type[PlatformDirsABC]:
if sys.platform == "win32":
module, name = "platformdirs.windows", "Windows"
from platformdirs.windows import Windows as Result
elif sys.platform == "darwin":
module, name = "platformdirs.macos", "MacOS"
from platformdirs.macos import MacOS as Result
else:
module, name = "platformdirs.unix", "Unix"
from platformdirs.unix import Unix as Result

if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system":
from platformdirs.android import _android_folder

if _android_folder() is not None:
module, name = "platformdirs.android", "Android"
from platformdirs.android import Android

result: type[PlatformDirsABC] = getattr(importlib.import_module(module), name)
return result
return Android # return to avoid redefinition of result

return Result


PlatformDirs = _set_platform_dir_class() #: Currently active platform
Expand Down
4 changes: 1 addition & 3 deletions tox.ini
Expand Up @@ -39,7 +39,6 @@ description = run static analysis and style check using flake8
passenv =
HOMEPATH
PROGRAMDATA
basepython = python3.9
skip_install = true
deps =
pre-commit>=2
Expand All @@ -51,7 +50,7 @@ description = run type check on code base
setenv =
{tty:MYPY_FORCE_COLOR = 1}
deps =
mypy==0.930
mypy==0.931
commands =
mypy --strict src
mypy --strict tests
Expand Down Expand Up @@ -97,7 +96,6 @@ commands =

[testenv:dev]
description = generate a DEV environment
basepython = python3.9
usedevelop = true
extras =
test
Expand Down
1 change: 1 addition & 0 deletions whitelist.txt
Expand Up @@ -19,6 +19,7 @@ isfunction
jnius
kernel32
lru
macos
multipath
normpath
ord
Expand Down