Skip to content

Commit

Permalink
Pass kwargs env to both update and test targets
Browse files Browse the repository at this point in the history
  • Loading branch information
lpulley committed Oct 9, 2024
1 parent bf4978c commit 0896e25
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions python/private/pypi/pip_compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,11 @@ def pip_compile(
"visibility": visibility,
}

# setuptools (the default python build tool) attempts to find user
# configuration in the user's home direcotory. This seems to work fine on
# linux and macOS, but fails on Windows, so we conditionally provide a fake
# USERPROFILE env variable to allow setuptools to proceed without finding
# user-provided configuration.
kwargs["env"] = select({
"@@platforms//os:windows": {"USERPROFILE": "Z:\\FakeSetuptoolsHomeDirectoryHack"},
"//conditions:default": {},
}) | kwargs.get("env", {})
env = kwargs.pop("env", {})

py_binary(
name = name + ".update",
env = env,
**attrs
)

Expand All @@ -174,6 +167,15 @@ def pip_compile(
py_test(
name = name + "_test",
timeout = timeout,
# kwargs could contain test-specific attributes like size or timeout
# setuptools (the default python build tool) attempts to find user
# configuration in the user's home direcotory. This seems to work fine on
# linux and macOS, but fails on Windows, so we conditionally provide a fake
# USERPROFILE env variable to allow setuptools to proceed without finding
# user-provided configuration.
env = select({
"@@platforms//os:windows": {"USERPROFILE": "Z:\\FakeSetuptoolsHomeDirectoryHack"},
"//conditions:default": {},
}) | env,
# kwargs could contain test-specific attributes like size
**dict(attrs, **kwargs)
)

0 comments on commit 0896e25

Please sign in to comment.