Skip to content

Commit 5046929

Browse files
committed
[Python] Fix setup.py for inplace build (apache#16214)
Previously, `python/setup.py` missed to take the inplace build case into account when doing file operations (such as finding paths or copying files), which makes command `make cython` fail. This PR fixes the issue by checking inplace builds.
1 parent cfa9d7c commit 5046929

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

python/setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
CURRENT_DIR = os.path.dirname(__file__)
3737
FFI_MODE = os.environ.get("TVM_FFI", "auto")
3838
CONDA_BUILD = os.getenv("CONDA_BUILD") is not None
39+
INPLACE_BUILD = "--inplace" in sys.argv
3940

4041

4142
def get_lib_path():
@@ -46,7 +47,7 @@ def get_lib_path():
4647
libinfo = {"__file__": libinfo_py}
4748
exec(compile(open(libinfo_py, "rb").read(), libinfo_py, "exec"), libinfo, libinfo)
4849
version = libinfo["__version__"]
49-
if not CONDA_BUILD:
50+
if not CONDA_BUILD and not INPLACE_BUILD:
5051
lib_path = libinfo["find_lib_path"]()
5152
libs = [lib_path[0]]
5253
if "runtime" not in libs[0]:
@@ -214,7 +215,7 @@ def is_pure(self):
214215

215216

216217
setup_kwargs = {}
217-
if not CONDA_BUILD:
218+
if not CONDA_BUILD and not INPLACE_BUILD:
218219
with open("MANIFEST.in", "w") as fo:
219220
for path in LIB_LIST:
220221
if os.path.isfile(path):
@@ -286,7 +287,7 @@ def long_description_contents():
286287
)
287288

288289

289-
if not CONDA_BUILD:
290+
if not CONDA_BUILD and not INPLACE_BUILD:
290291
# Wheel cleanup
291292
os.remove("MANIFEST.in")
292293
for path in LIB_LIST:

0 commit comments

Comments
 (0)