Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 717
fix: fixes to prepare for making bootstrap=script the default for Linux#2760
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
91d107258661bfd167516dd7c44773217ed36db9b2e35edb8625c00daf45bc64ed910d57cbd0fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -209,3 +209,33 @@ _current_config = rule( | ||
| "_template": attr.string(default = _DEBUG_ENV_MESSAGE_TEMPLATE), | ||
| }, | ||
| ) | ||
| def is_python_version_at_least(name, **kwargs): | ||
| flag_name = "_{}_flag".format(name) | ||
| native.config_setting( | ||
| name = name, | ||
| flag_values = { | ||
| flag_name: "yes", | ||
| }, | ||
| ) | ||
| _python_version_at_least( | ||
| name = flag_name, | ||
| visibility = ["//visibility:private"], | ||
| **kwargs | ||
| ) | ||
| def _python_version_at_least_impl(ctx): | ||
| at_least = tuple(ctx.attr.at_least.split(".")) | ||
| current = tuple( | ||
| ctx.attr._major_minor[config_common.FeatureFlagInfo].value.split("."), | ||
| ) | ||
| value = "yes" if current >= at_least else "no" | ||
Collaborator 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. LGTM on using | ||
| return [config_common.FeatureFlagInfo(value = value)] | ||
| _python_version_at_least = rule( | ||
| implementation = _python_version_at_least_impl, | ||
| attrs = { | ||
| "at_least": attr.string(mandatory = True), | ||
| "_major_minor": attr.label(default = _PYTHON_VERSION_MAJOR_MINOR_FLAG), | ||
| }, | ||
| ) | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
This version matching is a little bit brittle. Might be better to use
evaluatefrompep508_evaluatewhere we use"python_version >= {}".format(ctx.attr.at_least)for the marker and then evaluate by passing in theenv.I think it is fine for now to have your implementation, but at some point it may be nicer to use the standard evaluation.