Merge pull request #121036 from eduardosm/sip-platform-tag
pythonPackages.sip_5: add `platform_tag` attribute
This commit is contained in:
commit
da63eb10bb
@ -1,5 +1,4 @@
|
|||||||
{ lib
|
{ lib
|
||||||
, stdenv
|
|
||||||
, mkDerivation
|
, mkDerivation
|
||||||
, fetchurl
|
, fetchurl
|
||||||
, poppler_utils
|
, poppler_utils
|
||||||
@ -42,18 +41,11 @@ mkDerivation rec {
|
|||||||
++ lib.optional (!unrarSupport) ./dont_build_unrar_plugin.patch;
|
++ lib.optional (!unrarSupport) ./dont_build_unrar_plugin.patch;
|
||||||
|
|
||||||
escaped_pyqt5_dir = builtins.replaceStrings ["/"] ["\\/"] (toString python3Packages.pyqt5);
|
escaped_pyqt5_dir = builtins.replaceStrings ["/"] ["\\/"] (toString python3Packages.pyqt5);
|
||||||
platform_tag =
|
|
||||||
if stdenv.hostPlatform.isDarwin then
|
|
||||||
"WS_MACX"
|
|
||||||
else if stdenv.hostPlatform.isWindows then
|
|
||||||
"WS_WIN"
|
|
||||||
else
|
|
||||||
"WS_X11";
|
|
||||||
|
|
||||||
prePatch = ''
|
prePatch = ''
|
||||||
sed -i "s/\[tool.sip.project\]/[tool.sip.project]\nsip-include-dirs = [\"${escaped_pyqt5_dir}\/share\/sip\/PyQt5\"]/g" \
|
sed -i "s/\[tool.sip.project\]/[tool.sip.project]\nsip-include-dirs = [\"${escaped_pyqt5_dir}\/share\/sip\/PyQt5\"]/g" \
|
||||||
setup/build.py
|
setup/build.py
|
||||||
sed -i "s/\[tool.sip.bindings.pictureflow\]/[tool.sip.bindings.pictureflow]\ntags = [\"${platform_tag}\"]/g" \
|
sed -i "s/\[tool.sip.bindings.pictureflow\]/[tool.sip.bindings.pictureflow]\ntags = [\"${python3Packages.sip_5.platform_tag}\"]/g" \
|
||||||
setup/build.py
|
setup/build.py
|
||||||
|
|
||||||
# Remove unneeded files and libs
|
# Remove unneeded files and libs
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ lib, fetchPypi, buildPythonPackage, packaging, toml }:
|
{ lib, stdenv, fetchPypi, buildPythonPackage, packaging, toml }:
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "sip";
|
pname = "sip";
|
||||||
@ -17,6 +17,20 @@ buildPythonPackage rec {
|
|||||||
|
|
||||||
pythonImportsCheck = [ "sipbuild" ];
|
pythonImportsCheck = [ "sipbuild" ];
|
||||||
|
|
||||||
|
# FIXME: Why isn't this detected automatically?
|
||||||
|
# Needs to be specified in pyproject.toml, e.g.:
|
||||||
|
# [tool.sip.bindings.MODULE]
|
||||||
|
# tags = [PLATFORM_TAG]
|
||||||
|
platform_tag =
|
||||||
|
if stdenv.targetPlatform.isLinux then
|
||||||
|
"WS_X11"
|
||||||
|
else if stdenv.targetPlatform.isDarwin then
|
||||||
|
"WS_MACX"
|
||||||
|
else if stdenv.targetPlatform.isWindows then
|
||||||
|
"WS_WIN"
|
||||||
|
else
|
||||||
|
throw "unsupported platform";
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Creates C++ bindings for Python modules";
|
description = "Creates C++ bindings for Python modules";
|
||||||
homepage = "http://www.riverbankcomputing.co.uk/";
|
homepage = "http://www.riverbankcomputing.co.uk/";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user