Copilot commented on code in PR #7396:
URL: https://github.com/apache/ignite-3/pull/7396#discussion_r2686243220


##########
modules/platforms/python/setup.py:
##########
@@ -89,13 +89,15 @@ def build_extensions(self):
             ext_dir = 
os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
             cfg = 'Release'
             ext_file = 
os.path.splitext(os.path.basename(self.get_ext_filename(ext.name)))[0]
+            python_dir = os.path.dirname(sys.executable) if sys.executable 
else ""
 
             cmake_args = [
                 f'-DCMAKE_BUILD_TYPE={cfg}',
                 f'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{cfg.upper()}={ext_dir}',
                 
f'-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_{cfg.upper()}={self.build_temp}',
                 f'-DEXTENSION_FILENAME={ext_file}',
                 f'-DIGNITE_VERSION={cmake_project_version(version)}',
+                f'-DPython3_ROOT_DIR={python_dir}'
             ]

Review Comment:
   When sys.executable is None (which can occur in some edge cases), python_dir 
will be an empty string, resulting in -DPython3_ROOT_DIR= being passed to 
CMake. This could cause issues with CMake's find_package(Python3). Consider 
either validating that python_dir is not empty before proceeding, or 
conditionally including this CMake argument only when python_dir has a valid 
value (e.g., by appending it to cmake_args only if python_dir is truthy).
   ```suggestion
               ]
               if python_dir:
                   cmake_args.append(f'-DPython3_ROOT_DIR={python_dir}')
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to