Skip to content

Commit

Permalink
Add support for multiple python versions
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Dec 20, 2024
1 parent a21a02e commit a6d30be
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
34 changes: 26 additions & 8 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,33 @@ bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_python", version = "0.40.0")

PYTHON_VERSIONS = [
"3.8",
"3.9",
"3.10",
"3.11",
"3.12",
]

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
python_version = "3.11",
)

[
python.toolchain(
is_default = python_version == PYTHON_VERSIONS[-1],
python_version = python_version,
)
for python_version in PYTHON_VERSIONS
]

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "xacro_python_dependencies",
python_version = "3.11",
requirements_lock = "//bazel:requirements_lock.txt",
)

[
pip.parse(
hub_name = "xacro_python_dependencies",
python_version = python_version,
requirements_lock = "//bazel:requirements_lock.txt",
)
for python_version in PYTHON_VERSIONS
]

use_repo(pip, "xacro_python_dependencies")
2 changes: 1 addition & 1 deletion bazel/requirements_lock.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# bazel run //bazel:requirements.update
Expand Down

0 comments on commit a6d30be

Please sign in to comment.