Skip to content

Commit 73e00ef

Browse files
Out of box suppor for nuitka (#68)
Co-authored-by: Clouder <[email protected]>
1 parent 7f47751 commit 73e00ef

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
- id: end-of-file-fixer
1313
- id: trailing-whitespace
1414
- repo: https://github.com/asottile/pyupgrade
15-
rev: v2.29.1
15+
rev: v2.31.0
1616
hooks:
1717
- id: pyupgrade
1818
args: [ "--py36-plus" ]
@@ -21,21 +21,21 @@ repos:
2121
hooks:
2222
- id: isort
2323
- repo: https://github.com/psf/black
24-
rev: 21.12b0
24+
rev: 22.1.0
2525
hooks:
2626
- id: black
2727
args: [ --safe ]
2828
- repo: https://github.com/asottile/blacken-docs
29-
rev: v1.12.0
29+
rev: v1.12.1
3030
hooks:
3131
- id: blacken-docs
32-
additional_dependencies: [ black==21.12b0 ]
32+
additional_dependencies: [ black==22.1.0 ]
3333
- repo: https://github.com/pre-commit/pygrep-hooks
3434
rev: v1.9.0
3535
hooks:
3636
- id: rst-backticks
3737
- repo: https://github.com/tox-dev/tox-ini-fmt
38-
rev: "0.5.1"
38+
rev: "0.5.2"
3939
hooks:
4040
- id: tox-ini-fmt
4141
args: [ "-p", "fix" ]
@@ -49,8 +49,8 @@ repos:
4949
hooks:
5050
- id: flake8
5151
additional_dependencies:
52-
- flake8-bugbear==21.11.29
53-
- flake8-comprehensions==3.7
52+
- flake8-bugbear==22.1.11
53+
- flake8-comprehensions==3.8
5454
- flake8-pytest-style==1.6
5555
- flake8-spellcheck==0.24
5656
- flake8-unused-arguments==0.0.9

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
platformdirs Changelog
22
======================
33

4+
platformdirs 2.5.1
5+
------------------
6+
- Add native support for nuitka
7+
48
platformdirs 2.5.0
59
------------------
610
- Add support for Termux subsystems

src/platformdirs/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"""
55
from __future__ import annotations
66

7-
import importlib
87
import os
98
import sys
109
from pathlib import Path
@@ -19,20 +18,21 @@
1918

2019
def _set_platform_dir_class() -> type[PlatformDirsABC]:
2120
if sys.platform == "win32":
22-
module, name = "platformdirs.windows", "Windows"
21+
from platformdirs.windows import Windows as Result
2322
elif sys.platform == "darwin":
24-
module, name = "platformdirs.macos", "MacOS"
23+
from platformdirs.macos import MacOS as Result
2524
else:
26-
module, name = "platformdirs.unix", "Unix"
25+
from platformdirs.unix import Unix as Result
2726

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

3130
if _android_folder() is not None:
32-
module, name = "platformdirs.android", "Android"
31+
from platformdirs.android import Android
3332

34-
result: type[PlatformDirsABC] = getattr(importlib.import_module(module), name)
35-
return result
33+
return Android # return to avoid redefinition of result
34+
35+
return Result
3636

3737

3838
PlatformDirs = _set_platform_dir_class() #: Currently active platform

tox.ini

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ description = run static analysis and style check using flake8
3939
passenv =
4040
HOMEPATH
4141
PROGRAMDATA
42-
basepython = python3.9
4342
skip_install = true
4443
deps =
4544
pre-commit>=2
@@ -51,7 +50,7 @@ description = run type check on code base
5150
setenv =
5251
{tty:MYPY_FORCE_COLOR = 1}
5352
deps =
54-
mypy==0.930
53+
mypy==0.931
5554
commands =
5655
mypy --strict src
5756
mypy --strict tests
@@ -97,7 +96,6 @@ commands =
9796

9897
[testenv:dev]
9998
description = generate a DEV environment
100-
basepython = python3.9
10199
usedevelop = true
102100
extras =
103101
test

whitelist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ isfunction
1919
jnius
2020
kernel32
2121
lru
22+
macos
2223
multipath
2324
normpath
2425
ord

0 commit comments

Comments
 (0)