Skip to content

Commit 582cea1

Browse files
committed
Populating the runfiles tree is disabled by default on windows (ie --noenable_runfiles). This means the runfiles library resolves the requirements_file to the file in the source tree (ie resolved_requirements_file is the absolute path to the file in the source tree, not to a file in the runfiles directory). pip_compile is told to output to a relative path, which means it will output to a file in the runfiles directory. The check to see if we need to copy that file to the source tree was incorrect because it didn't check to see if the file output by pip_compile was the same as the one in the source tree, it checked if the resolved file was the same as the one in the source tree. Since the resolved file IS the same as the one in the source tree, it never copied, but the resolved file is not the file that pip_compile output to.
1 parent bb43e03 commit 582cea1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

python/private/pypi/dependency_resolver/dependency_resolver.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,14 @@ def main(
173173
if "BUILD_WORKSPACE_DIRECTORY" in os.environ:
174174
workspace = os.environ["BUILD_WORKSPACE_DIRECTORY"]
175175
requirements_file_tree = os.path.join(workspace, requirements_file_relative)
176+
absolute_output_file = Path(requirements_file_relative).absolute()
176177
# In most cases, requirements_file will be a symlink to the real file in the source tree.
177178
# If symlinks are not enabled (e.g. on Windows), then requirements_file will be a copy,
178179
# and we should copy the updated requirements back to the source tree.
179-
if not os.path.samefile(resolved_requirements_file, requirements_file_tree):
180+
if not absolute_output_file.samefile(requirements_file_tree):
180181
atexit.register(
181182
lambda: shutil.copy(
182-
resolved_requirements_file, requirements_file_tree
183+
absolute_output_file, requirements_file_tree
183184
)
184185
)
185186
cli(argv, standalone_mode = False)

0 commit comments

Comments
 (0)