Skip to content

Commit

Permalink
Merge pull request #15 from lsst-sqre/tickets/DM-33981
Browse files Browse the repository at this point in the history
[DM-33981] Fix imports of Scons symbols, error reporting
  • Loading branch information
rra authored Mar 15, 2022
2 parents bf044ff + 28bb8ab commit 95efa20
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Change log
##########

0.5.1 (2022-03-15)
==================

- Fix an incorrect import in the SCons builder.
- Fix reporting of SCons status in ``templatekit check``.

0.5.0 (2022-03-15)
==================

Expand Down
21 changes: 11 additions & 10 deletions src/templatekit/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

from cookiecutter.find import find_template
from cookiecutter.main import cookiecutter
from SCons.Script import Builder, Environment, Node
from SCons.Node import Node
from SCons.Script import Builder, Environment

from .filerender import render_and_write_file_template
from .textutils import reformat_content_lines
Expand All @@ -40,11 +41,11 @@ def build_file_template(
Parameters
----------
target : `list` of `Scons.Script.Node`
target : `list` of `SCons.Node.Node`
A list of Node objects corresponding to examples to be built.
source : `list` of `Scons.Script.Node`
source : `list` of `SCons.Node.Node`
A list of Node objects corresponding to file templates.
env : `Scons.Script.Environment`
env : `SCons.Script.Environment`
The construction environment used for building the target.
"""
target_path = str(target[0])
Expand Down Expand Up @@ -75,12 +76,12 @@ def build_project_template(
Parameters
----------
target : `list` of `Scons.Script.Node`
target : `list` of `SCons.Node.Node`
A list of Node objects corresponding to examples to be built.
source : `list` of `Scons.Script.Node`
source : `list` of `SCons.Node.Node`
A list of Node objects containing only the ``cookiecutter.json`` file
node.
env : `Scons.Script.Environment`
env : `SCons.Script.Environment`
The construction environment used for building the target. The
following construction environment variables are used:
Expand Down Expand Up @@ -149,11 +150,11 @@ def format_content(
Parameters
----------
target : `list` of `Scons.Script.Node`
target : `list` of `SCons.Node.Node`
A list of Node objects corresponding to examples to be built.
source : `list` of `Scons.Script.Node`
source : `list` of `SCons.Node.Node`
A list of Node objects corresponding to file templates.
env : `Scons.Script.Environment`
env : `SCons.Script.Environment`
The construction environment used for building the target.
"""
target_path = str(target[0])
Expand Down
2 changes: 1 addition & 1 deletion src/templatekit/scripts/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def check(state: Dict[str, Repo]) -> None:
scons_result = repo.build()
if scons_result.returncode > 0:
message = (
'"scons" failed with status {0!d}\n\nThis means that the examples '
'"scons" failed with status {0:d}\n\nThis means that the examples '
"could not be successfully generated because of an issue with the "
"Cookiecutter templates. Check the scons output, above, for "
"debugging hints."
Expand Down
2 changes: 1 addition & 1 deletion tests/data/templates
Submodule templates updated 434 files
4 changes: 2 additions & 2 deletions tests/test_base_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_validation(templates_repo: str) -> None:
"path,expected",
[
("file_templates/license_gplv3", "license_gplv3"),
("project_templates/example_project", "example_project"),
("project_templates/fastapi_safir_app", "fastapi_safir_app"),
],
)
def test_name(templates_repo: str, path: str, expected: str) -> None:
Expand All @@ -50,7 +50,7 @@ def test_name(templates_repo: str, path: str, expected: str) -> None:
"path",
[
"file_templates/license_gplv3",
"project_templates/example_project",
"project_templates/fastapi_safir_app",
],
)
def test_cookiecutter_json_path(templates_repo: str, path: str) -> None:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def test_getitem(templates_repo: str) -> None:
assert isinstance(copyright_template, FileTemplate)
assert copyright_template.name == "copyright"

example_project_template = repo["example_project"]
example_project_template = repo["fastapi_safir_app"]
assert isinstance(example_project_template, ProjectTemplate)
assert example_project_template.name == "example_project"
assert example_project_template.name == "fastapi_safir_app"


def test_contains(templates_repo: str) -> None:
Expand All @@ -100,5 +100,5 @@ def test_contains(templates_repo: str) -> None:
repo = Repo(".")

assert "copyright" in repo
assert "example_project" in repo
assert "fastapi_safir_app" in repo
assert "whatwhat" not in repo

0 comments on commit 95efa20

Please sign in to comment.