Skip to content

Commit fd0dc85

Browse files
authored
Change PyInfo cache versioning mechanism (#2827)
1 parent 56ef466 commit fd0dc85

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

src/virtualenv/app_data/via_disk_folder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def extract(self, path, to_folder):
7979

8080
@property
8181
def py_info_at(self):
82-
return self.lock / "py_info" / "1"
82+
return self.lock / "py_info" / "2"
8383

8484
def py_info(self, path):
8585
return PyInfoStoreDisk(self.py_info_at, path)

src/virtualenv/discovery/cached_py_info.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
_CACHE = OrderedDict()
2525
_CACHE[Path(sys.executable)] = PythonInfo()
2626
LOGGER = logging.getLogger(__name__)
27-
_CACHE_FILE_VERSION = 1
2827

2928

3029
def from_exe(cls, app_data, exe, env=None, raise_on_error=True, ignore_cache=False): # noqa: FBT002, PLR0913
@@ -65,13 +64,8 @@ def _get_via_file_cache(cls, app_data, path, exe, env):
6564
with py_info_store.locked():
6665
if py_info_store.exists(): # if exists and matches load
6766
data = py_info_store.read()
68-
of_path, of_st_mtime, of_content, version = (
69-
data["path"],
70-
data["st_mtime"],
71-
data["content"],
72-
data.get("version"),
73-
)
74-
if of_path == path_text and of_st_mtime == path_modified and version == _CACHE_FILE_VERSION:
67+
of_path, of_st_mtime, of_content = data["path"], data["st_mtime"], data["content"]
68+
if of_path == path_text and of_st_mtime == path_modified:
7569
py_info = cls._from_dict(of_content.copy())
7670
sys_exe = py_info.system_executable
7771
if sys_exe is not None and not os.path.exists(sys_exe):
@@ -86,7 +80,6 @@ def _get_via_file_cache(cls, app_data, path, exe, env):
8680
"st_mtime": path_modified,
8781
"path": path_text,
8882
"content": py_info._to_dict(), # noqa: SLF001
89-
"version": _CACHE_FILE_VERSION,
9083
}
9184
py_info_store.write(data)
9285
else:

0 commit comments

Comments
 (0)