Skip to content

Commit 9781490

Browse files
committed
Update runfiles to support non-bazel environments (e.g. pip)
1 parent a2d4240 commit 9781490

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

mesop/utils/runfiles.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,10 @@
33

44
def get_runfile_location(identifier: str) -> str:
55
"""Use this wrapper to retrieve a runfile because this util is replaced in downstream sync."""
6+
7+
# runfiles doesn't exist when running outside of bazel (e.g. pip install)
8+
if runfiles.Create() is None: # type: ignore
9+
# TODO: make this less brittle and don't hard code "../", instead walk up
10+
# to the "mesop" directory.
11+
return "../" + identifier[len("mesop/mesop/") :]
612
return runfiles.Create().Rlocation(identifier) # type: ignore

0 commit comments

Comments
 (0)