File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 3434ENABLE_SPARSE = os .getenv ("ENABLE_SPARSE" )
3535
3636
37- def _enable_sparse () -> bool :
37+ def enable_sparse () -> bool :
3838 return ENABLE_SPARSE is not None and ENABLE_SPARSE .lower () == "true"
3939
4040
41+ def is_editable_mode () -> bool :
42+ commands = [arg .lower () for arg in sys .argv ]
43+ return "develop" in commands or "--editable" in commands or "-e" in commands
44+
45+
4146class CMakeExtension (Extension ):
4247 def __init__ (self , name : str , source_dir : str = "" ):
4348 super ().__init__ (name , sources = [])
@@ -55,14 +60,16 @@ def run(self):
5560 def build_cmake (self , ext : CMakeExtension ):
5661 build_dir = os .path .abspath (self .build_temp )
5762 install_dir = os .path .abspath (self .build_lib )
63+ if is_editable_mode :
64+ install_dir = ext .cmake_file_path
5865
5966 cmake_args = [
6067 "-DCMAKE_BUILD_TYPE=Release" ,
6168 f"-DPYTHON_EXECUTABLE={ sys .executable } " ,
6269 f"-DCMAKE_INSTALL_PREFIX={ install_dir } " ,
6370 ]
6471
65- if _enable_sparse ():
72+ if enable_sparse ():
6673 cmake_args += ["-DBUILD_UCM_SPARSE=ON" ]
6774
6875 match PLATFORM :
You can’t perform that action at this time.
0 commit comments