Skip to content

Commit

Permalink
python313Packages.kivy: fix build (#372247)
Browse files Browse the repository at this point in the history
  • Loading branch information
misuzu authored Jan 9, 2025
2 parents 2c58d3f + b6c88e8 commit 3b8b554
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 24 deletions.
45 changes: 45 additions & 0 deletions pkgs/development/python-modules/kivy-garden-modernmenu/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
kivy,
}:

buildPythonPackage {
pname = "kivy-garden-modernmenu";
version = "0-unstable-2019-12-10";
pyproject = true;

src = fetchFromGitHub {
owner = "kivy-garden";
repo = "modernmenu";
rev = "681c3bf68b9ce2ebe653c2e6a9fcd2407bfe3e00";
hash = "sha256-0d4UhmRtuYwnYoZajjExavlvqkhGamiEQ8GjHWYnO88=";
};

strictDeps = true;

build-system = [
setuptools
];

checkInputs = [
kivy
];

pythonImportsCheck = [
"kivy_garden.modernmenu"
];

preInstallCheck = ''
export HOME=$PWD
'';

meta = {
description = "Stylized menu system for Kivy";
homepage = "https://github.com/kivy-garden/modernmenu";
license = lib.licenses.mit;
maintainers = lib.teams.ngi.members;
};
}
43 changes: 22 additions & 21 deletions pkgs/development/python-modules/kivy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,27 @@
buildPythonPackage,
fetchFromGitHub,
pkg-config,
cython_0,
cython,
docutils,
setuptools,
kivy-garden,
mtdev,
SDL2,
SDL2_image,
SDL2_ttf,
SDL2_mixer,
Accelerate,
ApplicationServices,
AVFoundation,
libcxx,
withGstreamer ? true,
gst_all_1,
packaging,
pillow,
pygments,
requests,
filetype,
}:

buildPythonPackage rec {
pname = "kivy";
version = "2.3.1";
pyproject = true;

src = fetchFromGitHub {
owner = "kivy";
Expand All @@ -35,10 +33,13 @@ buildPythonPackage rec {
hash = "sha256-q8BoF/pUTW2GMKBhNsqWDBto5+nASanWifS9AcNRc8Q=";
};

build-system = [
setuptools
cython
];

nativeBuildInputs = [
pkg-config
cython_0
docutils
];

buildInputs =
Expand All @@ -51,12 +52,6 @@ buildPythonPackage rec {
++ lib.optionals stdenv.hostPlatform.isLinux [
mtdev
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
Accelerate
ApplicationServices
AVFoundation
libcxx
]
++ lib.optionals withGstreamer (
with gst_all_1;
[
Expand All @@ -68,12 +63,12 @@ buildPythonPackage rec {
]
);

propagatedBuildInputs = [
dependencies = [
kivy-garden
packaging
pillow
docutils
pygments
requests
filetype
];

KIVY_NO_CONFIG = 1;
Expand All @@ -91,10 +86,16 @@ buildPythonPackage rec {
]
);

postPatch = lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace kivy/lib/mtdev.py \
--replace "LoadLibrary('libmtdev.so.1')" "LoadLibrary('${mtdev}/lib/libmtdev.so.1')"
'';
postPatch =
''
substituteInPlace pyproject.toml \
--replace-fail "setuptools~=69.2.0" "setuptools" \
--replace-fail "wheel~=0.44.0" "wheel"
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace kivy/lib/mtdev.py \
--replace-fail "LoadLibrary('libmtdev.so.1')" "LoadLibrary('${mtdev}/lib/libmtdev.so.1')"
'';

/*
We cannot run tests as Kivy tries to import itself before being fully
Expand Down
6 changes: 3 additions & 3 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6993,12 +6993,12 @@ self: super: with self; {

kitchen = callPackage ../development/python-modules/kitchen { };

kivy = callPackage ../development/python-modules/kivy {
inherit (pkgs.darwin.apple_sdk.frameworks) Accelerate ApplicationServices AVFoundation;
};
kivy = callPackage ../development/python-modules/kivy { };

kivy-garden = callPackage ../development/python-modules/kivy-garden { };

kivy-garden-modernmenu = callPackage ../development/python-modules/kivy-garden-modernmenu { };

kiwiki-client = callPackage ../development/python-modules/kiwiki-client { };

kiwisolver = callPackage ../development/python-modules/kiwisolver { };
Expand Down

0 comments on commit 3b8b554

Please sign in to comment.