Skip to content

Commit

Permalink
Freeze locations' Scheme dataclass
Browse files Browse the repository at this point in the history
  • Loading branch information
ichard26 committed Apr 8, 2024
1 parent 39af6fe commit 3738d25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/pip/_internal/locations/_sysconfig.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import dataclasses
import logging
import os
import sys
Expand Down Expand Up @@ -192,9 +193,10 @@ def get_scheme(
data=paths["data"],
)
if root is not None:
converted_keys = {}
for key in SCHEME_KEYS:
value = change_root(root, getattr(scheme, key))
setattr(scheme, key, value)
converted_keys[key] = change_root(root, getattr(scheme, key))
scheme = dataclasses.replace(scheme, **converted_keys)
return scheme


Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/models/scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
SCHEME_KEYS = ["platlib", "purelib", "headers", "scripts", "data"]


@dataclass
@dataclass(frozen=True)
class Scheme:
"""A Scheme holds paths which are used as the base directories for
artifacts associated with a Python package.
Expand Down

0 comments on commit 3738d25

Please sign in to comment.