Skip to content

Commit aab2650

Browse files
authored
fix: work around version parsing by only parsing if site-packages is enabled (bazel-contrib#3031)
There's a bug in the version string parser that doesn't handle local identifiers correctly. Thankfully, it's only activated in the experimental code path when site packages for libraries is eanbled. Moving the logic within that block works around it. Work around for bazel-contrib#3030
1 parent 4978027 commit aab2650

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

python/private/py_library.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ def py_library_impl(ctx, *, semantics):
161161
imports = []
162162
venv_symlinks = []
163163

164-
package, version_str = _get_package_and_version(ctx)
165-
imports, venv_symlinks = _get_imports_and_venv_symlinks(ctx, semantics, package, version_str)
164+
imports, venv_symlinks = _get_imports_and_venv_symlinks(ctx, semantics)
166165

167166
cc_info = semantics.get_cc_info_for_library(ctx)
168167
py_info, deps_transitive_sources, builtins_py_info = create_py_info(
@@ -241,10 +240,11 @@ def _get_package_and_version(ctx):
241240
version.normalize(version_str), # will have no dashes either
242241
)
243242

244-
def _get_imports_and_venv_symlinks(ctx, semantics, package, version_str):
243+
def _get_imports_and_venv_symlinks(ctx, semantics):
245244
imports = depset()
246245
venv_symlinks = []
247246
if VenvsSitePackages.is_enabled(ctx):
247+
package, version_str = _get_package_and_version(ctx)
248248
venv_symlinks = _get_venv_symlinks(ctx, package, version_str)
249249
else:
250250
imports = collect_imports(ctx, semantics)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy