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

Commit 43bd41b

Browse files
author
William McLendon
committed
Merge branch 'revert-0a03e354' into 'master'
Revert "Merge branch 'TRILFRAME-120' into 'master'" See merge request trilinos-devops-consolidation/code/SetProgramOptions!18
2 parents 0a03e35 + f556638 commit 43bd41b

File tree

4 files changed

+7
-72
lines changed

4 files changed

+7
-72
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4444
#### Deprecated
4545
#### Removed
4646
#### Fixed
47-
- Bash generation handling of the FORCE flag. See TRILFRAME-120 for details.
4847
#### Security
4948
#### Internal
5049
- Add test to verify that `opt-remove` also works to remove variables added
@@ -92,3 +91,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9291
#### Added
9392
- Initial version release. From now on changes should be noted in the
9493
CHANGELOG.
94+
95+

src/setprogramoptions/SetProgramOptionsCMake.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
``-DVAR_NAME:BOOL=ON`` using the ``SetProgramOptions`` method ``gen_option_list``
2121
with the ``bash`` generator.
2222
23-
In the case of bash command entries the ``PARENT_SCOPE`` optional parameter is
24-
ignored.
23+
In the case of bash command entries the ``FORCE`` and ``PARENT_SCOPE`` optional
24+
parameters are ignored.
2525
2626
See CMake documentation on the `set() <https://cmake.org/cmake/help/latest/command/set.html>`_
2727
command for more information on how fragment file entries are generated.
@@ -213,13 +213,6 @@ def _program_option_handler_opt_set_cmake_var_bash(self, params, value) -> str:
213213
params.append(":" + param_opts['TYPE'])
214214

215215
# Cache 'known' CMake vars here.
216-
try:
217-
if self._var_formatter_cache[varname] is not None and not param_opts['FORCE']:
218-
# Do not add this to the output unless it's a forceful set
219-
return None
220-
except:
221-
pass
222-
223216
self._var_formatter_cache[varname] = value
224217

225218
return self._generic_program_option_handler_bash(params, value)

src/setprogramoptions/unittests/files_ini/config_test_setprogramoptions.ini

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,15 @@ opt-set-cmake-var CMAKE_CXX_FLAGS STRING : "${LDFLAGS|ENV} -foo"
143143
[TEST_VAR_EXPANSION_UPDATE_01]
144144
opt-set cmake
145145
use TEST_VAR_EXPANSION_COMMON
146-
opt-set-cmake-var CMAKE_CXX_FLAGS STRING FORCE : "${CMAKE_CXX_FLAGS|CMAKE} -bar"
146+
opt-set-cmake-var CMAKE_CXX_FLAGS STRING: "${CMAKE_CXX_FLAGS|CMAKE} -bar"
147147

148148
[TEST_VAR_EXPANSION_UPDATE_02]
149149
use TEST_VAR_EXPANSION_UPDATE_01
150150
opt-set-cmake-var CMAKE_F90_FLAGS STRING: "${CMAKE_F90_FLAGS|CMAKE} -baz"
151151

152152
[TEST_VAR_EXPANSION_UPDATE_03]
153153
use TEST_VAR_EXPANSION_UPDATE_01
154-
opt-set-cmake-var CMAKE_CXX_FLAGS STRING FORCE : "${CMAKE_CXX_FLAGS|CMAKE} -bif"
155-
156-
[TEST_VAR_EXPANSION_UPDATE_04]
157-
opt-set cmake
158-
use TEST_VAR_EXPANSION_COMMON
159-
# Test (return None) at SetProgramOptionsCMake.py:_program_option_handler_opt_set_cmake_var_bash:188
160-
opt-set-cmake-var CMAKE_CXX_FLAGS STRING : "${LDFLAGS|ENV} -foobar"
154+
opt-set-cmake-var CMAKE_CXX_FLAGS STRING: "${CMAKE_CXX_FLAGS|CMAKE} -bif"
161155

162156

163157
[TEST_STRING_DOUBLE_QUOTES]

