Skip to content

Commit 49608b6

Browse files
ctruedenclaude
andcommitted
Fix wrap() to use scheme_from_name instead of scheme_from_content
PixiBuilder.wrap() and UvBuilder.wrap() were calling scheme_from_content() with a filename string (e.g. "pixi.toml") instead of file content. Since RequirementsTxtScheme.supports_content() matches any bare word, this caused every wrapped environment's scheme to be misdetected as "requirements.txt". The bug was latent before, but was exposed by the early scheme validation added in the previous content-validation commit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4d3d34a commit 49608b6

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/appose/builder/pixi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from . import BaseBuilder, BuildException, Builder, BuilderFactory
1414
from ..environment import Environment
15-
from ..scheme import from_content as scheme_from_content
15+
from ..scheme import from_content as scheme_from_content, from_name as scheme_from_name
1616
from ..tool.pixi import Pixi
1717

1818

@@ -250,15 +250,15 @@ def wrap(self, env_dir: str | Path) -> Environment:
250250
# Read the content so rebuild() will work even after directory is deleted
251251
with open(pixi_toml, "r", encoding="utf-8") as f:
252252
self._content = f.read()
253-
self._scheme = scheme_from_content("pixi.toml")
253+
self._scheme = scheme_from_name("pixi.toml")
254254
else:
255255
# Check for pyproject.toml
256256
pyproject_toml = env_path / "pyproject.toml"
257257
if pyproject_toml.exists() and pyproject_toml.is_file():
258258
# Read the content so rebuild() will work even after directory is deleted
259259
with open(pyproject_toml, "r", encoding="utf-8") as f:
260260
self._content = f.read()
261-
self._scheme = scheme_from_content("pyproject.toml")
261+
self._scheme = scheme_from_name("pyproject.toml")
262262

263263
# Set the base directory and build (which will detect existing env)
264264
self.base(env_path)

src/appose/builder/uv.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from . import BaseBuilder, BuildException, Builder, BuilderFactory
1414
from ..environment import Environment
15-
from ..scheme import from_content as scheme_from_content
15+
from ..scheme import from_content as scheme_from_content, from_name as scheme_from_name
1616
from ..tool.uv import Uv
1717
from ..util.platform import is_windows
1818

@@ -195,15 +195,15 @@ def wrap(self, env_dir: str | Path) -> Environment:
195195
# Read the content so rebuild() will work even after directory is deleted
196196
with open(pyproject_toml, "r", encoding="utf-8") as f:
197197
self._content = f.read()
198-
self._scheme = scheme_from_content("pyproject.toml")
198+
self._scheme = scheme_from_name("pyproject.toml")
199199
else:
200200
# Fall back to requirements.txt
201201
requirements_txt = env_path / "requirements.txt"
202202
if requirements_txt.exists() and requirements_txt.is_file():
203203
# Read the content so rebuild() will work even after directory is deleted
204204
with open(requirements_txt, "r", encoding="utf-8") as f:
205205
self._content = f.read()
206-
self._scheme = scheme_from_content("requirements.txt")
206+
self._scheme = scheme_from_name("requirements.txt")
207207

208208
# Set the base directory and build (which will detect existing env)
209209
self.base(env_path)

0 commit comments

Comments
 (0)