Skip to content

Commit

Permalink
Update py toolchain and runfiles handling
Browse files Browse the repository at this point in the history
  • Loading branch information
lalten committed May 18, 2024
1 parent 02a7583 commit 7db2628
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 37 deletions.
41 changes: 12 additions & 29 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,16 @@ use_repo(

register_toolchains("//appimage:all")

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

_DEFAULT_PYTHON = "3.12"
python = use_extension("@rules_python//python/extensions:python.bzl", "python")

[
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 = "rules_appimage_py_deps",
python_version = python_version,
requirements_lock = "//:requirements.txt",
)
for python_version in PYTHON_VERSIONS
]

use_repo(pip, "rules_appimage_py_deps")
python.toolchain(is_default = True, python_version = _DEFAULT_PYTHON)
use_repo(python, "python_" + _DEFAULT_PYTHON.replace(".", "_"), "python_versions", "pythons_hub")
register_toolchains("@pythons_hub//:all")

dev_pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True)
dev_pip.parse(
hub_name = "rules_appimage_py_deps",
python_version = _DEFAULT_PYTHON,
requirements_lock = "//:requirements.txt",
)
use_repo(dev_pip, "rules_appimage_py_deps")
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ py_repositories()

python_register_toolchains(
name = "rules_appimage_python",
python_version = "3.11",
python_version = "3.12",
)

load("@rules_appimage_python//:defs.bzl", rules_appimage_py_interpreter = "interpreter")
Expand Down
3 changes: 1 addition & 2 deletions appimage/private/tool/BUILD
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
load("@rules_appimage_py_deps//:requirements.bzl", "requirement")
load("@rules_python//python:defs.bzl", "py_binary", "py_library")

py_library(
name = "mkappimage",
srcs = ["mkappimage.py"],
data = ["@squashfs-tools//:mksquashfs"],
visibility = ["//visibility:public"],
deps = [requirement("bazel-runfiles")],
deps = ["@rules_python//python/runfiles"],
)

py_binary(
Expand Down
2 changes: 1 addition & 1 deletion appimage/private/tool/mkappimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from pathlib import Path
from typing import Iterable, NamedTuple

import runfiles as bazel_runfiles
from python import runfiles as bazel_runfiles

_ManifestDataT = dict[str, list[str | dict[str, str]]]

Expand Down
1 change: 0 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
bazel-runfiles==0.31.0
pytest==8.1.1
3 changes: 0 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#
# bazel run //:requirements.update
#
bazel-runfiles==0.32.2 \
--hash=sha256:2ed5cc73da6a44dff127105dacdbbd7632fde4eaf30f11d5ec1521f80d26d8fd
# via -r requirements.in
iniconfig==2.0.0 \
--hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \
--hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374
Expand Down

0 comments on commit 7db2628

Please sign in to comment.