Commit b15e15f
Allow requirements_in to be generated (bazel-contrib#829)
* Allow requirements_in to be generated
We generate the `requirements_in` file from various input files
roughly like so:
genrule(
name = "generate_3.7_x86_requirements",
srcs = [
"requirements_base.in.txt",
"requirements_extra_37.in.txt",
],
outs = ["requirements_3.7_x86.txt"],
cmd = "cat $(SRCS) > $(OUTS)",
)
compile_pip_requirements(
name = "compile_requirements_3.7_x86",
requirements_in = ":requirements_3.7_x86.txt",
requirements_txt = "requirements_3.7_x86.lock.txt",
)
The current code errors out with a message like this:
Updating common/python/requirements_3.7_x86.lock.txt
Usage: pip_compile.py [OPTIONS] [SRC_FILES]...
Try 'pip_compile.py -h' for help.
Error: Invalid value for '[SRC_FILES]...': Path 'common/python/requirements_3.7_x86.txt' does not exist.
This patch here fixes the issue by resolving the `requirements_in`
path before the tool `cd`s into the workspace directory.
* Make tests pass
* Run black
* Fix some runtime problems
Co-authored-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com>1 parent 44d41ee commit b15e15f
3 files changed
Lines changed: 42 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
58 | 68 | | |
59 | 69 | | |
60 | 70 | | |
| |||
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
28 | 44 | | |
29 | 45 | | |
30 | 46 | | |
| |||
42 | 58 | | |
43 | 59 | | |
44 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
45 | 65 | | |
46 | 66 | | |
47 | 67 | | |
| |||
96 | 116 | | |
97 | 117 | | |
98 | 118 | | |
99 | | - | |
| 119 | + | |
100 | 120 | | |
101 | 121 | | |
102 | 122 | | |
103 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
104 | 131 | | |
105 | 132 | | |
106 | 133 | | |
| |||
118 | 145 | | |
119 | 146 | | |
120 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
121 | 151 | | |
122 | 152 | | |
123 | 153 | | |
| |||
0 commit comments