forked from mirrors/nixpkgs
Merge pull request #18143 from FRidh/buildpythonpackage
Python: split buildPythonPackage into two functions
This commit is contained in:
commit
2a3077d2cc
|
@ -481,7 +481,7 @@ and the aliases
|
|||
#### `buildPythonPackage` function
|
||||
|
||||
The `buildPythonPackage` function is implemented in
|
||||
`pkgs/development/python-modules/generic/default.nix`
|
||||
`pkgs/development/interpreters/python/build-python-package.nix`
|
||||
|
||||
and can be used as:
|
||||
|
||||
|
@ -536,6 +536,7 @@ All parameters from `mkDerivation` function are still supported.
|
|||
* `installFlags`: A list of strings. Arguments to be passed to `pip install`. To pass options to `python setup.py install`, use `--install-option`. E.g., `installFlags=["--install-option='--cpp_implementation'"].
|
||||
* `format`: Format of the source. Options are `setup` for when the source has a `setup.py` and `setuptools` is used to build a wheel, and `wheel` in case the source is already a binary wheel. The default value is `setup`.
|
||||
* `catchConflicts` If `true`, abort package build if a package name appears more than once in dependency tree. Default is `true`.
|
||||
* `checkInputs` Dependencies needed for running the `checkPhase`. These are added to `buildInputs` when `doCheck = true`.
|
||||
|
||||
#### `buildPythonApplication` function
|
||||
|
||||
|
|
|
@ -3,57 +3,37 @@
|
|||
(http://pypi.python.org/pypi/setuptools/), which represents a large
|
||||
number of Python packages nowadays. */
|
||||
|
||||
{ python, setuptools, unzip, wrapPython, lib, bootstrapped-pip
|
||||
, ensureNewerSourcesHook }:
|
||||
{ lib
|
||||
, python
|
||||
, mkPythonDerivation
|
||||
, bootstrapped-pip
|
||||
}:
|
||||
|
||||
{ name
|
||||
|
||||
# by default prefix `name` e.g. "python3.3-${name}"
|
||||
, namePrefix ? python.libPrefix + "-"
|
||||
|
||||
, buildInputs ? []
|
||||
{ buildInputs ? []
|
||||
|
||||
# propagate build dependencies so in case we have A -> B -> C,
|
||||
# C can import package A propagated by B
|
||||
, propagatedBuildInputs ? []
|
||||
# C can import package A propagated by B
|
||||
#, propagatedBuildInputs ? []
|
||||
|
||||
# passed to "python setup.py build_ext"
|
||||
# https://github.com/pypa/pip/issues/881
|
||||
, setupPyBuildFlags ? []
|
||||
|
||||
# DEPRECATED: use propagatedBuildInputs
|
||||
, pythonPath ? []
|
||||
|
||||
# used to disable derivation, useful for specific python versions
|
||||
, disabled ? false
|
||||
|
||||
, meta ? {}
|
||||
|
||||
# Execute before shell hook
|
||||
, preShellHook ? ""
|
||||
|
||||
# Execute after shell hook
|
||||
, postShellHook ? ""
|
||||
|
||||
# Additional arguments to pass to the makeWrapper function, which wraps
|
||||
# generated binaries.
|
||||
, makeWrapperArgs ? []
|
||||
|
||||
# Additional flags to pass to "pip install".
|
||||
, installFlags ? []
|
||||
|
||||
# Raise an error if two packages are installed with the same name
|
||||
, catchConflicts ? true
|
||||
|
||||
, format ? "setup"
|
||||
|
||||
, ... } @ attrs:
|
||||
|
||||
|
||||
# Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
|
||||
if disabled
|
||||
then throw "${name} not supported for interpreter ${python.executable}"
|
||||
else
|
||||
|
||||
|
||||
let
|
||||
# use setuptools shim (so that setuptools is imported before distutils)
|
||||
|
@ -73,14 +53,10 @@ let
|
|||
installCheckPhase = attrs.checkPhase or ":";
|
||||
|
||||
# Wheels don't have any checks to run
|
||||
doInstallCheck = attrs.doCheck or false;
|
||||
doCheck = attrs.doCheck or false;
|
||||
}
|
||||
else if format == "setup" then
|
||||
{
|
||||
# propagate python/setuptools to active setup-hook in nix-shell
|
||||
propagatedBuildInputs =
|
||||
propagatedBuildInputs ++ [ python setuptools ];
|
||||
|
||||
# we copy nix_run_setup.py over so it's executed relative to the root of the source
|
||||
# many project make that assumption
|
||||
buildPhase = attrs.buildPhase or ''
|
||||
|
@ -100,21 +76,17 @@ let
|
|||
# are typically distributed with tests.
|
||||
# With Python it's a common idiom to run the tests
|
||||
# after the software has been installed.
|
||||
|
||||
# For backwards compatibility, let's use an alias
|
||||
doInstallCheck = attrs.doCheck or true;
|
||||
doCheck = attrs.doCheck or true;
|
||||
}
|
||||
else
|
||||
throw "Unsupported format ${format}";
|
||||
in
|
||||
python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "doCheck"] // {
|
||||
name = namePrefix + name;
|
||||
|
||||
buildInputs = [ wrapPython bootstrapped-pip ] ++ buildInputs ++ pythonPath
|
||||
++ [ (ensureNewerSourcesHook { year = "1980"; }) ]
|
||||
++ (lib.optional (lib.hasSuffix "zip" attrs.src.name or "") unzip);
|
||||
in mkPythonDerivation ( attrs // {
|
||||
|
||||
pythonPath = pythonPath;
|
||||
# To build and install a wheel we need pip
|
||||
buildInputs = buildInputs ++ [ bootstrapped-pip ];
|
||||
|
||||
#inherit propagatedBuildInputs;
|
||||
|
||||
configurePhase = attrs.configurePhase or ''
|
||||
runHook preConfigure
|
||||
|
@ -126,9 +98,6 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "doCheck"] //
|
|||
runHook postConfigure
|
||||
'';
|
||||
|
||||
# Python packages don't have a checkPhase, only an installCheckPhase
|
||||
doCheck = false;
|
||||
|
||||
installPhase = attrs.installPhase or ''
|
||||
runHook preInstall
|
||||
|
||||
|
@ -142,14 +111,6 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "doCheck"] //
|
|||
runHook postInstall
|
||||
'';
|
||||
|
||||
postFixup = attrs.postFixup or ''
|
||||
wrapPythonPrograms
|
||||
'' + lib.optionalString catchConflicts ''
|
||||
# check if we have two packages with the same name in closure and fail
|
||||
# this shouldn't happen, something went wrong with dependencies specs
|
||||
${python.interpreter} ${./catch_conflicts.py}
|
||||
'';
|
||||
|
||||
shellHook = attrs.shellHook or ''
|
||||
${preShellHook}
|
||||
if test -e setup.py; then
|
||||
|
@ -162,13 +123,4 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "doCheck"] //
|
|||
${postShellHook}
|
||||
'';
|
||||
|
||||
meta = with lib.maintainers; {
|
||||
# default to python's platforms
|
||||
platforms = python.meta.platforms;
|
||||
} // meta // {
|
||||
# add extra maintainer(s) to every package
|
||||
maintainers = (meta.maintainers or []) ++ [ chaoflow domenkozar ];
|
||||
# a marker for release utilities to discover python packages
|
||||
isBuildPythonPackage = python.meta.platforms;
|
||||
};
|
||||
} // formatspecific)
|
|
@ -0,0 +1,93 @@
|
|||
/* Generic builder for Python packages that come without a setup.py. */
|
||||
|
||||
{ lib
|
||||
, python
|
||||
, wrapPython
|
||||
, setuptools
|
||||
, unzip
|
||||
, ensureNewerSourcesHook
|
||||
}:
|
||||
|
||||
{ name
|
||||
|
||||
# by default prefix `name` e.g. "python3.3-${name}"
|
||||
, namePrefix ? python.libPrefix + "-"
|
||||
|
||||
# Dependencies for building the package
|
||||
, buildInputs ? []
|
||||
|
||||
# Dependencies needed for running the checkPhase.
|
||||
# These are added to buildInputs when doCheck = true.
|
||||
, checkInputs ? []
|
||||
|
||||
# propagate build dependencies so in case we have A -> B -> C,
|
||||
# C can import package A propagated by B
|
||||
, propagatedBuildInputs ? []
|
||||
|
||||
# DEPRECATED: use propagatedBuildInputs
|
||||
, pythonPath ? []
|
||||
|
||||
# used to disable derivation, useful for specific python versions
|
||||
, disabled ? false
|
||||
|
||||
# Raise an error if two packages are installed with the same name
|
||||
, catchConflicts ? true
|
||||
|
||||
# Additional arguments to pass to the makeWrapper function, which wraps
|
||||
# generated binaries.
|
||||
, makeWrapperArgs ? []
|
||||
|
||||
, meta ? {}
|
||||
|
||||
, passthru ? {}
|
||||
|
||||
, ... } @ attrs:
|
||||
|
||||
|
||||
# Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
|
||||
if disabled
|
||||
then throw "${name} not supported for interpreter ${python.executable}"
|
||||
else
|
||||
|
||||
python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled"] // {
|
||||
|
||||
name = namePrefix + name;
|
||||
|
||||
inherit pythonPath;
|
||||
|
||||
buildInputs = [ wrapPython ] ++ buildInputs ++ pythonPath
|
||||
++ [ (ensureNewerSourcesHook { year = "1980"; }) ]
|
||||
++ (lib.optional (lib.hasSuffix "zip" attrs.src.name or "") unzip)
|
||||
++ lib.optionals attrs.doCheck checkInputs;
|
||||
|
||||
# propagate python/setuptools to active setup-hook in nix-shell
|
||||
propagatedBuildInputs = propagatedBuildInputs ++ [ python setuptools ];
|
||||
|
||||
# Python packages don't have a checkPhase, only an installCheckPhase
|
||||
doCheck = false;
|
||||
doInstallCheck = attrs.doCheck or false;
|
||||
|
||||
postFixup = attrs.postFixup or ''
|
||||
wrapPythonPrograms
|
||||
'' + lib.optionalString catchConflicts ''
|
||||
# check if we have two packages with the same name in closure and fail
|
||||
# this shouldn't happen, something went wrong with dependencies specs
|
||||
${python.interpreter} ${./catch_conflicts.py}
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit python; # The python interpreter
|
||||
} // passthru;
|
||||
|
||||
meta = with lib.maintainers; {
|
||||
# default to python's platforms
|
||||
platforms = python.meta.platforms;
|
||||
} // meta // {
|
||||
# add extra maintainer(s) to every package
|
||||
maintainers = (meta.maintainers or []) ++ [ chaoflow domenkozar ];
|
||||
# a marker for release utilities to discover python packages
|
||||
isBuildPythonPackage = python.meta.platforms;
|
||||
};
|
||||
})
|
||||
|
||||
|
51
pkgs/development/interpreters/python/wrap-python.nix
Normal file
51
pkgs/development/interpreters/python/wrap-python.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{ lib
|
||||
, python
|
||||
, makeSetupHook
|
||||
, makeWrapper }:
|
||||
|
||||
with lib;
|
||||
|
||||
makeSetupHook {
|
||||
deps = makeWrapper;
|
||||
substitutions.libPrefix = python.libPrefix;
|
||||
substitutions.executable = python.interpreter;
|
||||
substitutions.python = python;
|
||||
substitutions.magicalSedExpression = let
|
||||
# Looks weird? Of course, it's between single quoted shell strings.
|
||||
# NOTE: Order DOES matter here, so single character quotes need to be
|
||||
# at the last position.
|
||||
quoteVariants = [ "'\"'''\"'" "\"\"\"" "\"" "'\"'\"'" ]; # hey Vim: ''
|
||||
|
||||
mkStringSkipper = labelNum: quote: let
|
||||
label = "q${toString labelNum}";
|
||||
isSingle = elem quote [ "\"" "'\"'\"'" ];
|
||||
endQuote = if isSingle then "[^\\\\]${quote}" else quote;
|
||||
in ''
|
||||
/^[a-z]?${quote}/ {
|
||||
/${quote}${quote}|${quote}.*${endQuote}/{n;br}
|
||||
:${label}; n; /^${quote}/{n;br}; /${endQuote}/{n;br}; b${label}
|
||||
}
|
||||
'';
|
||||
|
||||
# This preamble does two things:
|
||||
# * Sets argv[0] to the original application's name; otherwise it would be .foo-wrapped.
|
||||
# Python doesn't support `exec -a`.
|
||||
# * Adds all required libraries to sys.path via `site.addsitedir`. It also handles *.pth files.
|
||||
preamble = ''
|
||||
import sys
|
||||
import site
|
||||
import functools
|
||||
sys.argv[0] = '"'$(basename "$f")'"'
|
||||
functools.reduce(lambda k, p: site.addsitedir(p, k), ['"$([ -n "$program_PYTHONPATH" ] && (echo "'$program_PYTHONPATH'" | sed "s|:|','|g") || true)"'], site._init_pathinfo())
|
||||
'';
|
||||
|
||||
in ''
|
||||
1 {
|
||||
:r
|
||||
/\\$|,$/{N;br}
|
||||
/__future__|^ |^ *(#.*)?$/{n;br}
|
||||
${concatImapStrings mkStringSkipper quoteVariants}
|
||||
/^[^# ]/i ${replaceStrings ["\n"] [";"] preamble}
|
||||
}
|
||||
'';
|
||||
} ./wrap.sh
|
|
@ -6,8 +6,8 @@ let
|
|||
sha256 = "ea8033fc9905804e652f75474d33410a07404c1a78dd3c949a66863bd1050ebd";
|
||||
};
|
||||
setuptools_source = fetchurl {
|
||||
url = "https://pypi.python.org/packages/3.5/s/setuptools/setuptools-19.4-py2.py3-none-any.whl";
|
||||
sha256 = "0801e6d862ca4ce24d918420d62f07ee2fe736dc016e3afa99d2103e7a02e9a6";
|
||||
url = "https://files.pythonhosted.org/packages/3b/c7/e9724e6f81c96248fba5876054418c11d327b3093d075790903cd66fad44/setuptools-26.1.1-py2.py3-none-any.whl";
|
||||
sha256 = "226c9ce65e76c6069e805982b036f36dc4b227b37dd87fc219aef721ec8604ae";
|
||||
};
|
||||
argparse_source = fetchurl {
|
||||
url = "https://pypi.python.org/packages/2.7/a/argparse/argparse-1.4.0-py2.py3-none-any.whl";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ stdenv, fetchurl, python, pkgconfig, dbus, dbus_glib, dbus_tools, isPyPy
|
||||
{ lib, fetchurl, mkPythonDerivation, python, pkgconfig, dbus, dbus_glib, dbus_tools, isPyPy
|
||||
, ncurses, pygobject3 }:
|
||||
|
||||
if isPyPy then throw "dbus-python not supported for interpreter ${python.executable}" else stdenv.mkDerivation rec {
|
||||
if isPyPy then throw "dbus-python not supported for interpreter ${python.executable}" else mkPythonDerivation rec {
|
||||
name = "dbus-python-1.2.4";
|
||||
|
||||
src = fetchurl {
|
||||
|
@ -11,21 +11,17 @@ if isPyPy then throw "dbus-python not supported for interpreter ${python.executa
|
|||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
buildInputs = [ python pkgconfig dbus dbus_glib ]
|
||||
++ stdenv.lib.optionals doCheck [ dbus_tools pygobject3 ]
|
||||
buildInputs = [ pkgconfig dbus dbus_glib ]
|
||||
++ lib.optionals doCheck [ dbus_tools pygobject3 ]
|
||||
# My guess why it's sometimes trying to -lncurses.
|
||||
# It seems not to retain the dependency anyway.
|
||||
++ stdenv.lib.optional (! python ? modules) ncurses;
|
||||
++ lib.optional (! python ? modules) ncurses;
|
||||
|
||||
doCheck = true;
|
||||
|
||||
# Set empty pythonPath, so that the package is recognized as a python package
|
||||
# for python.buildEnv
|
||||
pythonPath = [];
|
||||
|
||||
meta = {
|
||||
description = "Python DBus bindings";
|
||||
license = stdenv.lib.licenses.mit;
|
||||
license = lib.licenses.mit;
|
||||
platforms = dbus.meta.platforms;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ stdenv, fetchurl, fetchpatch, python, pkgconfig, cairo, xlibsWrapper, isPyPy, isPy35 }:
|
||||
{ lib, fetchurl, fetchpatch, python, mkPythonDerivation, pkgconfig, cairo, xlibsWrapper, isPyPy, isPy35 }:
|
||||
|
||||
if (isPyPy) then throw "pycairo not supported for interpreter ${python.executable}" else stdenv.mkDerivation rec {
|
||||
if (isPyPy) then throw "pycairo not supported for interpreter ${python.executable}" else mkPythonDerivation rec {
|
||||
version = "1.10.0";
|
||||
name = "${python.libPrefix}-pycairo-${version}";
|
||||
src = if python.is_py3k or false
|
||||
|
@ -32,7 +32,7 @@ if (isPyPy) then throw "pycairo not supported for interpreter ${python.executabl
|
|||
cd $(${python.executable} waf unpack)
|
||||
pwd
|
||||
patch -p1 < ${patch_waf}
|
||||
${stdenv.lib.optionalString isPy35 "patch -p1 < ${patch_waf-py3_5}"}
|
||||
${lib.optionalString isPy35 "patch -p1 < ${patch_waf-py3_5}"}
|
||||
)
|
||||
|
||||
${python.executable} waf configure --prefix=$out
|
||||
|
@ -40,5 +40,5 @@ if (isPyPy) then throw "pycairo not supported for interpreter ${python.executabl
|
|||
buildPhase = "${python.executable} waf";
|
||||
installPhase = "${python.executable} waf install";
|
||||
|
||||
meta.platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
|
||||
meta.platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ stdenv, fetchurl, python, pkgconfig, glib, gobjectIntrospection, pycairo, cairo }:
|
||||
{ lib, fetchurl, mkPythonDerivation, python, pkgconfig, glib, gobjectIntrospection, pycairo, cairo }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
mkPythonDerivation rec {
|
||||
major = "3.20";
|
||||
minor = "0";
|
||||
name = "pygobject-${major}.${minor}";
|
||||
|
@ -10,14 +10,12 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "0ikzh3l7g1gjh8jj8vg6mdvrb25svp63gxcam4m0i404yh0lgari";
|
||||
};
|
||||
|
||||
buildInputs = [ python pkgconfig glib gobjectIntrospection ];
|
||||
buildInputs = [ pkgconfig glib gobjectIntrospection ];
|
||||
propagatedBuildInputs = [ pycairo cairo ];
|
||||
|
||||
passthru.pythonPath = [];
|
||||
|
||||
meta = {
|
||||
homepage = http://live.gnome.org/PyGObject;
|
||||
description = "Python bindings for Glib";
|
||||
platforms = stdenv.lib.platforms.unix;
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ stdenv, fetchurl, python, pkgconfig, glib }:
|
||||
{ stdenv, fetchurl, python, mkPythonDerivation, pkgconfig, glib }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
mkPythonDerivation rec {
|
||||
name = "pygobject-2.28.6";
|
||||
|
||||
src = fetchurl {
|
||||
|
@ -18,9 +18,7 @@ stdenv.mkDerivation rec {
|
|||
|
||||
configureFlags = "--disable-introspection";
|
||||
|
||||
buildInputs = [ python pkgconfig glib ];
|
||||
|
||||
passthru.pythonPath = [];
|
||||
buildInputs = [ pkgconfig glib ];
|
||||
|
||||
# in a "normal" setup, pygobject and pygtk are installed into the
|
||||
# same site-packages: we need a pth file for both. pygtk.py would be
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{ stdenv, fetchurl, python, pkgconfig, pygobject, glib, pygtk, gnome2 }:
|
||||
{ lib, fetchurl, python, mkPythonDerivation, pkgconfig, pygobject, glib, pygtk, gnome2 }:
|
||||
|
||||
let version = "2.10.1"; in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
mkPythonDerivation {
|
||||
name = "pygtksourceview-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
|
@ -15,6 +15,6 @@ stdenv.mkDerivation {
|
|||
buildInputs = [ python pkgconfig pygobject glib pygtk gnome2.gtksourceview ];
|
||||
|
||||
meta = {
|
||||
platforms = stdenv.lib.platforms.unix;
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{ stdenv, fetchurl, pythonPackages, qt4, pkgconfig, lndir, dbus_libs, makeWrapper }:
|
||||
{ lib, fetchurl, pythonPackages, qt4, pkgconfig, lndir, dbus_libs, makeWrapper }:
|
||||
|
||||
let
|
||||
version = "4.11.3";
|
||||
inherit (pythonPackages) python dbus-python sip;
|
||||
in stdenv.mkDerivation {
|
||||
name = "${python.libPrefix}-PyQt-x11-gpl-${version}";
|
||||
inherit (pythonPackages) mkPythonDerivation python dbus-python sip;
|
||||
in mkPythonDerivation {
|
||||
name = "$PyQt-x11-gpl-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://sourceforge/pyqt/PyQt4/PyQt-${version}/PyQt-x11-gpl-${version}.tar.gz";
|
||||
|
@ -31,7 +31,7 @@ in stdenv.mkDerivation {
|
|||
|
||||
buildInputs = [ pkgconfig makeWrapper qt4 lndir dbus_libs ];
|
||||
|
||||
propagatedBuildInputs = [ sip python ];
|
||||
propagatedBuildInputs = [ sip ];
|
||||
|
||||
postInstall = ''
|
||||
for i in $out/bin/*; do
|
||||
|
@ -42,7 +42,6 @@ in stdenv.mkDerivation {
|
|||
enableParallelBuilding = true;
|
||||
|
||||
passthru = {
|
||||
pythonPath = [];
|
||||
qt = qt4;
|
||||
};
|
||||
|
||||
|
@ -50,7 +49,7 @@ in stdenv.mkDerivation {
|
|||
description = "Python bindings for Qt";
|
||||
license = "GPL";
|
||||
homepage = http://www.riverbankcomputing.co.uk;
|
||||
maintainers = [ stdenv.lib.maintainers.sander ];
|
||||
platforms = stdenv.lib.platforms.mesaPlatforms;
|
||||
maintainers = [ lib.maintainers.sander ];
|
||||
platforms = lib.platforms.mesaPlatforms;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{ stdenv, fetchurl, pythonPackages, pkgconfig, qtbase, qtsvg, qtwebkit, dbus_libs
|
||||
{ lib, fetchurl, pythonPackages, pkgconfig, qtbase, qtsvg, qtwebkit, dbus_libs
|
||||
, lndir, makeWrapper, qmakeHook }:
|
||||
|
||||
let
|
||||
version = "5.6";
|
||||
inherit (pythonPackages) python dbus-python sip;
|
||||
in stdenv.mkDerivation {
|
||||
name = "${python.libPrefix}-PyQt-${version}";
|
||||
inherit (pythonPackages) mkPythonDerivation python dbus-python sip;
|
||||
in mkPythonDerivation {
|
||||
name = "PyQt-${version}";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "Python bindings for Qt5";
|
||||
homepage = http://www.riverbankcomputing.co.uk;
|
||||
license = licenses.gpl3;
|
||||
|
@ -25,7 +25,7 @@ in stdenv.mkDerivation {
|
|||
qtbase qtsvg qtwebkit dbus_libs qmakeHook
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [ sip python ];
|
||||
propagatedBuildInputs = [ sip ];
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
@ -60,6 +60,4 @@ in stdenv.mkDerivation {
|
|||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
passthru.pythonPath = [];
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ stdenv, fetchurl, cmake, python, pysideGeneratorrunner, pysideShiboken, qt4 }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
stdenv.mkPythonDerivation rec {
|
||||
name = "${python.libPrefix}-pyside-${version}";
|
||||
version = "1.2.4";
|
||||
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
{stdenv, fetchurl, python, makeWrapper}:
|
||||
{lib, fetchurl, python, mkPythonDerivation, makeWrapper}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
mkPythonDerivation rec {
|
||||
name = "PyXML-0.8.4";
|
||||
src = fetchurl {
|
||||
url = "mirror://sourceforge/pyxml/${name}.tar.gz";
|
||||
sha256 = "04wc8i7cdkibhrldy6j65qp5l75zjxf5lx6qxdxfdf2gb3wndawz";
|
||||
};
|
||||
|
||||
buildInputs = [python makeWrapper];
|
||||
buildPhase = "python ./setup.py build";
|
||||
buildInputs = [ makeWrapper ];
|
||||
buildPhase = "${python.interpreter} ./setup.py build";
|
||||
installPhase = ''
|
||||
python ./setup.py install --prefix="$out" || exit 1
|
||||
${python.interpreter} ./setup.py install --prefix="$out" || exit 1
|
||||
|
||||
for i in "$out/bin/"*
|
||||
do
|
||||
# FIXME: We're assuming Python 2.4.
|
||||
wrapProgram "$i" --prefix PYTHONPATH : \
|
||||
"$out/lib/python2.4/site-packages" || \
|
||||
"$out/${python.sitePackages}" || \
|
||||
exit 2
|
||||
done
|
||||
'';
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
stdenv.mkDerivation rec {
|
||||
shortName = "setuptools-${version}";
|
||||
name = "${python.executable}-${shortName}";
|
||||
name = "${python.libPrefix}-${shortName}";
|
||||
|
||||
version = "19.4"; # 18.4 and up breaks python34Packages.characteristic and many others
|
||||
version = "26.1.1"; # 18.4 and up breaks python34Packages.characteristic and many others
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://pypi/s/setuptools/${shortName}.tar.gz";
|
||||
sha256 = "214bf29933f47cf25e6faa569f710731728a07a19cae91ea64f826051f68a8cf";
|
||||
sha256 = "475ce28993d7cb75335942525b9fac79f7431a7f6e8a0079c0f2680641379481";
|
||||
};
|
||||
|
||||
buildInputs = [ python wrapPython ];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ stdenv, fetchurl, python, isPyPy }:
|
||||
{ lib, fetchurl, mkPythonDerivation, python, isPyPy }:
|
||||
|
||||
if isPyPy then throw "sip not supported for interpreter ${python.executable}" else stdenv.mkDerivation rec {
|
||||
if isPyPy then throw "sip not supported for interpreter ${python.executable}" else mkPythonDerivation rec {
|
||||
name = "sip-4.18.1";
|
||||
|
||||
src = fetchurl {
|
||||
|
@ -14,11 +14,7 @@ if isPyPy then throw "sip not supported for interpreter ${python.executable}" el
|
|||
-b $out/bin -e $out/include
|
||||
'';
|
||||
|
||||
buildInputs = [ python ];
|
||||
|
||||
passthru.pythonPath = [];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = with lib; {
|
||||
description = "Creates C++ bindings for Python modules";
|
||||
homepage = "http://www.riverbankcomputing.co.uk/";
|
||||
license = licenses.gpl2Plus;
|
||||
|
|
|
@ -18,7 +18,10 @@ let
|
|||
|
||||
bootstrapped-pip = callPackage ../development/python-modules/bootstrapped-pip { };
|
||||
|
||||
buildPythonPackage = makeOverridable (callPackage ../development/python-modules/generic {
|
||||
mkPythonDerivation = makeOverridable( callPackage ../development/interpreters/python/mk-python-derivation.nix {
|
||||
});
|
||||
buildPythonPackage = makeOverridable (callPackage ../development/interpreters/python/build-python-package.nix {
|
||||
inherit mkPythonDerivation;
|
||||
inherit bootstrapped-pip;
|
||||
});
|
||||
|
||||
|
@ -34,55 +37,11 @@ let
|
|||
|
||||
in modules // {
|
||||
|
||||
inherit python bootstrapped-pip isPy26 isPy27 isPy33 isPy34 isPy35 isPy36 isPyPy isPy3k buildPythonPackage buildPythonApplication;
|
||||
inherit python bootstrapped-pip isPy26 isPy27 isPy33 isPy34 isPy35 isPy36 isPyPy isPy3k mkPythonDerivation buildPythonPackage buildPythonApplication;
|
||||
|
||||
# helpers
|
||||
|
||||
wrapPython = pkgs.makeSetupHook
|
||||
{ deps = pkgs.makeWrapper;
|
||||
substitutions.libPrefix = python.libPrefix;
|
||||
substitutions.executable = python.interpreter;
|
||||
substitutions.python = python;
|
||||
substitutions.magicalSedExpression = let
|
||||
# Looks weird? Of course, it's between single quoted shell strings.
|
||||
# NOTE: Order DOES matter here, so single character quotes need to be
|
||||
# at the last position.
|
||||
quoteVariants = [ "'\"'''\"'" "\"\"\"" "\"" "'\"'\"'" ]; # hey Vim: ''
|
||||
|
||||
mkStringSkipper = labelNum: quote: let
|
||||
label = "q${toString labelNum}";
|
||||
isSingle = elem quote [ "\"" "'\"'\"'" ];
|
||||
endQuote = if isSingle then "[^\\\\]${quote}" else quote;
|
||||
in ''
|
||||
/^[a-z]?${quote}/ {
|
||||
/${quote}${quote}|${quote}.*${endQuote}/{n;br}
|
||||
:${label}; n; /^${quote}/{n;br}; /${endQuote}/{n;br}; b${label}
|
||||
}
|
||||
'';
|
||||
|
||||
# This preamble does two things:
|
||||
# * Sets argv[0] to the original application's name; otherwise it would be .foo-wrapped.
|
||||
# Python doesn't support `exec -a`.
|
||||
# * Adds all required libraries to sys.path via `site.addsitedir`. It also handles *.pth files.
|
||||
preamble = ''
|
||||
import sys
|
||||
import site
|
||||
import functools
|
||||
sys.argv[0] = '"'$(basename "$f")'"'
|
||||
functools.reduce(lambda k, p: site.addsitedir(p, k), ['"$([ -n "$program_PYTHONPATH" ] && (echo "'$program_PYTHONPATH'" | sed "s|:|','|g") || true)"'], site._init_pathinfo())
|
||||
'';
|
||||
|
||||
in ''
|
||||
1 {
|
||||
:r
|
||||
/\\$|,$/{N;br}
|
||||
/__future__|^ |^ *(#.*)?$/{n;br}
|
||||
${concatImapStrings mkStringSkipper quoteVariants}
|
||||
/^[^# ]/i ${replaceStrings ["\n"] [";"] preamble}
|
||||
}
|
||||
'';
|
||||
}
|
||||
../development/python-modules/generic/wrap.sh;
|
||||
wrapPython = callPackage ../development/interpreters/python/wrap-python.nix {inherit python; inherit (pkgs) makeSetupHook makeWrapper; };
|
||||
|
||||
# specials
|
||||
|
||||
|
@ -6377,7 +6336,7 @@ in modules // {
|
|||
buildInputs = with self; [ fudge_9 nose ];
|
||||
};
|
||||
|
||||
fedora_cert = stdenv.mkDerivation (rec {
|
||||
fedora_cert = mkPythonDerivation rec {
|
||||
name = "fedora-cert-0.5.9.2";
|
||||
meta.maintainers = with maintainers; [ mornfall ];
|
||||
|
||||
|
@ -6386,12 +6345,10 @@ in modules // {
|
|||
sha256 = "105swvzshgn3g6bjwk67xd8pslnhpxwa63mdsw6cl4c7cjp2blx9";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = with self; [ python python_fedora wrapPython ];
|
||||
propagatedBuildInputs = with self; [ python_fedora modules.sqlite3 pyopenssl ];
|
||||
postInstall = "mv $out/bin/fedpkg $out/bin/fedora-cert-fedpkg";
|
||||
doCheck = false;
|
||||
|
||||
postFixup = "wrapPythonPrograms";
|
||||
});
|
||||
};
|
||||
|
||||
fedpkg = buildPythonPackage (rec {
|
||||
name = "fedpkg-1.14";
|
||||
|
@ -20235,7 +20192,7 @@ in modules // {
|
|||
});
|
||||
|
||||
|
||||
pysvn = pkgs.stdenv.mkDerivation rec {
|
||||
pysvn = mkPythonDerivation rec {
|
||||
name = "pysvn-1.8.0";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
|
@ -20243,7 +20200,7 @@ in modules // {
|
|||
sha256 = "0srjr2qgxfs69p65d9vvdib2lc142x10w8afbbdrqs7dhi46yn9r";
|
||||
};
|
||||
|
||||
buildInputs = with self; [ python pkgs.subversion pkgs.apr pkgs.aprutil pkgs.expat pkgs.neon pkgs.openssl ]
|
||||
buildInputs = with self; [ pkgs.subversion pkgs.apr pkgs.aprutil pkgs.expat pkgs.neon pkgs.openssl ]
|
||||
++ (if stdenv.isLinux then [pkgs.e2fsprogs] else []);
|
||||
|
||||
# There seems to be no way to pass that path to configure.
|
||||
|
@ -20389,7 +20346,7 @@ in modules // {
|
|||
});
|
||||
|
||||
|
||||
pywebkitgtk = stdenv.mkDerivation rec {
|
||||
pywebkitgtk = mkPythonDerivation rec {
|
||||
name = "pywebkitgtk-${version}";
|
||||
version = "1.1.8";
|
||||
|
||||
|
@ -20720,14 +20677,14 @@ in modules // {
|
|||
|
||||
qscintilla = if isPy3k || isPyPy
|
||||
then throw "qscintilla-${pkgs.qscintilla.version} not supported for interpreter ${python.executable}"
|
||||
else pkgs.stdenv.mkDerivation rec {
|
||||
else mkPythonDerivation rec {
|
||||
# TODO: Qt5 support
|
||||
name = "qscintilla-${version}";
|
||||
version = pkgs.qscintilla.version;
|
||||
|
||||
src = pkgs.qscintilla.src;
|
||||
|
||||
buildInputs = with self; [ pkgs.xorg.lndir pyqt4.qt pyqt4 python ];
|
||||
buildInputs = with self; [ pkgs.xorg.lndir pyqt4.qt pyqt4 ];
|
||||
|
||||
preConfigure = ''
|
||||
mkdir -p $out
|
||||
|
|
Loading…
Reference in a new issue