diff --git a/python/pip_install/extract_wheels/__init__.py b/python/pip_install/extract_wheels/__init__.py index cda6d541b0..334a6f8912 100644 --- a/python/pip_install/extract_wheels/__init__.py +++ b/python/pip_install/extract_wheels/__init__.py @@ -58,6 +58,12 @@ def main() -> None: parser = argparse.ArgumentParser( description="Resolve and fetch artifacts transitively from PyPI" ) + parser.add_argument( + "--find-links", + type=str, + default=None, + help="Directory to look for archives such as sdist or wheel files.", + ) parser.add_argument( "--requirements", action="store", @@ -82,6 +88,7 @@ def main() -> None: + (["--isolated"] if args.isolated else []) + ["wheel", "-r", args.requirements] + ["--wheel-dir", os.getcwd()] + + (["--find-links", "{}/../{}".format(os.getcwd(), args.find_links)] if args.find_links else []) + deserialized_args["extra_pip_args"] ) diff --git a/python/pip_install/pip_repository.bzl b/python/pip_install/pip_repository.bzl index e587f34c73..9e955f99a5 100644 --- a/python/pip_install/pip_repository.bzl +++ b/python/pip_install/pip_repository.bzl @@ -160,6 +160,10 @@ def _pip_repository_impl(rctx): "--annotations", annotations_file, ] + + # TODO: move this in to _parse_optional_attrs() + if rctx.attr.find_links: + args += ["--find-links", rctx.attr.find_links.workspace_name] progress_message = "Extracting wheels" args += ["--repo", rctx.attr.name, "--repo-prefix", rctx.attr.repo_prefix] @@ -211,6 +215,12 @@ can be passed. "extra_pip_args": attr.string_list( doc = "Extra arguments to pass on to pip. Must not contain spaces.", ), + "find_links": attr.label( + doc = """\ +The [--find-links](https://pip.pypa.io/en/stable/cli/pip_wheel/#cmdoption-f) to +pass to the underlying pip command. +""", + ), "isolated": attr.bool( doc = """\ Whether or not to pass the [--isolated](https://pip.pypa.io/en/stable/cli/pip/#cmdoption-isolated) flag to diff --git a/python/pip_install/repositories.bzl b/python/pip_install/repositories.bzl index 352f66341c..86921f313e 100644 --- a/python/pip_install/repositories.bzl +++ b/python/pip_install/repositories.bzl @@ -29,8 +29,8 @@ _RULE_DEPS = [ ), ( "pypi__pkginfo", - "https://files.pythonhosted.org/packages/cd/00/49f59cdd2c6a52e6665fda4de671dac5614366dc827e050c55428241b929/pkginfo-1.8.2-py2.py3-none-any.whl", - "c24c487c6a7f72c66e816ab1796b96ac6c3d14d49338293d2141664330b55ffc", + "https://files.pythonhosted.org/packages/fa/3d/f4f2ba829efb54b6cd2d91349c7463316a9cc55a43fc980447416c88540f/pkginfo-1.12.1.2-py3-none-any.whl", + "c783ac885519cab2c34927ccfa6bf64b5a704d7c69afaea583dd9b7afe969343", ), ( "pypi__setuptools",