From 0310e9fe4b367ce370612a77c66ae195fe262ab6 Mon Sep 17 00:00:00 2001 From: Simon Mavi Stewart Date: Thu, 21 Mar 2024 14:14:26 +0000 Subject: [PATCH] [python] Replace genrule with py_binary --- py/BUILD.bazel | 28 ++++++++++++++-------------- py/release-selenium.py | 11 +++++++++++ 2 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 py/release-selenium.py diff --git a/py/BUILD.bazel b/py/BUILD.bazel index 81bc9d41d44f8..7e26fa9b3e1ed 100644 --- a/py/BUILD.bazel +++ b/py/BUILD.bazel @@ -10,24 +10,24 @@ load("//py:defs.bzl", "generate_devtools", "py_test_suite") load("//py/private:browsers.bzl", "BROWSERS") load("//py/private:import.bzl", "py_import") -alias( - name = "twine", - actual = requirement("twine"), -) - -genrule( +py_binary( name = "selenium-release", srcs = [ - ":selenium-wheel", + "release-selenium.py", + ], + args = [ + "upload", + "$(location :selenium-wheel)", + "$(location :selenium-sdist)", + ], + data = [ ":selenium-sdist", + ":selenium-wheel", + ], + main = "release-selenium.py", + deps = [ + requirement("twine"), ], - outs = ["pypi_upload_complete.txt"], - cmd = "(twine upload $(location :selenium-wheel) $(location :selenium-sdist) && touch $@)", - tools = [":twine"], - tags = [ - "manual", - "requires-network", - ] ) compile_pip_requirements( diff --git a/py/release-selenium.py b/py/release-selenium.py new file mode 100644 index 0000000000000..82720af5c15c1 --- /dev/null +++ b/py/release-selenium.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import sys +from twine import cli + +def main(): + cli.configure_output() + return cli.dispatch(sys.argv[1:]) + +if __name__ == "__main__": + sys.exit(main())