Skip to content

Commit

Permalink
Migrate from appdirs to platformdirs
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiX committed Oct 26, 2023
1 parent f1a6130 commit a6acbc9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
6 changes: 3 additions & 3 deletions software/glasgow/target/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import shutil
import logging
import hashlib
import appdirs
import platformdirs
import pathlib
from amaranth import *
from amaranth.build import ResourceError
Expand Down Expand Up @@ -153,8 +153,8 @@ def execute(self, build_dir=None, *, debug=False):
return bitstream

def get_bitstream(self, *, debug=False):
cache_path = appdirs.user_cache_dir("GlasgowEmbedded", appauthor=False)
cache_filename = pathlib.Path(cache_path) / "bitstreams" / self.bitstream_id.hex()
cache_path = platformdirs.user_cache_path("GlasgowEmbedded", appauthor=False)
cache_filename = cache_path / "bitstreams" / self.bitstream_id.hex()
cache_exists = False
if cache_filename.exists():
with cache_filename.open("rb") as cache_file:
Expand Down
12 changes: 11 additions & 1 deletion software/pdm.min.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
groups = ["default", "builtin-toolchain", "http"]
strategy = ["cross_platform", "direct_minimal_versions"]
lock_version = "4.4"
content_hash = "sha256:d424d8501f58db7a76e39083ce4f514dfbad48d09441e736c60393017ebfe3b2"
content_hash = "sha256:efaec2704d878a92d27f52b4d3c61adb858093f3322d6d4455c4cc652ac25350"

[[package]]
name = "aiohttp"
Expand Down Expand Up @@ -456,6 +456,16 @@ files = [
{file = "packaging-23.0.tar.gz", hash = "sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97"},
]

[[package]]
name = "platformdirs"
version = "3.0.0"
requires_python = ">=3.7"
summary = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
files = [
{file = "platformdirs-3.0.0-py3-none-any.whl", hash = "sha256:b1d5eb14f221506f50d6604a561f4c5786d9e80355219694a1b244bcd96f4567"},
{file = "platformdirs-3.0.0.tar.gz", hash = "sha256:8a1228abb1ef82d788f74139988b137e78692984ec7b08eaa6c65f1723af28f9"},
]

[[package]]
name = "pyvcd"
version = "0.2.3"
Expand Down
4 changes: 2 additions & 2 deletions software/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ dependencies = [
# `packaging` is used in the plugin system, `support.plugin`. It uses CalVer: the major version
# is the two last digits of the year and the minor version is the release within that year.
"packaging>=23.0",
# `appdirs` is used in the bitstream builder to use platform-appropriate cache directories.
# `platformdirs` is used in the bitstream builder to use platform-appropriate cache directories.
# It uses SemVer.
"appdirs>=1.4.2,<2",
"platformdirs>=3.0.0,<4",
# `fx2` is effectively maintained together with Glasgow. It uses SemVer, and keeps backward
# compatibility within the 0.x release series.
"fx2>=0.11,<1",
Expand Down

0 comments on commit a6acbc9

Please sign in to comment.