From bc5d961527885fdaa44c61d96170bf84f53d0169 Mon Sep 17 00:00:00 2001 From: Elliot Cameron Date: Wed, 28 Jan 2026 21:56:59 -0500 Subject: [PATCH] python313Packages.tkinter: fix nix-shell usage $NIX_BUILD_TOP was used inconsistently and the name of the Python source directory was assumed to have a certain pattern. These changes make the build work better in a nix-shell. --- .../python-modules/tkinter/default.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/tkinter/default.nix b/pkgs/development/python-modules/tkinter/default.nix index 233b2b2b0e4a..00f49beebf08 100644 --- a/pkgs/development/python-modules/tkinter/default.nix +++ b/pkgs/development/python-modules/tkinter/default.nix @@ -20,12 +20,14 @@ buildPythonPackage { src = python.src; prePatch = '' - mkdir $NIX_BUILD_TOP/tkinter + python_src=$PWD + tkinter_src=$PWD/../tkinter + mkdir -p "$tkinter_src" # copy the module bits and pieces from the python source - cp -v Modules/{_tkinter.c,tkinter.h} ../tkinter/ - cp -rv Modules/clinic ../tkinter/ - cp -rv Lib/tkinter ../tkinter/ + cp -v Modules/{_tkinter.c,tkinter.h} "$tkinter_src" + cp -rv Modules/clinic "$tkinter_src" + cp -rv Lib/tkinter "$tkinter_src" # install our custom pyproject.toml cp ${ @@ -33,11 +35,11 @@ buildPythonPackage { python_version = python.version; python_internal_dir = "${python}/include/${python.libPrefix}/internal"; } - } $NIX_BUILD_TOP/tkinter/pyproject.toml + } "$tkinter_src"/pyproject.toml '' + lib.optionalString (pythonOlder "3.13") '' - substituteInPlace "$NIX_BUILD_TOP/tkinter/tkinter/tix.py" --replace-fail \ + substituteInPlace "$tkinter_src/tkinter/tix.py" --replace-fail \ "os.environ.get('TIX_LIBRARY')" \ "os.environ.get('TIX_LIBRARY') or '${tclPackages.tix}/lib'" ''; @@ -46,7 +48,7 @@ buildPythonPackage { patches = lib.optional (pythonOlder "3.12") ./fix-ttk-notebook-test.patch; preConfigure = '' - pushd $NIX_BUILD_TOP/tkinter + cd "$tkinter_src" ''; build-system = [ setuptools ]; @@ -72,7 +74,7 @@ buildPythonPackage { nativeCheckInputs = lib.optional stdenv.hostPlatform.isLinux xvfb-run; preCheck = '' - cd $NIX_BUILD_TOP/Python-*/Lib + cd "$python_src"/Lib export HOME=$TMPDIR '';