Skip to content

Commit c2dace9

Browse files
committed
chore: use global binary location
1 parent 4943c7f commit c2dace9

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords = ["cli", "tailwind", "css", "daisyui"]
66
authors = [
77
{ name = "2mal3", email = "56305732+2mal3@users.noreply.github.com" },
88
]
9-
dependencies = ["niquests==3.*", "tqdm==4.*"]
9+
dependencies = ["niquests==3.*", "tqdm==4.*", "platformdirs==4.*"]
1010
readme = "README.md"
1111
license = "LGPL-3.0"
1212
requires-python = ">= 3.8"

pytailwindcss_extra/main.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from time import time
1010
from typing import Generator
1111
from datetime import datetime, timedelta
12+
from platformdirs import user_data_dir
1213

1314
import niquests
1415
from tqdm import tqdm
@@ -22,18 +23,13 @@
2223

2324

2425
def main() -> int:
25-
temp_bin_dir_path = environ.get("PYTAILWINDCSS_EXTRA_BIN_DIR")
26-
if not temp_bin_dir_path:
27-
bin_dir_path: Path = Path(__file__).parent.resolve() / "bin"
28-
else:
29-
bin_dir_path = Path(temp_bin_dir_path)
26+
bin_dir_path = Path(user_data_dir("pytailwindcss-extra")) / "bin"
3027

3128
version = get_version(environ.get("PYTAILWINDCSS_EXTRA_VERSION", "major"))
3229

3330
bin_path = bin_dir_path / f"tailwindcss-extra-{version.replace('.', '-')}"
3431
if not bin_path.exists():
35-
if not bin_dir_path.exists():
36-
bin_dir_path.mkdir(parents=True)
32+
bin_dir_path.mkdir(parents=True, exist_ok=True)
3733
install(bin_path, version)
3834
# TODO: remove old versions
3935

@@ -46,7 +42,7 @@ def get_version(specifier: str) -> str:
4642
if specifier not in ["latest", "major"]:
4743
return specifier
4844

49-
cache_file_path = Path(gettempdir()) / f"tailwindcss-extra-cache.json"
45+
cache_file_path = Path(gettempdir()) / "tailwindcss-extra-cache.json"
5046
cached_version = get_cached_version(specifier, cache_file_path)
5147
if cached_version:
5248
return cached_version

requirements-dev.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ niquests==3.14.0
2222
# via pytailwindcss-extra
2323
packaging==24.2
2424
# via pytest
25+
platformdirs==4.3.7
26+
# via pytailwindcss-extra
2527
pluggy==1.5.0
2628
# via pytest
2729
pytest==8.3.5

requirements.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jh2==5.0.8
1818
# via urllib3-future
1919
niquests==3.14.0
2020
# via pytailwindcss-extra
21+
platformdirs==4.3.7
22+
# via pytailwindcss-extra
2123
qh3==1.4.4
2224
# via urllib3-future
2325
tqdm==4.67.1

0 commit comments

Comments
 (0)