|
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 _to_purl(*, index, metadata, filename): |
281 | 264 | """ |
282 | 265 | Produce a PyPI PURL from the metadata. |
@@ -346,11 +329,10 @@ def _whl_library_impl(rctx): |
346 | 329 | # build deps from PyPI (e.g. `flit_core`) if they are missing. |
347 | 330 | extra_pip_args.extend(["--find-links", "."]) |
348 | 331 |
|
349 | | - enable_pipstar_extract = rp_config.bazel_8_or_later |
350 | | - |
351 | | - # When pipstar is enabled, Python isn't used, so there's no need |
352 | | - # to setup env vars to run Python, unless we need to build an sdist |
353 | | - if enable_pipstar_extract and whl_path and not rctx.attr.whl_patches: |
| 332 | + # When we already have a wheel and there are no patches, Python isn't used, |
| 333 | + # so there's no need to setup env vars to run Python, unless we need to |
| 334 | + # build an sdist or resolve a requirement. |
| 335 | + if whl_path and not rctx.attr.whl_patches: |
354 | 336 | environment = {} |
355 | 337 | args = [] |
356 | 338 | python_interpreter = None |
@@ -416,17 +398,7 @@ def _whl_library_impl(rctx): |
416 | 398 | timeout = rctx.attr.timeout, |
417 | 399 | ) |
418 | 400 |
|
419 | | - if enable_pipstar_extract: |
420 | | - whl_extract(rctx, whl_path = whl_path, logger = logger) |
421 | | - else: |
422 | | - _extract_whl_py( |
423 | | - rctx, |
424 | | - python_interpreter = python_interpreter, |
425 | | - args = args, |
426 | | - whl_path = whl_path, |
427 | | - environment = environment, |
428 | | - logger = logger, |
429 | | - ) |
| 401 | + whl_extract(rctx, whl_path = whl_path, logger = logger) |
430 | 402 |
|
431 | 403 | install_dir_path = whl_path.dirname.get_child("site-packages") |
432 | 404 | metadata = whl_metadata( |
@@ -479,9 +451,8 @@ repo( |
479 | 451 | _remove_files(rctx, "BUILD", "BUILD.bazel") |
480 | 452 | rctx.file("BUILD.bazel", build_file_contents) |
481 | 453 |
|
482 | | - if enable_pipstar_extract: |
483 | | - if hasattr(rctx, "repo_metadata"): |
484 | | - return rctx.repo_metadata(reproducible = True) |
| 454 | + if hasattr(rctx, "repo_metadata"): |
| 455 | + return rctx.repo_metadata(reproducible = True) |
485 | 456 |
|
486 | 457 | return None |
487 | 458 |
|
|
0 commit comments