@@ -167,64 +167,6 @@ class BuildExt(build_ext):
167167 """A custom build extension for adding compiler-specific options."""
168168
169169 def build_extensions (self ):
170- # Determine which compiler to use, if CC and CXX env exist, use them
171- if os .environ .get ("CC" ) is not None and os .environ .get ("CXX" ) is not None :
172- print ("Using CC and CXX from env" )
173- print ("CC: " + os .environ .get ("CC" ))
174- print ("CXX: " + os .environ .get ("CXX" ))
175- if sys .platform == "darwin" :
176- try :
177- brew_prefix = (
178- subprocess .check_output ("brew --prefix" , shell = True )
179- .decode ("utf-8" )
180- .strip ("\n " )
181- )
182- except Exception :
183- raise RuntimeError ("Must install brew" )
184- if (
185- os .system ("which " + brew_prefix + "/opt/llvm/bin/clang++ > /dev/null" )
186- == 0
187- ):
188- os .environ ["CC" ] = brew_prefix + "/opt/llvm/bin/clang"
189- os .environ ["CXX" ] = brew_prefix + "/opt/llvm/bin/clang++"
190- elif (
191- os .system (
192- "which " + brew_prefix + "/opt/llvm@15/bin/clang++ > /dev/null"
193- )
194- == 0
195- ):
196- os .environ ["CC" ] = brew_prefix + "/opt/llvm@15/bin/clang"
197- os .environ ["CXX" ] = brew_prefix + "/opt/llvm@15/bin/clang++"
198- else :
199- raise RuntimeError ("Must use brew clang++" )
200- elif sys .platform == "linux" :
201- pass
202- # os.environ['CC'] = 'clang-15'
203- # os.environ['CXX'] = 'clang++-15'
204- else :
205- raise RuntimeError ("Unsupported platform" )
206-
207- # exec chdb/build.sh and print the output if it fails
208- # Run the build script and capture its output
209- # if macOS and arch is arm64, run with arch -arm64 /bin/bash
210- if sys .platform == "darwin" and os .uname ().machine == "arm64" :
211- completed_process = subprocess .run (
212- ["arch" , "-arm64" , "/bin/bash" , "chdb/build.sh" ],
213- capture_output = True ,
214- text = True ,
215- )
216- else :
217- completed_process = subprocess .run (
218- ["bash" , "chdb/build.sh" ], capture_output = True , text = True
219- )
220- # If it failed, print the output
221- print (completed_process .stdout )
222- print (completed_process .stderr )
223-
224- # Check the return code to see if the script failed
225- if completed_process .returncode != 0 :
226- raise RuntimeError ("Build failed" )
227-
228170 # add the _chdb.cpython-37m-darwin.so or _chdb.cpython-39-x86_64-linux.so to the chdb package
229171 self .distribution .package_data ["chdb" ] = [
230172 "chdb/_chdb" + get_python_ext_suffix ()
0 commit comments