-
Notifications
You must be signed in to change notification settings - Fork 216
add support both $VAR and ${VAR} variable formats in modextravars
#5049
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
base: develop
Are you sure you want to change the base?
Conversation
|
|
||
| def wrap_shell_vars(strng, wrap_prefix, wrap_suffix): | ||
| """ | ||
| Wrap variables $VAR or ${VAR} in wrap_tmpl template string |
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.
There's no such thing as wrap_tmpl?
| return mods | ||
|
|
||
|
|
||
| def wrap_shell_vars(strng, wrap_prefix, wrap_suffix): |
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.
Let's add a dedicated unit test for this new function, along with the end-to-end tests you've already added?
| # shell environment variable name: ${__}VAR_NAME_00_SUFFIX | ||
| REGEX_SHELL_VAR_PATTERN = r'[A-Z_]+[A-Z0-9_]+' | ||
| REGEX_SHELL_VAR = re.compile(rf'\$({REGEX_SHELL_VAR_PATTERN})') | ||
| REGEX_QUOTE_SHELL_VAR = re.compile(rf'[\"\']\$({REGEX_SHELL_VAR_PATTERN})[\"\']') |
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.
Strictly speaking this is part of the API, so we shouldn't just remove these constants, people may be using them (in hooks for example)
| LOAD_TEMPLATE_DEPENDS_ON = 'depends_on("%(mod_name)s")' | ||
| IS_LOADED_TEMPLATE = 'isloaded("%s")' | ||
|
|
||
| OS_GETENV_TEMPLATE = r'os.getenv("%s")' |
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.
Same here, this is part of the API, we shouldn't just remove this...
$VAR and ${VAR} variable formats in modextravars
$VAR and ${VAR} variable formats in modextravars$VAR and ${VAR} variable formats in modextravars
$VAR and ${VAR} variable formats in modextravars$VAR and ${VAR} variable formats in modextravars
No description provided.