Skip to content

Commit

Permalink
Ensure UTF-8 when querying site, simplify layer config
Browse files Browse the repository at this point in the history
  • Loading branch information
ncoghlan committed Nov 5, 2024
1 parent 1acc15b commit d995f3c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/venvstacks/stacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,9 +1083,7 @@ def from_relative_path(relative_build_path: Path) -> str:
)

def _write_deployed_config(self) -> None:
# Subclasses call this when they have enough info to
# populate it correctly (on creation for base runtime
# environments, when linked for layered environments)
# This is written as part of creating/updating the build environments
config_path = self.env_path / postinstall.DEPLOYED_LAYER_CONFIG
print(f"Generating {config_path!r}...")
config_path.parent.mkdir(parents=True, exist_ok=True)
Expand Down Expand Up @@ -1131,6 +1129,7 @@ def _create_environment(
create_env = False
if create_env:
self._create_new_environment(lock_only=lock_only)
self._write_deployed_config()
self.was_created = create_env
self.was_built = create_env or env_updated

Expand All @@ -1143,6 +1142,8 @@ def report_python_site_details(self) -> subprocess.CompletedProcess[str]:
print(f"Reporting environment details for {str(self.env_path)!r}")
command = [
str(self.python_path),
"-X",
"utf8",
"-Im",
"site",
]
Expand Down Expand Up @@ -1447,8 +1448,6 @@ def _create_new_environment(self, *, lock_only: bool = False) -> None:
# and we don't want to ship it unless explicitly requested to do so
# as a declared dependency of an included component
self._remove_pip()
# No layer linking details needed for base runtime environments
self._write_deployed_config()
fs_sync()
if not lock_only:
print(
Expand Down Expand Up @@ -1528,9 +1527,6 @@ def _ensure_virtual_environment(self) -> subprocess.CompletedProcess[str]:
return result

def _link_build_environment(self) -> None:
# Linking the build environments indicates all the required
# deployment config settings have been populated
self._write_deployed_config()
# Create sitecustomize file for the build environment
sc_contents = postinstall.generate_sitecustomize(
self.linked_pylib_paths, self.linked_dynlib_paths
Expand Down

0 comments on commit d995f3c

Please sign in to comment.