Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
thirtytwobits authored Feb 28, 2022
2 parents 8761532 + c747288 commit 30798c9
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
needs: test
strategy:
matrix:
python3-version: ['5', '6', '7', '8']
python3-version: ['6', '7', '8', '9', '10']
steps:
- uses: actions/checkout@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Partial example: generating a C struct
*
* Auto-generated, do not edit.
*
* Source file: {{T.source_file_path}}
* Source file: {{T.source_file_path | replace("\\", "\\\\")}}
*/
#ifndef {{T.full_name | ln.c.macrofy}}
Expand Down
2 changes: 1 addition & 1 deletion docs/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ given a template ``common_header.j2``::
*
* Auto-generated, do not edit.
*
* Source file: {{T.source_file_path}}
* Source file: {{T.source_file_path | replace("\\", "\\\\")}}
* Generated at: {{now_utc}}
* Template: {{ self._TemplateReference__context.name }}
* deprecated: {{T.deprecated}}
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ classifiers =
License :: OSI Approved :: MIT License
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3 :: Only
Topic :: Scientific/Engineering
Topic :: Software Development :: Embedded Systems
Expand All @@ -42,7 +42,7 @@ install_requires=

zip_safe = False

python_requires = >=3.5
python_requires = >=3.6

[options.entry_points]
console_scripts =
Expand Down
8 changes: 7 additions & 1 deletion src/nunavut/jinja/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,13 @@ def get_templates(self) -> typing.Iterable[pathlib.Path]:
files.add(template)
if self._package_loader is not None and self._templates_package_name is not None:
templates_module = importlib.import_module(self._templates_package_name)
templates_base_path = pathlib.Path(templates_module.__file__).parent
spec_perhaps = templates_module.__spec__
file_perhaps = None # type: typing.Optional[str]
if spec_perhaps is not None:
file_perhaps = spec_perhaps.origin
if file_perhaps is None or file_perhaps == "builtin":
raise RuntimeError("Unknown template package origin?")
templates_base_path = pathlib.Path(file_perhaps).parent
for t in self._package_loader.list_templates():
files.add(templates_base_path / pathlib.Path(t))
return sorted(files)
Expand Down
4 changes: 2 additions & 2 deletions src/nunavut/lang/c/templates/base.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// are named with an underscore at the end, like foo_bar_().
//
// Generator: nunavut-{{ nunavut.version }} (serialization was {{ 'not ' * nunavut.support.omit }}enabled)
// Source file: {{ T.source_file_path }}
// Source file: {{ T.source_file_path | replace("\\", "\\\\") }}
// Generated at: {{ now_utc }} UTC
// Is deprecated: {{ T.deprecated and 'yes' or 'no' }}
// Fixed port-ID: {{ T.fixed_port_id }}
Expand Down Expand Up @@ -54,7 +54,7 @@
{% endfor %}
{% for key, value in options.items() -%}
static_assert( {{ "NUNAVUT_SUPPORT_LANGUAGE_OPTION_{}".format(key) | ln.c.macrofy }} == {{ value | to_static_assertion_value }},
"{{ T.source_file_path }} is trying to use a serialization library that was compiled with "
"{{ T.source_file_path | replace("\\", "\\\\") }} is trying to use a serialization library that was compiled with "
"different language options. This is dangerous and therefore not allowed." );
{% endfor %}
#ifdef __cplusplus
Expand Down
4 changes: 2 additions & 2 deletions src/nunavut/lang/cpp/templates/base.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// build invocation. TODO: add --reproducible option to prevent any volatile metadata from being generated.
//
// Generator: nunavut-{{ nunavut.version }} (serialization was {{ 'not ' * nunavut.support.omit }}enabled)
// Source file: {{ T.source_file_path }}
// Source file: {{ T.source_file_path | replace("\\", "\\\\") }}
// Generated at: {{ now_utc }} UTC
// Is deprecated: {{ T.deprecated and 'yes' or 'no' }}
// Fixed port-ID: {{ T.fixed_port_id }}
Expand Down Expand Up @@ -73,7 +73,7 @@
// +-------------------------------------------------------------------------------------------------------------------+
{% endif -%}
static_assert( nunavut::support::options::{{ key | id }} == {{ value | ln.c.to_static_assertion_value }},
"{{ T.source_file_path }} "
"{{ T.source_file_path | replace("\\", "\\\\") }} "
"is trying to use a serialization library that was compiled with "
"different language options. This is dangerous and therefore not "
"allowed." );
Expand Down
2 changes: 1 addition & 1 deletion src/nunavut/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.. autodata:: __version__
"""

__version__ = "1.6.2" #: The version number used in the release of nunavut to pypi.
__version__ = "1.7.3" #: The version number used in the release of nunavut to pypi.


__license__ = "MIT"
2 changes: 1 addition & 1 deletion test/gentest_json/templates/StructureType.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"name": "{{ T.short_name }}",
"type": "{{ T | typename }}",
"source" : "{{ T.source_file_path }}",
"source" : "{{ T.source_file_path | replace("\\", "\\\\") }}",
"fixed_port_id": {{ T.fixed_port_id }},
"deprecated": {{ T.deprecated | ln.js.to_true_or_false }},
"version":
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#
# We test nunavut using python 3.5 - 3.9.
# We test nunavut using python 3.6 - 3.9.
#
# The standard version to develop against is 3.9. We limit mypy checking
# to 3.9 since typing is still a bit fluid accross versions.
#
[tox]
envlist = {py35,py36,py37,py38,py39}-{test,nnvg,doctest,rstdoctest},lint,report,docs
envlist = {py36,py37,py38,py39,py310}-{test,nnvg,doctest,rstdoctest},lint,report,docs


[base]
deps =
Sybil >= 2.0.1
pytest >= 5.4.3
Sybil >= 3.0.0
pytest >= 5.4.3, < 7.0.0
pytest-timeout
coverage
types-PyYAML
Expand Down

0 comments on commit 30798c9

Please sign in to comment.