diff --git a/doc/release-notes/rl-2511.section.md b/doc/release-notes/rl-2511.section.md index 06a9af3df4192..41138863701c5 100644 --- a/doc/release-notes/rl-2511.section.md +++ b/doc/release-notes/rl-2511.section.md @@ -50,6 +50,8 @@ - `gnome-keyring` no longer ships with an SSH agent anymore because it has been deprecated upstream. You should use `gcr_4` instead, which provides the same features. More information on why this was done can be found on [the relevant GCR upstream PR](https://gitlab.gnome.org/GNOME/gcr/-/merge_requests/67). +- `python3Full` and its versioned attributes (python3xxFull) have been removed. Bluetooth support is now enabled in the default python3 attributes. The X11 support built the tkinter module, which is available as a dedicated attribute on the package set. + - `stdenv.mkDerivation` and other derivation builders that use it no longer allow the value of `env` to be anything but an attribute set, for the purpose of setting environment variables that are available to the [builder](https://nix.dev/manual/nix/latest/store/derivation/#builder) process. An environment variable called `env` can still be provided by means of `mkDerivation { env.env = ...; }`, though we recommend to use a more specific name than "env". - The default Android NDK version has been raised to 27, and the default SDK version to 35. diff --git a/pkgs/by-name/bl/bluez-headers/package.nix b/pkgs/by-name/bl/bluez-headers/package.nix new file mode 100644 index 0000000000000..e9ee013982e53 --- /dev/null +++ b/pkgs/by-name/bl/bluez-headers/package.nix @@ -0,0 +1,44 @@ +{ + lib, + stdenv, + fetchurl, +}: + +# This package only provides the bluetooth headers from the bluez package +# for consumption in Python, which cannot consume bluez.dev due to multiple +# infinite recursion paths. + +stdenv.mkDerivation (finalAttrs: { + pname = "bluez-headers"; + version = "5.83"; + + # This package has the source, because of the emulatorAvailable check in the + # bluez function args, that causes an infinite recursion with Python on cross + # builds. + src = fetchurl { + url = "mirror://kernel/linux/bluetooth/bluez-${finalAttrs.version}.tar.xz"; + hash = "sha256-EIUi2QnSIFgTmb/sk9qrYgNVOc7vPdo+eZcHhcY70kw="; + }; + + dontConfigure = true; + dontBuild = true; + + installPhase = '' + mkdir -p $out/include/bluetooth + cp -v lib/*.h "$out/include/bluetooth/" + ''; + + meta = { + homepage = "https://www.bluez.org/"; + description = "Official Linux Bluetooth protocol stack"; + changelog = "https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/ChangeLog?h=${finalAttrs.version}"; + license = with lib.licenses; [ + bsd2 + gpl2Plus + lgpl21Plus + mit + ]; + maintainers = with lib.maintainers; [ ]; + platforms = lib.platforms.linux; + }; +}) diff --git a/pkgs/by-name/bl/bluez/package.nix b/pkgs/by-name/bl/bluez/package.nix index 7b11f0fefbec2..8228902a3c383 100644 --- a/pkgs/by-name/bl/bluez/package.nix +++ b/pkgs/by-name/bl/bluez/package.nix @@ -3,6 +3,7 @@ stdenv, alsa-lib, autoreconfHook, + bluez-headers, dbus, docutils, ell, @@ -28,12 +29,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "bluez"; - version = "5.83"; - - src = fetchurl { - url = "mirror://kernel/linux/bluetooth/bluez-${finalAttrs.version}.tar.xz"; - hash = "sha256-EIUi2QnSIFgTmb/sk9qrYgNVOc7vPdo+eZcHhcY70kw="; - }; + inherit (bluez-headers) version src; patches = [ (fetchurl { @@ -186,18 +182,7 @@ stdenv.mkDerivation (finalAttrs: { url = "https://git.kernel.org/pub/scm/bluetooth/bluez.git"; }; - meta = { - homepage = "https://www.bluez.org/"; - description = "Official Linux Bluetooth protocol stack"; - changelog = "https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/ChangeLog?h=${finalAttrs.version}"; - license = with lib.licenses; [ - bsd2 - gpl2Plus - lgpl21Plus - mit - ]; + meta = bluez-headers.meta // { mainProgram = "btinfo"; - maintainers = with lib.maintainers; [ ]; - platforms = lib.platforms.linux; }; }) diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 083c33cee8385..0b2a3e1a59d8d 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -38,8 +38,8 @@ windows, # optional dependencies - bluezSupport ? false, - bluez, + bluezSupport ? !withMinimalDeps && stdenv.hostPlatform.isLinux, + bluez-headers, mimetypesSupport ? !withMinimalDeps, mailcap, tzdata, @@ -47,12 +47,6 @@ gdbm, withReadline ? !withMinimalDeps && !stdenv.hostPlatform.isWindows, readline, - x11Support ? false, - tcl, - tk, - tclPackages, - libX11, - xorgproto, # splicing/cross pythonAttr ? "python${sourceVersion.major}${sourceVersion.minor}", @@ -114,10 +108,6 @@ # cgit) that are needed here should be included directly in Nixpkgs as # files. -assert x11Support -> tcl != null && tk != null && xorgproto != null && libX11 != null; - -assert bluezSupport -> bluez != null; - assert lib.assertMsg ( enableFramework -> stdenv.hostPlatform.isDarwin ) "Framework builds are only supported on Darwin."; @@ -163,8 +153,7 @@ let passthru = let # When we override the interpreter we also need to override the spliced versions of the interpreter - # bluez is excluded manually to break an infinite recursion. - inputs' = lib.filterAttrs (n: v: n != "bluez" && n != "passthruFun" && !lib.isDerivation v) inputs; + inputs' = lib.filterAttrs (n: v: n != "passthruFun" && !lib.isDerivation v) inputs; # Memoization of the splices to avoid re-evaluating this function for all combinations of splices e.g. # python3.pythonOnBuildForHost.pythonOnBuildForTarget == python3.pythonOnBuildForTarget by consuming # __splices as an arg and using the cache if populated. @@ -265,7 +254,7 @@ let zstd ] ++ optionals bluezSupport [ - bluez + bluez-headers ] ++ optionals stdenv.hostPlatform.isMinGW [ windows.dlfcn @@ -280,12 +269,6 @@ let ++ optionals withReadline [ readline ] - ++ optionals x11Support [ - libX11 - tcl - tk - xorgproto - ] ); hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); @@ -446,11 +429,6 @@ stdenv.mkDerivation (finalAttrs: { + optionalString mimetypesSupport '' substituteInPlace Lib/mimetypes.py \ --replace-fail "@mime-types@" "${mailcap}" - '' - + optionalString (pythonOlder "3.13" && x11Support && ((tclPackages.tix or null) != null)) '' - substituteInPlace "Lib/tkinter/tix.py" --replace-fail \ - "os.environ.get('TIX_LIBRARY')" \ - "os.environ.get('TIX_LIBRARY') or '${tclPackages.tix}/lib'" ''; env = { @@ -581,10 +559,6 @@ stdenv.mkDerivation (finalAttrs: { if stdenv.hostPlatform.isAarch64 then "uint128" else "x64" }' '' - + optionalString (stdenv.hostPlatform.isDarwin && x11Support && pythonAtLeast "3.11") '' - export TCLTK_LIBS="-L${tcl}/lib -L${tk}/lib -l${tcl.libPrefix} -l${tk.libPrefix}" - export TCLTK_CFLAGS="-I${tcl}/include -I${tk}/include" - '' + optionalString stdenv.hostPlatform.isWindows '' export NIX_CFLAGS_COMPILE+=" -Wno-error=incompatible-pointer-types" '' diff --git a/pkgs/development/python-modules/tkinter/default.nix b/pkgs/development/python-modules/tkinter/default.nix index f1fe4d1a0b252..afc6d765a4986 100644 --- a/pkgs/development/python-modules/tkinter/default.nix +++ b/pkgs/development/python-modules/tkinter/default.nix @@ -1,34 +1,91 @@ { lib, - stdenv, buildPythonPackage, + replaceVars, + setuptools, python, - py, - isPyPy, + pythonOlder, + tcl, + tclPackages, + tk, + tkinter, + xvfb-run, }: buildPythonPackage { pname = "tkinter"; version = python.version; - src = py; - format = "other"; - - # tkinter is included in PyPy, making this package a no-op. - installPhase = lib.optionalString (!isPyPy) ( - '' - # Move the tkinter module - mkdir -p $out/${py.sitePackages} - mv lib/${py.libPrefix}/lib-dynload/_tkinter* $out/${py.sitePackages}/ - '' - + lib.optionalString (!stdenv.hostPlatform.isDarwin) '' - # Update the rpath to point to python without x11Support - old_rpath=$(patchelf --print-rpath $out/${py.sitePackages}/_tkinter*) - new_rpath=$(sed "s#${py}#${python}#g" <<< "$old_rpath" ) - patchelf --set-rpath $new_rpath $out/${py.sitePackages}/_tkinter* - '' - ); - - meta = py.meta // { + pyproject = true; + + src = python.src; + + prePatch = '' + mkdir $NIX_BUILD_TOP/tkinter + + # 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/ + + pushd $NIX_BUILD_TOP/tkinter + + # install our custom pyproject.toml + cp ${ + replaceVars ./pyproject.toml { + python_version = python.version; + python_internal_dir = "${python}/include/${python.libPrefix}/internal"; + } + } ./pyproject.toml + + '' + + lib.optionalString (pythonOlder "3.13") '' + substituteInPlace "tkinter/tix.py" --replace-fail \ + "os.environ.get('TIX_LIBRARY')" \ + "os.environ.get('TIX_LIBRARY') or '${tclPackages.tix}/lib'" + ''; + + build-system = [ setuptools ]; + + buildInputs = [ + tcl + tk + ]; + + env = { + TCLTK_LIBS = toString [ + "-L${lib.getLib tcl}/lib" + "-L${lib.getLib tk}/lib" + "-l${tcl.libPrefix}" + "-l${tk.libPrefix}" + ]; + TCLTK_CFLAGS = toString [ + "-I${lib.getDev tcl}/include" + "-I${lib.getDev tk}/include" + ]; + }; + + doCheck = false; + + nativeCheckInputs = [ xvfb-run ]; + + preCheck = '' + cd $NIX_BUILD_TOP/Python-*/Lib + export HOME=$TMPDIR + ''; + + checkPhase = '' + runHook preCheck + xvfb-run -w 10 -s "-screen 0 1920x1080x24" \ + python -m unittest test.test_tkinter + + runHook postCheck + ''; + + passthru.tests.unittests = tkinter.overridePythonAttrs { doCheck = true; }; + + pythonImportsCheck = [ "tkinter" ]; + + meta = { # Based on first sentence from https://docs.python.org/3/library/tkinter.html description = "Standard Python interface to the Tcl/Tk GUI toolkit"; longDescription = '' @@ -52,5 +109,10 @@ buildPythonPackage { these additions and changes, and refer to the official Tcl/Tk documentation for details that are unchanged. ''; + homepage = "https://docs.python.org/3/library/tkinter.html"; + inherit (python.meta) + license + maintainers + ; }; } diff --git a/pkgs/development/python-modules/tkinter/pyproject.toml b/pkgs/development/python-modules/tkinter/pyproject.toml new file mode 100644 index 0000000000000..770331a7ef4f5 --- /dev/null +++ b/pkgs/development/python-modules/tkinter/pyproject.toml @@ -0,0 +1,16 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "tkinter" +version = "@python_version@" +description = "Tkinter." +requires-python = ">=@python_version@" + +[tool.setuptools] +packages = ["tkinter"] +ext-modules = [ + { name = "_tkinter", sources = ["_tkinter.c"], libraries = ["tcl9.0", "tcl9tk9.0"], include-dirs = ["@python_internal_dir@/"] } +] + diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 8183554c6803a..be16e2f86ef9e 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1985,6 +1985,12 @@ mapAliases { python = python2; # Added 2022-01-11 python-swiftclient = throw "'python-swiftclient' has been renamed to/replaced by 'swiftclient'"; # Converted to throw 2024-10-17 pythonFull = python2Full; # Added 2022-01-11 + python3Full = throw "python3Full has been removed. Bluetooth support is now enabled by default. The tkinter package is available within the package set."; + python310Full = throw "python310Full has been removed. Bluetooth support is now enabled by default. The tkinter package is available within the package set."; + python311Full = throw "python311Full has been removed. Bluetooth support is now enabled by default. The tkinter package is available within the package set."; + python312Full = throw "python312Full has been removed. Bluetooth support is now enabled by default. The tkinter package is available within the package set."; + python313Full = throw "python313Full has been removed. Bluetooth support is now enabled by default. The tkinter package is available within the package set."; + python314Full = throw "python314Full has been removed. Bluetooth support is now enabled by default. The tkinter package is available within the package set."; pythonPackages = python.pkgs; # Added 2022-01-11 pypy39 = throw "pypy 3.9 has been removed, use pypy 3.10 instead"; # Added 2025-01-03 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6b877a611f968..3db91d436627a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6202,42 +6202,6 @@ with pkgs; pythonAttr = "python27Full"; x11Support = true; }; - python3Full = python3.override { - self = python3Full; - pythonAttr = "python3Full"; - bluezSupport = lib.meta.availableOn stdenv.hostPlatform bluez; - x11Support = true; - }; - python310Full = python310.override { - self = python310Full; - pythonAttr = "python310Full"; - bluezSupport = lib.meta.availableOn stdenv.hostPlatform bluez; - x11Support = true; - }; - python311Full = python311.override { - self = python311Full; - pythonAttr = "python311Full"; - bluezSupport = lib.meta.availableOn stdenv.hostPlatform bluez; - x11Support = true; - }; - python312Full = python312.override { - self = python312Full; - pythonAttr = "python312Full"; - bluezSupport = lib.meta.availableOn stdenv.hostPlatform bluez; - x11Support = true; - }; - python313Full = python313.override { - self = python313Full; - pythonAttr = "python313Full"; - bluezSupport = lib.meta.availableOn stdenv.hostPlatform bluez; - x11Support = true; - }; - python314Full = python314.override { - self = python314Full; - pythonAttr = "python314Full"; - bluezSupport = lib.meta.availableOn stdenv.hostPlatform bluez; - x11Support = true; - }; # https://py-free-threading.github.io python313FreeThreading = python313.override { @@ -15668,10 +15632,6 @@ with pkgs; flutter = flutter324; }; - openfreebuds = callPackage ../by-name/op/openfreebuds/package.nix { - python3Packages = python3Full.pkgs; - }; - davis = callPackage ../by-name/da/davis/package.nix { php = php83; # https://github.com/tchapi/davis/issues/195 }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 50e54ac9c3abd..e301ac57187df 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -18290,9 +18290,14 @@ self: super: with self; { tivars = callPackage ../development/python-modules/tivars { }; - tkinter = callPackage ../development/python-modules/tkinter { - py = python.override (lib.optionalAttrs (!python.isPyPy) { x11Support = true; }); - }; + tkinter = + if isPyPy then + null + else + callPackage ../development/python-modules/tkinter { + tcl = pkgs.tcl-9_0; + tk = pkgs.tk-9_0; + }; tkinter-gl = callPackage ../development/python-modules/tkinter-gl { };