Skip to content

Conversation

@greggdonovan
Copy link

Summary:

  • Switch Python setup scripts to use setuptools instead of stdlib distutils (Python 3.12 removed distutils).
  • Use setuptools._distutils errors for build_ext error handling when available.
  • Guard ntohll/htonll definitions in lib/py/src/ext/endian.h to avoid macOS macro collisions that break C++ builds.

Why:

  • Python 3.12 no longer ships distutils, causing thrift builds from sdist to fail during wheel build.
  • On macOS, system headers define ntohll/htonll macros; the local inline definitions collided, causing compilation failures.

Validation:

  • Built a wheel from lib/py with Python 3.12 successfully after the changes.

try:
from setuptools import setup, Extension
except:
from distutils.core import setup, Extension, Command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we keep this (but remove Command, looks like that's unused) as fallback for earlier versions of python? (although I'm not familiar of what scenario will have no setuptools but distutils)

try:
from setuptools import setup, Extension
except Exception:
from distutils.core import setup, Extension
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question here regarding fallback to earlier versions of python

from distutils.command.build_ext import build_ext
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext
from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here we are still using distutils?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants