Skip to content

Commit

Permalink
pyside: fix on Python 3.x, closes #25328
Browse files Browse the repository at this point in the history
Pyside requires several tools that do not provide Python modules. They
therefore do not need to be build Python-version dependent and so we
move them out of `python-packages.nix`.

Furthermore, shiboken needs libxml2 and libxslt libraries but not their
Python bindings.
  • Loading branch information
FRidh committed Apr 30, 2017
1 parent d729a25 commit a4aaf5a
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 27 deletions.
9 changes: 6 additions & 3 deletions pkgs/development/python-modules/pyside/apiextractor.nix
@@ -1,6 +1,9 @@
{ stdenv, fetchurl, cmake, libxml2, libxslt, python, sphinx, qt4 }:
{ stdenv, fetchurl, cmake, libxml2, libxslt, python2, qt4 }:

stdenv.mkDerivation {
# This derivation does not provide any Python module and should therefore be called via `all-packages.nix`.
let
pythonEnv = python2.withPackages(ps: with ps; [ sphinx ]);
in stdenv.mkDerivation {
name = "pyside-apiextractor-0.10.10";

src = fetchurl {
Expand All @@ -10,7 +13,7 @@ stdenv.mkDerivation {

enableParallelBuilding = true;

buildInputs = [ cmake libxml2 libxslt sphinx qt4 ];
buildInputs = [ cmake qt4 pythonEnv libxml2 libxslt ];

meta = {
description = "Eases the development of bindings of Qt-based libraries for high level languages by automating most of the process";
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/python-modules/pyside/default.nix
@@ -1,5 +1,6 @@
{ lib, fetchurl, cmake, python, buildPythonPackage, pysideGeneratorrunner, pysideShiboken, qt4 }:

# This derivation provides a Python module and should therefore be called via `python-packages.nix`.
buildPythonPackage rec {
name = "pyside-${version}";
version = "1.2.4";
Expand Down
13 changes: 9 additions & 4 deletions pkgs/development/python-modules/pyside/generatorrunner.nix
@@ -1,7 +1,12 @@
{ stdenv, fetchurl, cmake, pysideApiextractor, python, sphinx, qt4 }:
{ stdenv, fetchurl, cmake, pysideApiextractor, python2, qt4 }:

stdenv.mkDerivation {
name = "pyside-generatorrunner-0.6.16";
# This derivation does not provide any Python module and should therefore be called via `all-packages.nix`.
let
pythonEnv = python2.withPackages(ps: with ps; [ sphinx ]);
in stdenv.mkDerivation rec {
pname = "pyside-generatorrunner";
version = "0.6.16";
name = "${pname}-${version}";

src = fetchurl {
url = "https://github.com/PySide/Generatorrunner/archive/0.6.16.tar.gz";
Expand All @@ -10,7 +15,7 @@ stdenv.mkDerivation {

enableParallelBuilding = true;

buildInputs = [ cmake pysideApiextractor sphinx qt4 ];
buildInputs = [ cmake pysideApiextractor qt4 pythonEnv ];

meta = {
description = "Eases the development of binding generators for C++ and Qt-based libraries by providing a framework to help automating most of the process";
Expand Down
16 changes: 10 additions & 6 deletions pkgs/development/python-modules/pyside/shiboken.nix
@@ -1,10 +1,14 @@
{ stdenv, fetchurl, cmake, libxml2, libxslt, pysideApiextractor, pysideGeneratorrunner, python, sphinx, qt4, isPy3k, isPy35 }:
{ lib, fetchurl, cmake, buildPythonPackage, libxml2, libxslt, pysideApiextractor, pysideGeneratorrunner, python, sphinx, qt4, isPy3k, isPy35 }:

# This derivation provides a Python module and should therefore be called via `python-packages.nix`.
# Python 3.5 is not supported: https://github.com/PySide/Shiboken/issues/77
stdenv.mkDerivation rec {
name = "pyside-shiboken-${version}";
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "pyside-shiboken";
version = "1.2.4";

format = "other";

src = fetchurl {
url = "https://github.com/PySide/Shiboken/archive/${version}.tar.gz";
sha256 = "1536f73a3353296d97a25e24f9554edf3e6a48126886f8d21282c3645ecb96a4";
Expand All @@ -25,9 +29,9 @@ stdenv.mkDerivation rec {

meta = {
description = "Plugin (front-end) for pyside-generatorrunner, that generates bindings for C++ libraries using CPython source code";
license = stdenv.lib.licenses.gpl2;
license = lib.licenses.gpl2;
homepage = "http://www.pyside.org/docs/shiboken/";
maintainers = [ stdenv.lib.maintainers.chaoflow ];
platforms = stdenv.lib.platforms.all;
maintainers = [ lib.maintainers.chaoflow ];
platforms = lib.platforms.all;
};
}
18 changes: 11 additions & 7 deletions pkgs/development/python-modules/pyside/tools.nix
@@ -1,7 +1,11 @@
{ stdenv, fetchurl, cmake, pyside, python, qt4, pysideShiboken }:
{ lib, fetchurl, cmake, pyside, qt4, pysideShiboken, buildPythonPackage }:

stdenv.mkDerivation {
name = "pyside-tools-0.2.15";
# This derivation provides a Python module and should therefore be called via `python-packages.nix`.
buildPythonPackage rec {
pname = "pyside-tools";
version = "0.2.15";
name = "${pname}-${version}";
format = "other";

src = fetchurl {
url = "https://github.com/PySide/Tools/archive/0.2.15.tar.gz";
Expand All @@ -10,13 +14,13 @@ stdenv.mkDerivation {

enableParallelBuilding = true;

buildInputs = [ cmake pyside python qt4 pysideShiboken ];
buildInputs = [ cmake pyside qt4 pysideShiboken ];

meta = {
description = "Tools for pyside, the LGPL-licensed Python bindings for the Qt cross-platform application and UI framework";
license = stdenv.lib.licenses.gpl2;
license = lib.licenses.gpl2;
homepage = "http://www.pyside.org";
maintainers = [ stdenv.lib.maintainers.chaoflow ];
platforms = stdenv.lib.platforms.all;
maintainers = [ lib.maintainers.chaoflow ];
platforms = lib.platforms.all;
};
}
5 changes: 5 additions & 0 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -6124,6 +6124,11 @@ with pkgs;
pythonPackages = python3Packages;
};

# These pyside tools do not provide any Python modules and are meant to be here.
# See ../development/python-modules/pyside/default.nix for details.
pysideApiextractor = callPackage ../development/python-modules/pyside/apiextractor.nix { };
pysideGeneratorrunner = callPackage ../development/python-modules/pyside/generatorrunner.nix { };

svg2tikz = python27Packages.svg2tikz;

pyrex = pyrex095;
Expand Down
15 changes: 8 additions & 7 deletions pkgs/top-level/python-packages.nix
Expand Up @@ -49,8 +49,11 @@ let
fetchSource = {pname, version, sha256}:
# Fetch a source tarball.
let
url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}.tar.gz";
in pkgs.fetchurl {inherit url sha256;};
urls = [
"mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}.tar.gz"
"mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}.zip"
];
in pkgs.fetchurl {inherit urls sha256;};
fetcher = (if format == "wheel" then fetchWheel
else if format == "setuptools" then fetchSource
else throw "Unsupported kind ${kind}");
Expand Down Expand Up @@ -369,11 +372,9 @@ in {

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

pysideApiextractor = callPackage ../development/python-modules/pyside/apiextractor.nix { };

pysideGeneratorrunner = callPackage ../development/python-modules/pyside/generatorrunner.nix { };

pysideShiboken = callPackage ../development/python-modules/pyside/shiboken.nix { };
pysideShiboken = callPackage ../development/python-modules/pyside/shiboken.nix {
inherit (pkgs) libxml2 libxslt; # Do not need the Python bindings.
};

pysideTools = callPackage ../development/python-modules/pyside/tools.nix { };

Expand Down

0 comments on commit a4aaf5a

Please sign in to comment.