From 06e1da83bebc3976e9739170a30dee2282881096 Mon Sep 17 00:00:00 2001 From: Joshua Katz Date: Sat, 12 Oct 2019 11:54:57 -0400 Subject: [PATCH 1/4] Hard-code to use python3. --- examples/helloworld/BUILD | 2 +- python/pip.bzl | 2 +- python/whl.bzl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/helloworld/BUILD b/examples/helloworld/BUILD index 43ac6c12da..1e1a749adb 100644 --- a/examples/helloworld/BUILD +++ b/examples/helloworld/BUILD @@ -28,5 +28,5 @@ py_test( name = "helloworld_test", srcs = ["helloworld_test.py"], deps = [":helloworld"], - python_version = "PY2", + python_version = "PY3", ) diff --git a/python/pip.bzl b/python/pip.bzl index b69eb9366e..f21be12c75 100644 --- a/python/pip.bzl +++ b/python/pip.bzl @@ -24,7 +24,7 @@ def _pip_import_impl(repository_ctx): # To see the output, pass: quiet=False result = repository_ctx.execute([ - "python", + "python3", repository_ctx.path(repository_ctx.attr._script), "--name", repository_ctx.attr.name, diff --git a/python/whl.bzl b/python/whl.bzl index 3f869c29ec..7db7fbf929 100644 --- a/python/whl.bzl +++ b/python/whl.bzl @@ -17,7 +17,7 @@ def _whl_impl(repository_ctx): """Core implementation of whl_library.""" args = [ - "python", + "python3", repository_ctx.path(repository_ctx.attr._script), "--whl", repository_ctx.path(repository_ctx.attr.whl), From 4c29f7b82ff7fc047c174353775c5e8d15f78042 Mon Sep 17 00:00:00 2001 From: Joshua Katz Date: Sat, 12 Oct 2019 13:27:24 -0400 Subject: [PATCH 2/4] Annotate with python_version on py_library --- packaging/whl.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/whl.py b/packaging/whl.py index 63a6d62b8f..3ed6e87ebe 100644 --- a/packaging/whl.py +++ b/packaging/whl.py @@ -149,6 +149,7 @@ def main(): name = "pkg", srcs = glob(["**/*.py"]), data = glob(["**/*"], exclude=["**/*.py", "**/* *", "BUILD", "WORKSPACE"]), + python_version = "PY3", # This makes this directory a top-level in the python import # search path for anything that depends on this. imports = ["."], @@ -163,6 +164,7 @@ def main(): extras='\n\n'.join([ """py_library( name = "{extra}", + python_version = "PY3", deps = [ ":pkg",{deps} ], From ffd58ae5433d38a914934589d5593cff990daadb Mon Sep 17 00:00:00 2001 From: Joshua Katz Date: Sat, 12 Oct 2019 13:33:25 -0400 Subject: [PATCH 3/4] Force pip to download python 3.7 deps --- packaging/piptool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/piptool.py b/packaging/piptool.py index 2544032ee8..d5aaf7896f 100644 --- a/packaging/piptool.py +++ b/packaging/piptool.py @@ -78,7 +78,7 @@ def pip_main(argv): atexit.register(lambda: shutil.rmtree(cert_tmpdir, ignore_errors=True)) with open(cert_path, "wb") as cert: cert.write(pkgutil.get_data("pip._vendor.requests", "cacert.pem")) - argv = ["--isolated", "--disable-pip-version-check", "--cert", cert_path] + argv + argv = ["--isolated", "--python-version=37", "--disable-pip-version-check", "--cert", cert_path] + argv return pip.main(argv) from packaging.whl import Wheel From 805d1cee8a29d26b7a9c59ab47008fea2bb4254c Mon Sep 17 00:00:00 2001 From: Joshua Katz Date: Sat, 12 Oct 2019 14:16:13 -0400 Subject: [PATCH 4/4] Attempt to directly specifiy 3.7 --- python/pip.bzl | 2 +- python/whl.bzl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/pip.bzl b/python/pip.bzl index f21be12c75..3ae33aa06a 100644 --- a/python/pip.bzl +++ b/python/pip.bzl @@ -24,7 +24,7 @@ def _pip_import_impl(repository_ctx): # To see the output, pass: quiet=False result = repository_ctx.execute([ - "python3", + "python3.7", repository_ctx.path(repository_ctx.attr._script), "--name", repository_ctx.attr.name, diff --git a/python/whl.bzl b/python/whl.bzl index 7db7fbf929..4b7f8b259e 100644 --- a/python/whl.bzl +++ b/python/whl.bzl @@ -17,7 +17,7 @@ def _whl_impl(repository_ctx): """Core implementation of whl_library.""" args = [ - "python3", + "python3.7", repository_ctx.path(repository_ctx.attr._script), "--whl", repository_ctx.path(repository_ctx.attr.whl),