Skip to content

Commit e430f7d

Browse files
committed
Pass kwargs env to both update and test targets
1 parent 30fc3f9 commit e430f7d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

python/private/pypi/pip_compile.bzl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,11 @@ def pip_compile(
154154
"visibility": visibility,
155155
}
156156

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

167159
py_binary(
168160
name = name + ".update",
161+
env = env,
169162
**attrs
170163
)
171164

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

0 commit comments

Comments
 (0)