| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7d431d8 commit 24b9c51
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,7 +72,6 @@ bzl_library( | |||
| 72 | 72 | ":py_internal_bzl", | |
| 73 | 73 | ":reexports_bzl", | |
| 74 | 74 | ":rules_cc_srcs_bzl", | |
| 75 | - ":semantics_bzl", | ||
| 76 | 75 | "@bazel_skylib//rules:common_settings", | |
| 77 | 76 | ], | |
| 78 | 77 | ) | |
@@ -131,7 +130,6 @@ bzl_library( | |||
| 131 | 130 | ":py_internal_bzl", | |
| 132 | 131 | ":reexports_bzl", | |
| 133 | 132 | ":rules_cc_srcs_bzl", | |
| 134 | - ":semantics_bzl", | ||
| 135 | 133 | "@bazel_skylib//lib:paths", | |
| 136 | 134 | ], | |
| 137 | 135 | ) | |
@@ -302,7 +300,6 @@ bzl_library( | |||
| 302 | 300 | ":attributes_bzl", | |
| 303 | 301 | ":py_executable_bzl", | |
| 304 | 302 | ":rule_builders_bzl", | |
| 305 | - ":semantics_bzl", | ||
| 306 | 303 | "@bazel_skylib//lib:dicts", | |
| 307 | 304 | ], | |
| 308 | 305 | ) | |
@@ -537,7 +534,6 @@ bzl_library( | |||
| 537 | 534 | ":common_bzl", | |
| 538 | 535 | ":py_executable_bzl", | |
| 539 | 536 | ":rule_builders_bzl", | |
| 540 | - ":semantics_bzl", | ||
| 541 | 537 | "@bazel_skylib//lib:dicts", | |
| 542 | 538 | ], | |
| 543 | 539 | ) | |
@@ -677,11 +673,6 @@ bzl_library( | |||
| 677 | 673 | ], | |
| 678 | 674 | ) | |
| 679 | 675 | ||
| 680 | - bzl_library( | ||
| 681 | - name = "semantics_bzl", | ||
| 682 | - srcs = ["semantics.bzl"], | ||
| 683 | - ) | ||
| 684 | - | ||
| 685 | 676 | # Needed to define bzl_library targets for docgen. (We don't define the | |
| 686 | 677 | # bzl_library target here because it'd give our users a transitive dependency | |
| 687 | 678 | # on Skylib.) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,11 +23,6 @@ load(":py_info.bzl", "PyInfo") | |||
| 23 | 23 | load(":py_internal.bzl", "py_internal") | |
| 24 | 24 | load(":reexports.bzl", "BuiltinPyInfo") | |
| 25 | 25 | load(":rule_builders.bzl", "ruleb") | |
| 26 | - load( | ||
| 27 | - ":semantics.bzl", | ||
| 28 | - "DEPS_ATTR_ALLOW_RULES", | ||
| 29 | - "SRCS_ATTR_ALLOW_FILES", | ||
| 30 | - ) | ||
| 31 | 26 | ||
| 32 | 27 | _PackageSpecificationInfo = getattr(py_internal, "PackageSpecificationInfo", None) | |
| 33 | 28 | ||
@@ -250,9 +245,6 @@ PY_SRCS_ATTRS = dicts.add( | |||
| 250 | 245 | [PyInfo], | |
| 251 | 246 | [CcInfo], | |
| 252 | 247 | ] + _MaybeBuiltinPyInfo, | |
| 253 | - # TODO(b/228692666): Google-specific; remove these allowances once | ||
| 254 | - # the depot is cleaned up. | ||
| 255 | - allow_rules = DEPS_ATTR_ALLOW_RULES, | ||
| 256 | 248 | doc = """ | |
| 257 | 249 | List of additional libraries to be linked in to the target. | |
| 258 | 250 | See comments about | |
@@ -359,8 +351,7 @@ as part of a runnable program (packaging rules may include them, however). | |||
| 359 | 351 | allow_files = True, | |
| 360 | 352 | ), | |
| 361 | 353 | "srcs": lambda: attrb.LabelList( | |
| 362 | - # Google builds change the set of allowed files. | ||
| 363 | - allow_files = SRCS_ATTR_ALLOW_FILES, | ||
| 354 | + allow_files = [".py", ".py3"], | ||
| 364 | 355 | # Necessary for --compile_one_dependency to work. | |
| 365 | 356 | flags = ["DIRECT_COMPILE_TIME_INPUT"], | |
| 366 | 357 | doc = """ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -59,13 +59,6 @@ load(":py_internal.bzl", "py_internal") | |||
| 59 | 59 | load(":py_runtime_info.bzl", "DEFAULT_STUB_SHEBANG", "PyRuntimeInfo") | |
| 60 | 60 | load(":reexports.bzl", "BuiltinPyInfo", "BuiltinPyRuntimeInfo") | |
| 61 | 61 | load(":rule_builders.bzl", "ruleb") | |
| 62 | - load( | ||
| 63 | - ":semantics.bzl", | ||
| 64 | - "ALLOWED_MAIN_EXTENSIONS", | ||
| 65 | - "BUILD_DATA_SYMLINK_PATH", | ||
| 66 | - "IS_BAZEL", | ||
| 67 | - "PY_RUNTIME_ATTR_NAME", | ||
| 68 | - ) | ||
| 69 | 62 | load( | |
| 70 | 63 | ":toolchain_types.bzl", | |
| 71 | 64 | "EXEC_TOOLS_TOOLCHAIN_TYPE", | |
@@ -1116,19 +1109,12 @@ def _get_runtime_details(ctx, semantics): | |||
| 1116 | 1109 | # | |
| 1117 | 1110 | # TOOD(bazelbuild/bazel#7901): Remove this once --python_path flag is removed. | |
| 1118 | 1111 | ||
| 1119 | - if IS_BAZEL: | ||
| 1120 | - flag_interpreter_path = ctx.fragments.bazel_py.python_path | ||
| 1121 | - toolchain_runtime, effective_runtime = _maybe_get_runtime_from_ctx(ctx) | ||
| 1122 | - if not effective_runtime: | ||
| 1123 | - # Clear these just in case | ||
| 1124 | - toolchain_runtime = None | ||
| 1125 | - effective_runtime = None | ||
| 1126 | - | ||
| 1127 | - else: # Google code path | ||
| 1128 | - flag_interpreter_path = None | ||
| 1129 | - toolchain_runtime, effective_runtime = _maybe_get_runtime_from_ctx(ctx) | ||
| 1130 | - if not effective_runtime: | ||
| 1131 | - fail("Unable to find Python runtime") | ||
| 1112 | + flag_interpreter_path = ctx.fragments.bazel_py.python_path | ||
| 1113 | + toolchain_runtime, effective_runtime = _maybe_get_runtime_from_ctx(ctx) | ||
| 1114 | + if not effective_runtime: | ||
| 1115 | + # Clear these just in case | ||
| 1116 | + toolchain_runtime = None | ||
| 1117 | + effective_runtime = None | ||
| 1132 | 1118 | ||
| 1133 | 1119 | if effective_runtime: | |
| 1134 | 1120 | direct = [] # List of files | |
@@ -1207,7 +1193,7 @@ def _maybe_get_runtime_from_ctx(ctx): | |||
| 1207 | 1193 | effective_runtime = toolchain_runtime | |
| 1208 | 1194 | else: | |
| 1209 | 1195 | toolchain_runtime = None | |
| 1210 | - attr_target = getattr(ctx.attr, PY_RUNTIME_ATTR_NAME) | ||
| 1196 | + attr_target = ctx.attr._py_interpreter | ||
| 1211 | 1197 | ||
| 1212 | 1198 | # In Bazel, --python_top is null by default. | |
| 1213 | 1199 | if attr_target and PyRuntimeInfo in attr_target: | |
@@ -1335,9 +1321,9 @@ def _create_runfiles_with_build_data( | |||
| 1335 | 1321 | central_uncachable_version_file, | |
| 1336 | 1322 | extra_write_build_data_env, | |
| 1337 | 1323 | ) | |
| 1338 | - build_data_runfiles = ctx.runfiles(symlinks = { | ||
| 1339 | - BUILD_DATA_SYMLINK_PATH: build_data_file, | ||
| 1340 | - }) | ||
| 1324 | + build_data_runfiles = ctx.runfiles(files = [ | ||
| 1325 | + build_data_file, | ||
| 1326 | + ]) | ||
| 1341 | 1327 | return build_data_file, build_data_runfiles | |
| 1342 | 1328 | ||
| 1343 | 1329 | def _write_build_data(ctx, central_uncachable_version_file, extra_write_build_data_env): | |
@@ -1552,7 +1538,7 @@ def determine_main(ctx): | |||
| 1552 | 1538 | """ | |
| 1553 | 1539 | if ctx.attr.main: | |
| 1554 | 1540 | proposed_main = ctx.attr.main.label.name | |
| 1555 | - if not proposed_main.endswith(tuple(ALLOWED_MAIN_EXTENSIONS)): | ||
| 1541 | + if not proposed_main.endswith(".py"): | ||
| 1556 | 1542 | fail("main must end in '.py'") | |
| 1557 | 1543 | else: | |
| 1558 | 1544 | if ctx.label.name.endswith(".py"): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments