Skip to content

Commit 63841ec

Browse files
committed
fix: work around version parsing by only parsing if site-packages is enabled (#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 #3030 (cherry picked from commit aab2650)
1 parent a1ca1da commit 63841ec

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)