2021-06-28 23:13:55 +00:00
|
|
|
{ lib
|
2022-09-22 12:36:57 +00:00
|
|
|
, stdenv
|
2021-06-28 23:13:55 +00:00
|
|
|
, buildPythonPackage
|
2022-09-30 11:47:45 +00:00
|
|
|
, setuptools
|
2021-06-28 23:13:55 +00:00
|
|
|
, isPy27
|
|
|
|
, fetchPypi
|
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, dbus
|
2021-06-28 23:13:55 +00:00
|
|
|
, lndir
|
|
|
|
, dbus-python
|
|
|
|
, sip
|
2024-01-25 14:12:00 +00:00
|
|
|
, pyqt5-sip
|
2021-06-28 23:13:55 +00:00
|
|
|
, pyqt-builder
|
|
|
|
, libsForQt5
|
2023-11-16 04:20:00 +00:00
|
|
|
, enableVerbose ? true
|
2021-06-28 23:13:55 +00:00
|
|
|
, withConnectivity ? false
|
|
|
|
, withMultimedia ? false
|
|
|
|
, withWebKit ? false
|
|
|
|
, withWebSockets ? false
|
2022-01-27 00:19:43 +00:00
|
|
|
, withLocation ? false
|
2023-07-15 17:15:38 +00:00
|
|
|
, withSerialPort ? false
|
|
|
|
, withTools ? false
|
2023-11-16 04:20:00 +00:00
|
|
|
, pkgsBuildTarget
|
|
|
|
, buildPackages
|
|
|
|
, dbusSupport ? !stdenv.isDarwin
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
buildPythonPackage rec {
|
2020-06-02 18:00:15 +00:00
|
|
|
pname = "PyQt5";
|
2023-03-04 12:14:45 +00:00
|
|
|
version = "5.15.9";
|
2021-06-28 23:13:55 +00:00
|
|
|
format = "pyproject";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
disabled = isPy27;
|
|
|
|
|
|
|
|
src = fetchPypi {
|
2020-06-02 18:00:15 +00:00
|
|
|
inherit pname version;
|
2023-03-04 12:14:45 +00:00
|
|
|
hash = "sha256-3EHoQBqQ3D4raStBG9VJKrVZrieidCTu1L05FVZOxMA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
patches = [
|
|
|
|
# Fix some wrong assumptions by ./project.py
|
|
|
|
# TODO: figure out how to send this upstream
|
|
|
|
./pyqt5-fix-dbus-mainloop-support.patch
|
2024-01-25 14:12:00 +00:00
|
|
|
# confirm license when installing via pyqt5-sip
|
2022-08-12 12:06:08 +00:00
|
|
|
./pyqt5-confirm-license.patch
|
|
|
|
];
|
|
|
|
|
2022-09-22 12:36:57 +00:00
|
|
|
postPatch =
|
2022-08-12 12:06:08 +00:00
|
|
|
# be more verbose
|
2022-09-22 12:36:57 +00:00
|
|
|
''
|
2022-08-12 12:06:08 +00:00
|
|
|
cat >> pyproject.toml <<EOF
|
2023-11-16 04:20:00 +00:00
|
|
|
'' + lib.optionalString enableVerbose ''
|
2022-08-12 12:06:08 +00:00
|
|
|
[tool.sip.project]
|
|
|
|
verbose = true
|
2022-09-22 12:36:57 +00:00
|
|
|
''
|
|
|
|
# Due to bug in SIP .whl name generation we have to bump minimal macos sdk upto 11.0 for
|
|
|
|
# aarch64-darwin. This patch can be removed once SIP will fix it in upstream,
|
|
|
|
# see https://github.com/NixOS/nixpkgs/pull/186612#issuecomment-1214635456.
|
|
|
|
+ lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
|
|
|
|
minimum-macos-version = "11.0"
|
|
|
|
'' + ''
|
2022-08-12 12:06:08 +00:00
|
|
|
EOF
|
2023-11-16 04:20:00 +00:00
|
|
|
''
|
|
|
|
|
|
|
|
# pyqt-builder tries to compile *and run* these programs. This
|
|
|
|
# is really sad because the only thing they do is print out a
|
|
|
|
# flag based on whether or not some compile-time symbol was
|
|
|
|
# defined. This could all be done without having to *execute*
|
|
|
|
# cross-compiled programs!
|
|
|
|
#
|
|
|
|
# Here is the complete list of things checked:
|
|
|
|
#
|
|
|
|
# QT_NO_PRINTDIALOG => PyQt_PrintDialog
|
|
|
|
# QT_NO_PRINTER => PyQt_Printer
|
|
|
|
# QT_NO_PRINTPREVIEWDIALOG => PyQt_PrintPreviewDialog
|
|
|
|
# QT_NO_PRINTPREVIEWWIDGET => PyQt_PrintPreviewWidget
|
|
|
|
# QT_NO_SSL => PyQt_SSL
|
|
|
|
# QT_SHARED || QT_DLL => shared (otherwise static)
|
|
|
|
# QT_NO_PROCESS => PyQt_Process
|
|
|
|
# QT_NO_FPU || Q_PROCESSOR_ARM || Q_OS_WINCE => PyQt_qreal_double
|
|
|
|
# sizeof (qreal) != sizeof (double) => PyQt_qreal_double
|
|
|
|
# !Q_COMPILER_CONSTEXPR !Q_COMPILER_UNIFORM_INIT => PyQt_CONSTEXPR
|
|
|
|
# QT_NO_ACCESSIBILITY => PyQt_Accessibility
|
|
|
|
# QT_NO_OPENGL => PyQt_OpenGL PyQt_Desktop_OpenGL
|
|
|
|
# defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_ES_3) => PyQt_Desktop_OpenGL
|
|
|
|
# QT_NO_RAWFONT => PyQt_RawFont
|
|
|
|
# QT_NO_SESSIONMANAGER => PyQt_SessionManager
|
|
|
|
#
|
|
|
|
+ lib.optionalString (!(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) ''
|
|
|
|
rm config-tests/cfgtest_QtCore.cpp
|
|
|
|
rm config-tests/cfgtest_QtGui.cpp
|
|
|
|
rm config-tests/cfgtest_QtNetwork.cpp
|
|
|
|
rm config-tests/cfgtest_QtPrintSupport.cpp
|
2022-08-12 12:06:08 +00:00
|
|
|
'';
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
# HACK: paralellize compilation of make calls within pyqt's setup.py
|
|
|
|
# pkgs/stdenv/generic/setup.sh doesn't set this for us because
|
|
|
|
# make gets called by python code and not its build phase
|
|
|
|
# format=pyproject means the pip-build-hook hook gets used to build this project
|
|
|
|
# pkgs/development/interpreters/python/hooks/pip-build-hook.sh
|
|
|
|
# does not use the enableParallelBuilding flag
|
|
|
|
postUnpack = ''
|
|
|
|
export MAKEFLAGS+="''${enableParallelBuilding:+-j$NIX_BUILD_CORES}"
|
|
|
|
'';
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
# tons of warnings from subpackages, no point in playing whack-a-mole
|
|
|
|
env = lib.optionalAttrs (!enableVerbose) {
|
|
|
|
NIX_CFLAGS_COMPILE = "-w";
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2021-02-19 19:06:45 +00:00
|
|
|
dontWrapQtApps = true;
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
nativeBuildInputs = [
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2023-11-16 04:20:00 +00:00
|
|
|
] ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [
|
|
|
|
libsForQt5.qmake
|
|
|
|
] ++ [
|
2022-09-30 11:47:45 +00:00
|
|
|
setuptools
|
2020-04-24 23:36:52 +00:00
|
|
|
lndir
|
|
|
|
sip
|
2023-11-16 04:20:00 +00:00
|
|
|
] ++ (with pkgsBuildTarget.targetPackages.libsForQt5; [
|
|
|
|
] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
|
|
|
|
qmake
|
|
|
|
] ++ [
|
2020-04-24 23:36:52 +00:00
|
|
|
qtbase
|
|
|
|
qtsvg
|
|
|
|
qtdeclarative
|
|
|
|
qtwebchannel
|
|
|
|
]
|
|
|
|
++ lib.optional withConnectivity qtconnectivity
|
|
|
|
++ lib.optional withMultimedia qtmultimedia
|
|
|
|
++ lib.optional withWebKit qtwebkit
|
|
|
|
++ lib.optional withWebSockets qtwebsockets
|
2022-01-27 00:19:43 +00:00
|
|
|
++ lib.optional withLocation qtlocation
|
2023-07-15 17:15:38 +00:00
|
|
|
++ lib.optional withSerialPort qtserialport
|
|
|
|
++ lib.optional withTools qttools
|
2023-11-16 04:20:00 +00:00
|
|
|
);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
buildInputs = with libsForQt5; [
|
2020-04-24 23:36:52 +00:00
|
|
|
dbus
|
2023-11-16 04:20:00 +00:00
|
|
|
] ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [
|
2020-04-24 23:36:52 +00:00
|
|
|
qtbase
|
2023-11-16 04:20:00 +00:00
|
|
|
] ++ [
|
2020-04-24 23:36:52 +00:00
|
|
|
qtsvg
|
|
|
|
qtdeclarative
|
2021-06-28 23:13:55 +00:00
|
|
|
pyqt-builder
|
2020-04-24 23:36:52 +00:00
|
|
|
]
|
|
|
|
++ lib.optional withConnectivity qtconnectivity
|
|
|
|
++ lib.optional withWebKit qtwebkit
|
|
|
|
++ lib.optional withWebSockets qtwebsockets
|
2022-01-27 00:19:43 +00:00
|
|
|
++ lib.optional withLocation qtlocation
|
2023-07-15 17:15:38 +00:00
|
|
|
++ lib.optional withSerialPort qtserialport
|
|
|
|
++ lib.optional withTools qttools
|
2020-04-24 23:36:52 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
dbus-python
|
2024-01-25 14:12:00 +00:00
|
|
|
pyqt5-sip
|
2021-06-28 23:13:55 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
passthru = {
|
2024-01-25 14:12:00 +00:00
|
|
|
inherit sip pyqt5-sip;
|
2020-04-24 23:36:52 +00:00
|
|
|
multimediaEnabled = withMultimedia;
|
|
|
|
webKitEnabled = withWebKit;
|
|
|
|
WebSocketsEnabled = withWebSockets;
|
2023-10-09 19:29:22 +00:00
|
|
|
connectivityEnabled = withConnectivity;
|
|
|
|
locationEnabled = withLocation;
|
|
|
|
serialPortEnabled = withSerialPort;
|
|
|
|
toolsEnabled = withTools;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
dontConfigure = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
# Checked using pythonImportsCheck
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"PyQt5"
|
|
|
|
"PyQt5.QtCore"
|
|
|
|
"PyQt5.QtQml"
|
|
|
|
"PyQt5.QtWidgets"
|
|
|
|
"PyQt5.QtGui"
|
|
|
|
]
|
2020-04-24 23:36:52 +00:00
|
|
|
++ lib.optional withWebSockets "PyQt5.QtWebSockets"
|
|
|
|
++ lib.optional withWebKit "PyQt5.QtWebKit"
|
|
|
|
++ lib.optional withMultimedia "PyQt5.QtMultimedia"
|
2023-05-24 13:37:59 +00:00
|
|
|
++ lib.optional withConnectivity "PyQt5.QtBluetooth"
|
2022-01-27 00:19:43 +00:00
|
|
|
++ lib.optional withLocation "PyQt5.QtPositioning"
|
2023-07-15 17:15:38 +00:00
|
|
|
++ lib.optional withSerialPort "PyQt5.QtSerialPort"
|
|
|
|
++ lib.optional withTools "PyQt5.QtDesigner"
|
2021-02-05 17:12:51 +00:00
|
|
|
;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python bindings for Qt5";
|
2021-06-28 23:13:55 +00:00
|
|
|
homepage = "https://riverbankcomputing.com/";
|
|
|
|
license = licenses.gpl3Only;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.mesaPlatforms;
|
|
|
|
maintainers = with maintainers; [ sander ];
|
|
|
|
};
|
|
|
|
}
|