Skip to content

Commit

Permalink
feat: Add xsdata version in the cli cache key (#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
tefra authored Mar 22, 2024
1 parent e5a81d0 commit 27c62e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tests/codegen/test_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from toposort import CircularDependencyError

from xsdata import __version__
from xsdata.codegen.container import ClassContainer
from xsdata.codegen.exceptions import CodegenError
from xsdata.codegen.mappers import (
Expand Down Expand Up @@ -483,6 +484,8 @@ def test_get_cache_file(self):
uris = ["a.xml", "b.json"]
actual = self.transformer.get_cache_file(uris)
tempdir = Path(tempfile.gettempdir())
expected = tempdir.joinpath("ae1bed744d3d3611e698a2d2ef5335d2.cache")
expected = tempdir.joinpath(
f"xsdata.{__version__}.ae1bed744d3d3611e698a2d2ef5335d2.cache"
)

self.assertEqual(expected, actual)
3 changes: 2 additions & 1 deletion xsdata/codegen/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from toposort import CircularDependencyError

from xsdata import __version__
from xsdata.codegen import opener
from xsdata.codegen.container import ClassContainer
from xsdata.codegen.exceptions import CodegenError
Expand Down Expand Up @@ -445,4 +446,4 @@ def get_cache_file(cls, uris: List[str]) -> Path:
"""
key = hashlib.md5("".join(uris).encode()).hexdigest()
tempdir = tempfile.gettempdir()
return Path(tempdir).joinpath(f"{key}.cache")
return Path(tempdir).joinpath(f"xsdata.{__version__}.{key}.cache")

0 comments on commit 27c62e6

Please sign in to comment.