Allow requirements_in to be generated - #829
Merged
Merged
Conversation
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.
philsc
marked this pull request as ready for review
September 24, 2022 19:29
philsc
requested review from
brandjon,
lberki and
thundergolfer
as code owners
September 24, 2022 19:29
philsc
marked this pull request as draft
September 24, 2022 19:34
philsc
marked this pull request as ready for review
September 24, 2022 19:54
Contributor
Author
|
@brandjon , @lberki , @thundergolfer , any thoughts? |
f0rmiga
approved these changes
Oct 5, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
We generate the
requirements_infile from various input files roughly like so:The current code errors out with a message like this:
What is the new behavior?
This patch here fixes the issue by resolving the
requirements_inpathbefore the tool
cds into the workspace directory.The downside is that the output of
pipstill contains the fully resolvedpaths on the terminal output. You'll see them in the following example.
The console output will contain the full paths, but the saved
requirements_lock.txtfile will not. I could not think of a good way toalso fix up
pip's console output.Does this PR introduce a breaking change?
Other information