Open nickbreen opened 3 years ago
This can be achieved with a file:
relative URL.
http_archive(
name = _name("aiohttp"),
build_file_content = _build_file_content(["aiohttp"]),
sha256 = "ae55bac364c405caa23a4f2d6cfecc6a0daada500274ffca4a9230e7129eac59",
type = "zip",
url = "file:lib/3rd-party-python/aiohttp/3.6.2/aiohttp-3.6.2-cp36-cp36m-manylinux1_x86_64.whl",
)
def _build_file_content(imports = ["."]):
if type(imports) != "list":
fail("imports must be a list, got: " + type(imports))
imports_str = ",".join(['"%s"' % i for i in imports])
return '''
py_library(
name = "pkg",
srcs = glob(["**/*.py"]),
data = glob(["**/*"], exclude = ["**/*.py", "WORKSPACE", "BUILD.*"]),
imports = [%s],
visibility = ["//visibility:public"],
)
''' % imports_str
We do an airgapped build where the CI server has no internet access. We check in the whl files into SCM.
When specifying a
requirements.txt
with local file references the rules generator logs warnings and then fails withFileNotFound
:I think that the missing feature is a parameter for :generate to provide a directory (and possibly specify it multiple times) of whl files that can be resolved against when the
requirements.txt
file has a filename specification.