Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions python/pip.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ def _pip_import_impl(repository_ctx):
repository_ctx.file("BUILD", "")

# To see the output, pass: quiet=False
result = repository_ctx.execute([
result = repository_ctx.execute(
[
"python", repository_ctx.path(repository_ctx.attr._script),
"--name", repository_ctx.attr.name,
"--input", repository_ctx.path(repository_ctx.attr.requirements),
"--output", repository_ctx.path("requirements.bzl"),
"--directory", repository_ctx.path(""),
])
] + repository_ctx.attr.extra_args,
environment = repository_ctx.attr.environment,
)

if result.return_code:
fail("pip_import failed: %s (%s)" % (result.stdout, result.stderr))
Expand All @@ -41,6 +44,8 @@ pip_import = repository_rule(
mandatory = True,
single_file = True,
),
"environment": attr.string_dict(),
"extra_args": attr.string_list(),
"_script": attr.label(
executable = True,
default = Label("//tools:piptool.par"),
Expand Down
4 changes: 2 additions & 2 deletions rules_python/piptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ def is_possible(distro, extra):
}

def main():
args = parser.parse_args()
args, unkwown = parser.parse_known_args()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: unknown


# https://github.com/pypa/pip/blob/9.0.1/pip/__init__.py#L209
if pip_main(["wheel", "-w", args.directory, "-r", args.input]):
if pip_main(["wheel", "-w", args.directory,] + unkwown + ["-r", args.input]):
sys.exit(1)

# Enumerate the .whl files we downloaded.
Expand Down
Binary file modified tools/piptool.par
Binary file not shown.