|
14 | 14 |
|
15 | 15 | "" |
16 | 16 |
|
17 | | -load("@rules_python_internal//:rules_python_config.bzl", rp_config = "config") |
18 | 17 | load("//python/private:auth.bzl", "AUTH_ATTRS", "get_auth") |
19 | 18 | load("//python/private:envsubst.bzl", "envsubst") |
20 | 19 | load("//python/private:is_standalone_interpreter.bzl", "is_standalone_interpreter") |
@@ -261,22 +260,6 @@ def _create_repository_execution_environment(rctx, python_interpreter, logger = |
261 | 260 | env[_CPPFLAGS] = " ".join(cppflags) |
262 | 261 | return env |
263 | 262 |
|
264 | | -def _extract_whl_py(rctx, *, python_interpreter, args, whl_path, environment, logger): |
265 | | - pypi_repo_utils.execute_checked( |
266 | | - rctx, |
267 | | - op = "whl_library.ExtractWheel({}, {})".format(rctx.attr.name, whl_path), |
268 | | - python = python_interpreter, |
269 | | - arguments = args + [ |
270 | | - "--whl-file", |
271 | | - whl_path, |
272 | | - ], |
273 | | - srcs = rctx.attr._python_srcs, |
274 | | - environment = environment, |
275 | | - quiet = rctx.attr.quiet, |
276 | | - timeout = rctx.attr.timeout, |
277 | | - logger = logger, |
278 | | - ) |
279 | | - |
280 | 263 | def _get_entry_points(rctx, install_dir_path, metadata): |
281 | 264 | dist_info_dir = "{}-{}.dist-info".format( |
282 | 265 | metadata.name.replace("-", "_"), |
@@ -376,11 +359,10 @@ def _whl_library_impl(rctx): |
376 | 359 | # build deps from PyPI (e.g. `flit_core`) if they are missing. |
377 | 360 | extra_pip_args.extend(["--find-links", "."]) |
378 | 361 |
|
379 | | - enable_pipstar_extract = rp_config.bazel_8_or_later |
380 | | - |
381 | | - # When pipstar is enabled, Python isn't used, so there's no need |
382 | | - # to setup env vars to run Python, unless we need to build an sdist |
383 | | - if enable_pipstar_extract and whl_path and not rctx.attr.whl_patches: |
| 362 | + # When we already have a wheel and there are no patches, Python isn't used, |
| 363 | + # so there's no need to setup env vars to run Python, unless we need to |
| 364 | + # build an sdist or resolve a requirement. |
| 365 | + if whl_path and not rctx.attr.whl_patches: |
384 | 366 | environment = {} |
385 | 367 | args = [] |
386 | 368 | python_interpreter = None |
@@ -446,17 +428,7 @@ def _whl_library_impl(rctx): |
446 | 428 | timeout = rctx.attr.timeout, |
447 | 429 | ) |
448 | 430 |
|
449 | | - if enable_pipstar_extract: |
450 | | - whl_extract(rctx, whl_path = whl_path, logger = logger) |
451 | | - else: |
452 | | - _extract_whl_py( |
453 | | - rctx, |
454 | | - python_interpreter = python_interpreter, |
455 | | - args = args, |
456 | | - whl_path = whl_path, |
457 | | - environment = environment, |
458 | | - logger = logger, |
459 | | - ) |
| 431 | + whl_extract(rctx, whl_path = whl_path, logger = logger) |
460 | 432 |
|
461 | 433 | install_dir_path = whl_path.dirname.get_child("site-packages") |
462 | 434 | metadata = whl_metadata( |
@@ -513,9 +485,8 @@ repo( |
513 | 485 | _remove_files(rctx, "BUILD", "BUILD.bazel") |
514 | 486 | rctx.file("BUILD.bazel", build_file_contents) |
515 | 487 |
|
516 | | - if enable_pipstar_extract: |
517 | | - if hasattr(rctx, "repo_metadata"): |
518 | | - return rctx.repo_metadata(reproducible = True) |
| 488 | + if hasattr(rctx, "repo_metadata"): |
| 489 | + return rctx.repo_metadata(reproducible = True) |
519 | 490 |
|
520 | 491 | return None |
521 | 492 |
|
@@ -632,7 +603,6 @@ way to define whl_library and move whl patching to a separate place. INTERNAL US |
632 | 603 | "_python_srcs": attr.label_list( |
633 | 604 | # Used as a default value in a rule to ensure we fetch the dependencies. |
634 | 605 | default = [ |
635 | | - Label("//python/private/pypi/whl_installer:wheel.py"), |
636 | 606 | Label("//python/private/pypi/whl_installer:wheel_installer.py"), |
637 | 607 | Label("//python/private/pypi/whl_installer:arguments.py"), |
638 | 608 | ] + record_files.values(), |
|
0 commit comments