[ 
https://issues.apache.org/jira/browse/THRIFT-6067?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jens Geyer resolved THRIFT-6067.
--------------------------------
      Assignee: Vikrant Puppala
    Resolution: Fixed

> Python: pip install fails on setuptools < 69 due to sys.exit() in setup.py 
> (PEP 517 build backend)
> --------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-6067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-6067
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Library
>    Affects Versions: 0.23.0
>            Reporter: Vikrant Puppala
>            Assignee: Vikrant Puppala
>            Priority: Major
>             Fix For: 0.24.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> thrift ships sdist-only (no wheels on PyPI for any version), so every install 
> builds lib/py/setup.py via pip's PEP 517 in-process backend.
> setup.py calls sys.exit(0) on its build success paths. setuptools' 
> build_meta.run_setup() executes setup.py with exec(). On setuptools < 69 the 
> resulting SystemExit propagates and terminates the build-backend subprocess 
> before it writes the result file pip expects:
>       ERROR: Could not install packages due to an OSError:
>       [Errno 2] No such file or directory: '.../output.json'
> setuptools >= 69 added a try/except SystemExit in run_setup that swallows 
> exit code 0 (emitting a SetuptoolsDeprecationWarning advising against 
> sys.exit() in setup.py; see 
> https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html). So the 
> failure only manifests on older toolchains.
> Impact: any environment shipping setuptools < 69 cannot install thrift 
> 0.23.0. This broke installs on long-lived runtime images that bundle 
> setuptools 68.
> Origin: the sys.exit() calls were introduced incidentally in commit a715bdff 
> (PR #3330, "THRIFT-5923: UUID python", 2025-10-30) with no rationale in the 
> commit message, PR description, or review comments. The setup.py prior to 
> that commit used plain try/except control flow with no sys.exit() and built 
> correctly on all setuptools versions.
> Fix: restore the pre-#3330 control flow (try the C-extension build; on 
> BuildFailed, fall back to the pure-Python build; let any remaining failure 
> propagate). No sys.exit() in setup.py. Behavior for consumers is unchanged.
> PR: https://github.com/apache/thrift/pull/3584
> Related: THRIFT-5915 / PR #3007 (distutils -> setuptools migration).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to