diff --git a/WORKSPACE b/WORKSPACE index 5b3f793e1d2c9..8c9388e29dc27 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -83,10 +83,13 @@ install_bazel_dependencies() http_archive( name = "rules_python", - sha256 = "b556b165ea1311bf68b6b0bc86d95e5cfca2e839aa6fbd232781bb3930f3d392", - strip_prefix = "rules_python-e0644961d74b9bbb8a975a01bebb045abfd5d1bd", + sha256 = "ddb2e1298684defde2f5e466d96e572119f30f9e2a901a7a81474fd4fa9f6d52", + strip_prefix = "rules_python-dd7f9c5f01bafbfea08c44092b6b0c8fc8fcb77f", urls = [ - "https://github.com/bazelbuild/rules_python/archive/e0644961d74b9bbb8a975a01bebb045abfd5d1bd.zip", + "https://github.com/bazelbuild/rules_python/archive/dd7f9c5f01bafbfea08c44092b6b0c8fc8fcb77f.zip", + ], + patches = [ + "//py:rules_python_any_version_wheel.patch" ], ) diff --git a/py/BUILD.bazel b/py/BUILD.bazel index a959a44faa7a8..48e995fb2aa8b 100644 --- a/py/BUILD.bazel +++ b/py/BUILD.bazel @@ -1,4 +1,5 @@ load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test") +load("@rules_python//experimental/python:wheel.bzl", "py_package", "py_wheel") load("//py:defs.bzl", "py_test_suite", "pytest_test") load("//:copy_file.bzl", "copy_file") @@ -42,6 +43,39 @@ py_library( ], ) +py_package( + name = "selenium-pkg", + packages = [ + "py.selenium", + "py.selenium.common", + "py.selenium.webdriver", + "py.selenium.webdriver.chromium", + "py.selenium.webdriver.chrome", + "py.selenium.webdriver.edge", + "py.selenium.webdriver.firefox", + "py.selenium.webdriver.remote", + "py.selenium.webdriver.safari", + ], + deps = [":selenium"], +) + +py_wheel( + name = 'selenium-wheel', + distribution = 'selenium', + python_tag = ["py2", "py3"], + version = "4.0.0.a4", + strip_path_prefixes = [ + "py", + ], + requires = [ + "urllib3[secure]", + ], + visibility = ["//visibility:public"], + deps = [ + ":selenium-pkg", + ], +) + py_library( name = "init-tree", testonly = True, diff --git a/py/rules_python_any_version_wheel.patch b/py/rules_python_any_version_wheel.patch new file mode 100644 index 0000000000000..9b9ee0a5c74a2 --- /dev/null +++ b/py/rules_python_any_version_wheel.patch @@ -0,0 +1,36 @@ +diff --git experimental/python/wheel.bzl experimental/python/wheel.bzl +index 9cd6534..7802d42 100644 +--- experimental/python/wheel.bzl ++++ experimental/python/wheel.bzl +@@ -85,7 +85,7 @@ def _py_wheel_impl(ctx): + outfile = ctx.actions.declare_file("-".join([ + ctx.attr.distribution, + ctx.attr.version, +- ctx.attr.python_tag, ++ ".".join(ctx.attr.python_tag), + ctx.attr.abi, + ctx.attr.platform, + ]) + ".whl") +@@ -101,7 +101,7 @@ def _py_wheel_impl(ctx): + args = ctx.actions.args() + args.add("--name", ctx.attr.distribution) + args.add("--version", ctx.attr.version) +- args.add("--python_tag", ctx.attr.python_tag) ++ args.add_all(ctx.attr.python_tag, format_each = "--python_tag=%s") + args.add("--abi", ctx.attr.abi) + args.add("--platform", ctx.attr.platform) + args.add("--out", outfile.path) +@@ -177,10 +177,9 @@ refer to the package in other packages' dependencies. + default = "any", + doc = "Supported platforms. 'any' for pure-Python wheel.", + ), +- "python_tag": attr.string( +- default = "py3", +- doc = "Supported Python major version. 'py2' or 'py3'", +- values = ["py2", "py3"], ++ "python_tag": attr.string_list( ++ default = ["py3"], ++ doc = "Supported Python major version. 'py2' and/or 'py3'", + ), + "version": attr.string( + mandatory = True, \ No newline at end of file