Skip to content

Commit 6eae336

Browse files
author
Michael Eastham
authored
Merge pull request #1 from tecton-ai/extra_index_label
Add extra_index_urls parameter to pip_parse
2 parents cd64466 + 515a9b3 commit 6eae336

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

python/pip_install/pip_repository.bzl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ def _parse_optional_attrs(rctx, args):
3232
args: A list of parsed args for the rule.
3333
Returns: Augmented args list.
3434
"""
35-
if rctx.attr.extra_pip_args:
35+
extra_args = list(rctx.attr.extra_pip_args)
36+
for target in rctx.attr.extra_index_url_targets:
37+
extra_args += ["--extra-index-url", "file://" + str(rctx.path(target)).split("/index.html")[0]]
38+
if extra_args:
3639
args += [
3740
"--extra_pip_args",
38-
struct(args = rctx.attr.extra_pip_args).to_json(),
41+
struct(args = extra_args).to_json(),
3942
]
4043

4144
if rctx.attr.pip_data_exclude:
@@ -151,6 +154,10 @@ python_interpreter.
151154
default = 600,
152155
doc = "Timeout (in seconds) on the rule's execution duration.",
153156
),
157+
"extra_index_url_targets": attr.label_list(
158+
default = [],
159+
doc = "Bazel labels for directories which should be passed to pip's --extra-index-url flag",
160+
)
154161
}
155162

156163
pip_repository_attrs = {

0 commit comments

Comments
 (0)