Skip to content

Commit

Permalink
use bazel-runfiles instead of accessing runfiles from rules_python
Browse files Browse the repository at this point in the history
  • Loading branch information
shabanzd authored and lalten committed Nov 20, 2023
1 parent f6d84b8 commit b64732f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions appimage/private/tool/BUILD
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
load("@rules_appimage_py_deps//:requirements.bzl", "requirement")


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

py_binary(
name = "tool",
Expand Down
4 changes: 2 additions & 2 deletions appimage/private/tool/mkappimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
from pathlib import Path
from typing import Dict, Iterable, List, NamedTuple, Optional, Tuple

import rules_python.python.runfiles.runfiles
import runfiles as bazel_runfiles


def _get_path_or_raise(path: str) -> Path:
"""Return a Path to a file in the runfiles, or raise FileNotFoundError."""
runfiles = rules_python.python.runfiles.runfiles.Create()
runfiles = bazel_runfiles.Create()
if not runfiles:
raise FileNotFoundError("Could not find runfiles")
runfile = runfiles.Rlocation(path)
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bazel-runfiles==0.27.0
pytest==7.4.3
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#
# bazel run //:requirements.update
#
bazel-runfiles==0.27.0 \
--hash=sha256:ff2081001e27085a4c57bb828202603d3f3c349d3e9683c44aedf02836e8deab
# via -r requirements.in
iniconfig==2.0.0 \
--hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \
--hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374
Expand Down

0 comments on commit b64732f

Please sign in to comment.