Skip to content

Update Target from compile_pip_requirements Macro Can Not Be Run from a Subdir #507

@ssiano

Description

@ssiano

🐞 bug report

Affected Rule

The issue is caused by the rule: compile_pip_requirements

Is this a regression?

compile_pip_requirements is new

Description

bazel run :NAME.update can not be run from a subdir. The wrong filename is passed to pip_compile.py.

Fortunately, the //PACKAGE:NAME.update target works when run from the project (WORKSPACE) dir.

🔬 Minimal Reproduction

Here is example output from my environment:

$ bazel build //build:requirements3
Target //build:requirements3 up-to-date (nothing to build)
$ bazel test --nocache_test_results //build:requirements3_test
//build:requirements3_test PASSED in 3.7s
$ bazel run //build:requirements3.update
Updating build/requirements3.txt

$ cd build

$ bazel build //build:requirements3
Target //build:requirements3 up-to-date (nothing to build)
$ bazel test --nocache_test_results //build:requirements3_test
//build:requirements3_test PASSED in 11.9s
$ bazel run //build:requirements3.update
Updating build/requirements3.txt
Usage: pip_compile.py [OPTIONS] [SRC_FILES]...
Try 'pip_compile.py -h' for help.
Error: Invalid value for '[SRC_FILES]...': Path 'build/requirements3.in' does not exist.

$ bazel build :requirements3
Target //build:requirements3 up-to-date (nothing to build)
$ bazel test --nocache_test_results :requirements3_test
//build:requirements3_test PASSED in 3.8s
$ bazel run :requirements3.update
Updating build/requirements3.txt
Usage: pip_compile.py [OPTIONS] [SRC_FILES]...
Try 'pip_compile.py -h' for help.
Error: Invalid value for '[SRC_FILES]...': Path 'build/requirements3.in' does not exist.

🔥 Exception or Error


Updating build/requirements3.txt
Usage: pip_compile.py [OPTIONS] [SRC_FILES]...
Try 'pip_compile.py -h' for help.
Error: Invalid value for '[SRC_FILES]...': Path 'build/requirements3.in' does not exist.

🌍 Your Environment

Operating System:

  
Linux 4841-desktop 4.4.0-206-generic #238~14.04.1-Ubuntu SMP Wed Mar 17 06:45:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  

Output of bazel version:

  
Build label: 3.7.2-1.4
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Jun 16 19:30:17 2021 (1623871817)
Build timestamp: 1623871817
Build timestamp as int: 1623871817
  

Rules_python version:

  
0.3.0 plus eight commits, i.e., at Commit cd64466928a2cace1b8aa6d097c3ac31d35d4555.
  

Anything else relevant?
The same behavior was observed when I used the requirements_in and requirements_txt args to compile_pip_requirements.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions