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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add xsdata version in the cli cache key #990

Merged
merged 1 commit into from Mar 22, 2024
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
5 changes: 4 additions & 1 deletion tests/codegen/test_transformer.py
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
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")