Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3Packages.thrift: Fix python 3.12 support #328246

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions pkgs/development/python-modules/thrift/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
lib,
buildPythonPackage,
fetchPypi,
pythonAtLeast,
pythonOlder,
setuptools,
six,
python,
}:

buildPythonPackage rec {
Expand All @@ -14,13 +14,25 @@ buildPythonPackage rec {
pyproject = true;

# Still uses distutils
disabled = pythonOlder "3.7" || pythonAtLeast "3.12";
disabled = pythonOlder "3.7";

src = fetchPypi {
inherit pname version;
hash = "sha256-TdZi6t9riuvopBcpUnvWmt9s6qKoaBy+9k0Sc7Po/ro=";
};

preBuild = ''
# Fix so distutils is available in build prosess.
# Function setuptools/_distutils/util.py:byte_compile is used in build prosess
# but setuptools distutils import trick/hack is not working in build prosses
# and we get ModuleNotfoundError 'No module named 'distutils'
# For more explanation see first attempt:
# https://github.com/NixOS/nixpkgs/pull/328182
DISTUTILS=$(mktemp -d)
ln -s ${setuptools}/${python.sitePackages}/setuptools/_distutils "$DISTUTILS/distutils"
PYTHONPATH="$PYTHONPATH:$DISTUTILS"
'';

build-system = [ setuptools ];

dependencies = [ six ];
Expand Down