Skip to content

Commit a2d92f8

Browse files
committed
fix: work around version parsing by only parsing if site-packages is enabled
1 parent 4978027 commit a2d92f8

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)