File tree 1 file changed +14
-3
lines changed
Filter options
1 file changed +14
-3
lines changed
Original file line number Diff line number Diff line change 41
41
)
42
42
copyfile (requirements_txt , requirements_out )
43
43
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' ])
46
53
else :
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
+ )
47
58
print (
48
- "Expected to find BUILD_WORKING_DIRECTORY in environment" ,
59
+ err_msg ,
49
60
file = sys .stderr ,
50
61
)
51
62
sys .exit (1 )
You can’t perform that action at this time.
0 commit comments