Skip to content

Commit

Permalink
Try workaround for setuptools bug
Browse files Browse the repository at this point in the history
  • Loading branch information
pitrou committed Dec 18, 2024
1 parent 3dbffc8 commit 83a76e3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ def initialize_options(self):
'_hdfs',
'gandiva']


def _run_cmake(self):
# check if build_type is correctly passed / set
if self.build_type.lower() not in ('release', 'debug',
Expand Down Expand Up @@ -268,7 +269,7 @@ def _run_cmake(self):
f'-DCMAKE_INSTALL_PREFIX={install_prefix}',
f'-DPYTHON_EXECUTABLE={sys.executable}',
f'-DPython3_EXECUTABLE={sys.executable}',
f'-DPYARROW_CXXFLAGS={self.cmake_cxxflags}',
f'-DPYARROW_CXXFLAGS={self._get_cxxflags()}',
]

def append_cmake_bool(value, varname):
Expand Down Expand Up @@ -367,6 +368,13 @@ def _get_cmake_ext_path(self, name):
filename = name + ext_suffix
return pjoin(self._get_build_dir(), filename)

def _get_cxxflags(self):
# Workaround for https://github.com/pypa/setuptools/issues/4662
cxxflags = self.cmake_cxxflags
if os.name == 'nt' and bool(sysconfig.get_config_var('Py_GIL_DISABLED')):
cxxflags += " -DPy_GIL_DISABLED=1"
return cxxflags

def get_ext_generated_cpp_source(self, name):
if sys.platform == 'win32':
head, tail = os.path.split(name)
Expand Down

0 comments on commit 83a76e3

Please sign in to comment.