Skip to content

Commit

Permalink
stdlib_list of multi python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
hunshcn committed May 16, 2024
1 parent 69355f0 commit c141085
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
14 changes: 13 additions & 1 deletion gazelle/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ bazel_dep(name = "rules_python", version = "0.18.0")
bazel_dep(name = "rules_go", version = "0.41.0", repo_name = "io_bazel_rules_go")
bazel_dep(name = "gazelle", version = "0.33.0", repo_name = "bazel_gazelle")

local_path_override(
module_name = "rules_python",
path = "..",
)

go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(
Expand All @@ -24,4 +29,11 @@ use_repo(
)

non_module_deps = use_extension("//:def.bzl", "non_module_deps")
use_repo(non_module_deps, "python_stdlib_list_3_11")
use_repo(
non_module_deps,
"python_stdlib_list_3_10",
"python_stdlib_list_3_11",
"python_stdlib_list_3_12",
"python_stdlib_list_3_8",
"python_stdlib_list_3_9",
)
24 changes: 24 additions & 0 deletions gazelle/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,36 @@ def go_repository(name, **kwargs):
_go_repository(name = name, **kwargs)

def python_stdlib_list_deps():
http_file(
name = "python_stdlib_list_3_8",
sha256 = "ee6dc367011ff298b906dbaab408940aa57086d5f8f47278f4b7523b9aa13ae3",
url = "https://raw.githubusercontent.com/pypi/stdlib-list/8cbc2067a4a0f9eee57fb541e4cd7727724b7db4/stdlib_list/lists/3.8.txt",
downloaded_file_path = "3.8.txt",
)
http_file(
name = "python_stdlib_list_3_9",
sha256 = "a4340e5ffe2e75bb18f548028cef6e6ac15384c44ae0a776e04dd869da1d1fd7",
url = "https://raw.githubusercontent.com/pypi/stdlib-list/8cbc2067a4a0f9eee57fb541e4cd7727724b7db4/stdlib_list/lists/3.9.txt",
downloaded_file_path = "3.9.txt",
)
http_file(
name = "python_stdlib_list_3_10",
sha256 = "0b867738b78ac98944237de2600093a1c6ef259d1810017e46f01a29f3d199e7",
url = "https://raw.githubusercontent.com/pypi/stdlib-list/8cbc2067a4a0f9eee57fb541e4cd7727724b7db4/stdlib_list/lists/3.10.txt",
downloaded_file_path = "3.10.txt",
)
http_file(
name = "python_stdlib_list_3_11",
sha256 = "3c1dbf991b17178d6ed3772f4fa8f64302feaf9c3385fef328a0c7ab736a79b1",
url = "https://raw.githubusercontent.com/pypi/stdlib-list/8cbc2067a4a0f9eee57fb541e4cd7727724b7db4/stdlib_list/lists/3.11.txt",
downloaded_file_path = "3.11.txt",
)
http_file(
name = "python_stdlib_list_3_12",
sha256 = "6d3d53194218b43ee1d04bf9a4f0b6a9309bb59cdcaddede7d9cfe8b6835d34a",
url = "https://raw.githubusercontent.com/pypi/stdlib-list/8cbc2067a4a0f9eee57fb541e4cd7727724b7db4/stdlib_list/lists/3.12.txt",
downloaded_file_path = "3.12.txt",
)

def gazelle_deps():
go_deps()
Expand Down
12 changes: 11 additions & 1 deletion gazelle/python/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,17 @@ go_library(

copy_file(
name = "stdlib_list",
src = "@python_stdlib_list_3_11//file",
src = select(
{
"@rules_python//python/config_settings:is_python_3.8": "@python_stdlib_list_3_8//file",
"@rules_python//python/config_settings:is_python_3.9": "@python_stdlib_list_3_9//file",
"@rules_python//python/config_settings:is_python_3.10": "@python_stdlib_list_3_10//file",
"@rules_python//python/config_settings:is_python_3.11": "@python_stdlib_list_3_11//file",
"@rules_python//python/config_settings:is_python_3.12": "@python_stdlib_list_3_12//file",
# This is the same behaviour as previously
"//conditions:default": "@python_stdlib_list_3_11//file",
},
),
out = "stdlib_list.txt",
allow_symlink = True,
)
Expand Down

0 comments on commit c141085

Please sign in to comment.