-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use config.py
as a module in depends.py
#6493
Changes from 1 commit
3f93012
3b0215d
576803f
81cf5ad
72082dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ | |
import subprocess | ||
import sys | ||
import traceback | ||
|
||
# Add the Mbed TLS Python library directory to the module search path | ||
import scripts_path # pylint: disable=unused-import | ||
import config | ||
|
||
|
@@ -140,22 +140,22 @@ def option_exists(conf, option): | |
return False | ||
return True | ||
|
||
def set_config_option(conf, option, colors, value=None): | ||
"""Set configuration option, optionally specifying a value""" | ||
def set_config_option_value(conf, option, colors, value): | ||
"""Set/unset a configuration option, optionally specifying a value""" | ||
if not option_exists(conf, option): | ||
log_line('Symbol {} was not found in {}'.format(option, conf.filename), color=colors.red) | ||
return False | ||
log_command(['config.py', 'set', option]) | ||
conf.set(option, value) | ||
return True | ||
|
||
def unset_config_option(conf, option, colors): | ||
"""Unset configuration option if it exists""" | ||
if not option_exists(conf, option): | ||
log_line('Symbol {} was not found in {}'.format(option, conf.filename), color=colors.red) | ||
return False | ||
log_command(['config.py', 'unset', option]) | ||
conf.unset(option) | ||
if value is False: | ||
log_command(['config.py', 'unset', option]) | ||
conf.unset(option) | ||
else: | ||
if value is True: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume that Then we would have: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to distinguish It would help to convey this through type annotations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added as a new commit. |
||
log_command(['config.py', 'set', option]) | ||
conf.set(option) | ||
else: | ||
log_command(['config.py', 'set', option, value]) | ||
conf.set(option, value) | ||
AndrzejKurek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return True | ||
|
||
def set_reference_config(conf, options, colors): | ||
|
@@ -165,9 +165,9 @@ def set_reference_config(conf, options, colors): | |
# Turn off options that are not relevant to the tests and slow them down. | ||
log_command(['config.py', 'full']) | ||
conf.adapt(config.full_adapter) | ||
unset_config_option(conf, 'MBEDTLS_TEST_HOOKS', colors) | ||
set_config_option_value(conf, 'MBEDTLS_TEST_HOOKS', colors, False) | ||
if options.unset_use_psa: | ||
unset_config_option(conf, 'MBEDTLS_USE_PSA_CRYPTO', colors) | ||
set_config_option_value(conf, 'MBEDTLS_USE_PSA_CRYPTO', colors, False) | ||
|
||
class Job: | ||
"""A job builds the library in a specific configuration and runs some tests.""" | ||
|
@@ -201,13 +201,7 @@ def configure(self, conf, options, colors): | |
'''Set library configuration options as required for the job.''' | ||
set_reference_config(conf, options, colors) | ||
for key, value in sorted(self.config_settings.items()): | ||
ret = False | ||
if value is True: | ||
ret = set_config_option(conf, key, colors) | ||
elif value is False: | ||
ret = unset_config_option(conf, key, colors) | ||
else: | ||
ret = set_config_option(conf, key, colors, value) | ||
ret = set_config_option_value(conf, key, colors, value) | ||
if ret is False: | ||
return False | ||
return True | ||
|
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)