src/setprogramoptions/unittests/test_SetProgramOptionsCMake.py

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -219,27 +219,6 @@ def test_SetProgramOptionsCMake_gen_option_list_bash_expandvars(self):
219219
option_list_actual = parser.gen_option_list(section, generator="bash")
220220
pprint(option_list_actual, width=200)
221221

222-
self.assertListEqual(option_list_expect, option_list_actual)
223-
print("-----[ TEST END ]------------------------------------------")
224-
print("OK")
225-
226-
print("-----[ TEST BEGIN ]----------------------------------------")
227-
section = "TEST_VAR_EXPANSION_UPDATE_04"
228-
print("Section : {}".format(section))
229-
230-
self._execute_parser(parser, section)
231-
232-
print("-" * 40)
233-
print("Option List")
234-
print("-" * 40)
235-
option_list_expect = [
236-
'cmake',
237-
'-DCMAKE_CXX_FLAGS:STRING="${LDFLAGS} -foo"',
238-
]
239-
240-
option_list_actual = parser.gen_option_list(section, generator="bash")
241-
pprint(option_list_actual, width=200)
242-
243222
self.assertListEqual(option_list_expect, option_list_actual)
244223
print("-----[ TEST END ]------------------------------------------")
245224
print("OK")
@@ -359,7 +338,7 @@ def test_SetProgramOptionsCMake_gen_option_list_cmake_fragment_expandvars(self):
359338

360339
option_list_expect = [
361340
'set(CMAKE_CXX_FLAGS "$ENV{LDFLAGS} -foo" CACHE STRING "from .ini configuration")',
362-
'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -bar" CACHE STRING "from .ini configuration" FORCE)',
341+
'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -bar" CACHE STRING "from .ini configuration")',
363342
'set(CMAKE_F90_FLAGS "${CMAKE_F90_FLAGS} -baz" CACHE STRING "from .ini configuration")'
364343
]
365344

@@ -371,40 +350,8 @@ def test_SetProgramOptionsCMake_gen_option_list_cmake_fragment_expandvars(self):
371350
self.assertListEqual(option_list_expect, option_list_actual)
372351

373352
print("-----[ TEST END ]------------------------------------------")
374-
print("OK")
375353

376-
# The following TEST_VAR_EXPANSION_UPDATE_04 does not increase coverage
377-
# but is here to illustrate the correctness issue reported in
378-
# TRILFRAME-120. To compare the option_list_expect below to that
379-
# of the option_list_expect for the bash generator, see the
380-
# TEST_VAR_EXPANSION_UPDATE_04 test above in
381-
# test_SetProgramOptionsCMake_gen_option_list_bash_expandvars.
382-
print("-----[ TEST BEGIN ]----------------------------------------")
383-
section = "TEST_VAR_EXPANSION_UPDATE_04"
384-
print("Section : {}".format(section))
385-
386-
# parse a section
387-
self._execute_parser(parser, section)
388-
389-
parser.gen_option_list(section, generator="cmake_fragment")
390-
391-
option_list_expect = [
392-
# Only the first set with "-foo" sticks in the cmake cache.
393-
# If the second set with "-foobar" used FORCE, it would stick.
394-
'set(CMAKE_CXX_FLAGS "$ENV{LDFLAGS} -foo" CACHE STRING "from .ini configuration")',
395-
'set(CMAKE_CXX_FLAGS "$ENV{LDFLAGS} -foobar" CACHE STRING "from .ini configuration")',
396-
]
397-
398-
option_list_actual = parser.gen_option_list(section, generator="cmake_fragment")
399-
400-
print("Expected Output:\n{}\n".format("\n".join(option_list_expect)))
401-
print("Actual Output:\n{}\n".format("\n".join(option_list_actual)))
402-
403-
self.assertListEqual(option_list_expect, option_list_actual)
404-
405-
print("-----[ TEST END ]------------------------------------------")
406354
print("OK")
407-
408355
return 0
409356

410357
def test_SetProgramOptionsCMake_param_order_01(self):

0 commit comments

Comments
 (0)