Skip to content

Commit d24860f

Browse files
authored
fix: resolve editable installation issue for python package (#1989)
Before this `pip install -e .` produced ` error: [Errno 2] No such file or directory: '/tmp/tmpi02jtn4q.build-lib/google_benchmark/_benchmark.pyi'`
1 parent 0d52283 commit d24860f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ def bazel_build(self, ext: BazelExtension) -> None: # noqa: C901
131131
pkgname = "google_benchmark"
132132
pythonroot = Path("bindings") / "python" / "google_benchmark"
133133
srcdir = temp_path / "bazel-bin" / pythonroot
134-
libdir = Path(self.build_lib) / pkgname
134+
if not self.inplace:
135+
libdir = Path(self.build_lib) / pkgname
136+
else:
137+
build_py = self.get_finalized_command("build_py")
138+
libdir = build_py.get_package_dir(pkgname)
135139
for root, dirs, files in os.walk(srcdir, topdown=True):
136140
# exclude runfiles directories and children.
137141
dirs[:] = [d for d in dirs if "runfiles" not in d]

0 commit comments

Comments
 (0)