Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 62ebe03

Browse filesBrowse files
Alex Eaglemattem
Alex Eagle
authored andcommitted
patch pr623
1 parent b77ceba commit 62ebe03
Copy full SHA for 62ebe03

File tree

2 files changed

+15
-1
lines changed
Filter options

2 files changed

+15
-1
lines changed

‎python/pip_install/extract_wheels/__init__.py

Copy file name to clipboardExpand all lines: python/pip_install/extract_wheels/__init__.py
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ def main() -> None:
6969
type=annotation.annotations_map_from_str_path,
7070
help="A json encoded file containing annotations for rendered packages.",
7171
)
72+
parser.add_argument(
73+
"--constraints",
74+
action="store",
75+
required=False,
76+
help="Path to constraints.txt, to find the versions that should be used",
77+
)
7278
arguments.parse_common_args(parser)
7379
args = parser.parse_args()
7480
deserialized_args = dict(vars(args))
@@ -80,7 +86,9 @@ def main() -> None:
8086
pip_args = (
8187
[sys.executable, "-m", "pip"]
8288
+ (["--isolated"] if args.isolated else [])
83-
+ ["wheel", "-r", args.requirements]
89+
+ ["wheel"]
90+
+ (["-c", args.constraints] if args.constraints else [])
91+
+ ["-r", args.requirements]
8492
+ ["--wheel-dir", os.getcwd()]
8593
+ deserialized_args["extra_pip_args"]
8694
)

‎python/pip_install/pip_repository.bzl

Copy file name to clipboardExpand all lines: python/pip_install/pip_repository.bzl
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ def _pip_repository_impl(rctx):
159159
"--annotations",
160160
annotations_file,
161161
]
162+
if rctx.attr.constraints:
163+
args += ["--constraints", rctx.path(rctx.attr.constraints)]
162164

163165
args += ["--python_interpreter", _get_python_interpreter_attr(rctx)]
164166
if rctx.attr.python_interpreter_target:
@@ -280,6 +282,10 @@ pip_repository_attrs = {
280282
"annotations": attr.string_dict(
281283
doc = "Optional annotations to apply to packages",
282284
),
285+
"constraints": attr.label(
286+
allow_single_file = True,
287+
doc = "A 'constraints.txt' pip constraints file.",
288+
),
283289
"incremental": attr.bool(
284290
default = False,
285291
doc = "Create the repository in incremental mode.",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.