Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 9febf3a

Browse files
author
William McLendon
committed
Update version to v0.4.0
1 parent 9cb2155 commit 9febf3a

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
#### Todo (for Unreleased)
1818
-->
1919

20-
## [0.4.0] <!-- YYYY-MM-DD --> [Unreleased]
20+
## [0.4.0] 2021-11-23
2121
#### Added
2222
#### Changed
2323
- Changes to `opt-set-cmake-var` behaviour:
@@ -33,10 +33,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3333
- **bash** generated options that have a TYPE and `PARENT_SCOPE` are processed
3434
to generate the same _list_ string that would be generated by the matching
3535
`set()` operation (with the warning). (TRILFRAME-128)
36-
- For **bash** generation, trigger a WARNING and DO NOT generate the `-D` CLI option
37-
if `opt-set-cmake-var` without `FORCE` is called on a CMake Cache variable that has
36+
- For **bash** generation, trigger a WARNING and DO NOT generate the `-D` CLI option
37+
if `opt-set-cmake-var` without `FORCE` is called on a CMake Cache variable that has
3838
already been set. (TRILFRAME-120).
39-
- For **bash** generation, trigger a WARNING and DO NOT generate the `-D` CLI option
39+
- For **bash** generation, trigger a WARNING and DO NOT generate the `-D` CLI option
4040
if `opt-set-cmake-var` is called on a non-cache CMake variable. (TRILFRAME-136)
4141
- For **bash** generation, always add a _TYPE_ to the `-D` CLI option. (TRILFRAME-136)
4242
- Revert(ish) the modifications from MR12 which removed the error when generating

SetProgramOptions.wpr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ proj.launch-config = {loc('../../coding/pyExampleLib/configparser/configparser-e
9090
'ustom',
9191
(u'',
9292
'launch-5Gyw4cvA0PytPLLy'))}
93-
proj.main-file = loc('exec-example-SetProgramOptions.py')
93+
proj.main-file = loc('examples/example-01.py')
9494
testing.auto-test-file-specs = (('regex',
95-
'unittests\\\\test_.*\\.py'),)
95+
'src\\\\unittests\\\\test_.*\\.py'),)
9696
testing.test-framework = {None: ':internal pytest'}

src/setprogramoptions/SetProgramOptionsCMake.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#from textwrap import dedent
5555

5656
# For type-hinting
57-
from typing import List, Set, Dict, Tuple, Optional, Iterable
57+
# from typing import List, Set, Dict, Tuple, Optional, Iterable
5858

5959
try: # pragma: no cover
6060
# @final decorator, requires Python 3.8.x
@@ -67,6 +67,7 @@
6767
import shlex
6868

6969
from configparserenhanced import *
70+
from configparserenhanced import TypedProperty
7071

7172
from .SetProgramOptions import SetProgramOptions
7273
from .SetProgramOptions import ExpandVarsInText
@@ -80,12 +81,20 @@
8081
# ===============================
8182

8283

83-
8484
class ExpandVarsInTextCMake(ExpandVarsInText):
8585
"""
8686
Extends ``ExpandVarsInText`` class to add in support for a ``CMAKE`` generator.
8787
"""
8888

89+
# Typed Property `_bashgen_unhandled_cmake_var_eventtype`:
90+
# sets the exception_control_event level for when an unresolved
91+
# `CMake` var is encountered by the BASH generator.
92+
_bashgen_unhandled_cmake_var_eventtype = \
93+
TypedProperty.typed_property("_bashgen_unhandled_cmake_var_eventtype",
94+
expected_type=str,
95+
default="MINOR",
96+
internal_type=str)
97+
8998
def __init__(self):
9099
self.exception_control_level = 3
91100

@@ -112,9 +121,10 @@ def _fieldhandler_BASH_CMAKE(self, field):
112121
else:
113122
# If self.exception_control_level is >= 4 then we'll raise the error
114123
# instead of sending a warning.
115-
msg = f"Unhandled variable expansion for `{field.varname}` in a BASH file."
124+
# Change this to `CATASTROPHIC` to always throw the error.
125+
msg = f"Unresolved variable expansion for `{field.varname}` in a BASH file."
116126
msg += " CMake variables are only valid in a CMake fragment file."
117-
self.exception_control_event("MINOR", ValueError, msg)
127+
self.exception_control_event(self._bashgen_unhandled_cmake_var_eventtype, ValueError, msg)
118128
output = ""
119129
return output
120130

@@ -331,7 +341,7 @@ def handler_initialize(self, section_name: str, handler_parameters) -> int:
331341
# ---------------------------------------------------------------
332342

333343
@ConfigParserEnhanced.operation_handler
334-
def _handler_opt_set_cmake_var(self, section_name, handler_parameters) -> int:
344+
def _handler_opt_set_cmake_var(self, section_name: str, handler_parameters) -> int:
335345
"""Handler for ``opt-set-cmake-var``
336346
337347
Called By: ``configparserenhanced.ConfigParserEnhanced`` parser.

0 commit comments

Comments
 (0)