Skip to content

Commit 4413607

Browse files
authored
Merge pull request #848 from OZI-Project/main
Release
2 parents 15cb8d9 + aaf6f27 commit 4413607

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

ozi_core/fix/rewrite_command.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ def _add_dunder_init(self: Rewriter, filename: str) -> None:
119119
/ '__init__.py',
120120
find_user_template(
121121
self.target,
122-
filename,
123-
self.fix,
122+
f'{filename}/__init__.py.j2',
123+
'.',
124124
),
125125
)
126126

@@ -138,7 +138,9 @@ def _add_files(
138138
self.env,
139139
self.fix,
140140
child,
141-
user_template=find_user_template(self.target, filename, self.fix),
141+
user_template=find_user_template(
142+
self.target, filename, self.path_map[self.fix]('.').name
143+
),
142144
)
143145
if filename.endswith('.pyx'): # pragma: no cover
144146
cmd_files.add('ext', 'files', str(Path(filename)))

ozi_core/render.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def find_user_template(target: str, file: str, fix: str) -> str | None:
4747
"""
4848
fp = Path(target, 'templates', fix, file)
4949
if fp.exists():
50-
user_template = str(fp.relative_to(Path(target)))
50+
user_template = str(fp.relative_to(Path(target))) # pragma: defer to E2E
5151
else:
5252
TAP.ok(_('term-tap-user-template-not-found'), skip=True, template=str(fp))
5353
user_template = None
@@ -172,7 +172,7 @@ def build_child(env: Environment, parent: str, child: Path) -> None:
172172
env,
173173
'child',
174174
(child / 'meson.build'),
175-
find_user_template(str(parent / child), 'meson.build.j2', 'child'),
175+
find_user_template(str(parent / child), 'meson.build.j2', '.'),
176176
parent=parent,
177177
)
178178

@@ -239,7 +239,7 @@ def render_ci_files_set_user(env: Environment, target: Path, ci_provider: str) -
239239
except (InvalidGitRepositoryError, configparser.NoSectionError) as e: # pragma: no cover
240240
ci_user = ''
241241
logger.debug(str(e))
242-
TAP.not_ok('ci_user was not set', skip=True)
242+
TAP.ok('ci_user was not set', skip=True)
243243

244244
match ci_provider:
245245
case 'github':
@@ -248,7 +248,11 @@ def render_ci_files_set_user(env: Environment, target: Path, ci_provider: str) -
248248
env,
249249
'github_workflows',
250250
target / filename.replace('github_workflows', '.github/workflows'),
251-
find_user_template(str(target), str(filename), 'github_workflows'),
251+
find_user_template(
252+
str(target),
253+
str(filename).replace('github_workflows', '.github/workflows'),
254+
'.',
255+
),
252256
)
253257
case _: # pragma: no cover
254258
ci_user = ''
@@ -281,5 +285,5 @@ def render_project_files(env: Environment, target: Path, name: str) -> None:
281285
env,
282286
fix,
283287
target / filename,
284-
find_user_template(str(target), filename, fix),
288+
find_user_template(str(target), filename, '.'),
285289
)

0 commit comments

Comments
 (0)