File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 4141 )
4242 copyfile (requirements_txt , requirements_out )
4343
44- elif "BUILD_WORKING_DIRECTORY" in os .environ :
45- os .chdir (os .environ ['BUILD_WORKING_DIRECTORY' ])
44+ elif "BUILD_WORKSPACE_DIRECTORY" in os .environ :
45+ # This value, populated when running under `bazel run`, is a path to the
46+ # "root of the workspace where the build was run."
47+ # This matches up with the values passed in via the macro using the 'rootpath' Make variable,
48+ # which for source files provides a path "relative to your workspace root."
49+ #
50+ # Changing to the WORKSPACE root avoids 'file not found' errors when the `.update` target is run
51+ # from different directories within the WORKSPACE.
52+ os .chdir (os .environ ['BUILD_WORKSPACE_DIRECTORY' ])
4653else :
54+ err_msg = (
55+ "Expected to find BUILD_WORKSPACE_DIRECTORY (running under `bazel run`) or "
56+ "TEST_TMPDIR (running under `bazel test`) in environment."
57+ )
4758 print (
48- "Expected to find BUILD_WORKING_DIRECTORY in environment" ,
59+ err_msg ,
4960 file = sys .stderr ,
5061 )
5162 sys .exit (1 )
You can’t perform that action at this time.
0 commit comments