-
Notifications
You must be signed in to change notification settings - Fork 542
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document how to vendor a pip_parse requirements.bzl file (#655)
* Document how to vendor a pip_parse requirements.bzl file fixes #608 * code review feedback
- Loading branch information
Alex Eagle
authored
Mar 16, 2022
1 parent
fc05103
commit 1b59002
Showing
5 changed files
with
85 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
"""Main entry point.""" | ||
import os | ||
import sys | ||
|
||
from python.pip_install.parse_requirements_to_bzl import main | ||
|
||
if __name__ == "__main__": | ||
main() | ||
# Under `bazel run`, just print the generated starlark code. | ||
# This allows users to check that into their repository rather than | ||
# call pip_parse to generate as a repository rule. | ||
if "BUILD_WORKING_DIRECTORY" in os.environ: | ||
os.chdir(os.environ["BUILD_WORKING_DIRECTORY"]) | ||
main(sys.stdout) | ||
else: | ||
with open("requirements.bzl", "w") as requirement_file: | ||
main(requirement_file) |
This file contains 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