about summary refs log tree commit diff
path: root/pkgs/development/python-modules/distutils-cfg
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2014-01-06 22:24:05 +0000
committerDomen Kožar <domen@dev.si>2014-02-20 01:19:15 +0100
commitbf5d6fb9b1c12a919853f15571b5a012f87fd928 (patch)
tree475da9fd41bfeaedd15c88b2a49e6e80bfd502d1 /pkgs/development/python-modules/distutils-cfg
parente9923c649955dfdadeb016482049a8747e5fc454 (diff)
downloadnixlib-bf5d6fb9b1c12a919853f15571b5a012f87fd928.tar
nixlib-bf5d6fb9b1c12a919853f15571b5a012f87fd928.tar.gz
nixlib-bf5d6fb9b1c12a919853f15571b5a012f87fd928.tar.bz2
nixlib-bf5d6fb9b1c12a919853f15571b5a012f87fd928.tar.lz
nixlib-bf5d6fb9b1c12a919853f15571b5a012f87fd928.tar.xz
nixlib-bf5d6fb9b1c12a919853f15571b5a012f87fd928.tar.zst
nixlib-bf5d6fb9b1c12a919853f15571b5a012f87fd928.zip
Refactor buildPythonPackage to modularize building process.
Before we used `easy_install` command to handle installation
in one shot, now this is split into two phases:

 - buildPhase: python setup.py build
 - installPhase: python setup.py install

Each of those commands have the ability to pass extra
parameters through buildPythonPackage parameters as
`setupPyInstallFlags` and `setupPyBuildFlags`.

Phases now correctly execute post/pre hooks.

In configurePhase we inject setuptools dependency before distutils
is imported to apply monkeypatching by setuptools that is needed
for special features to apply.

We don't have to reorder default phases anymore, as test
phase comes after build and that works.

I rewrote offineDistutils into distutils-cfg with a bit cleaner
syntax and ability to specify extraCfg to the config file.

Plone packages are failing and garbas said he will adopt them to
the new functions. The rest of the packages I fixed and these commits
shouldn't break any package (according to my testings) and they introduce
16 new jobs and fix 38 that were broken before.
Diffstat (limited to 'pkgs/development/python-modules/distutils-cfg')
-rw-r--r--pkgs/development/python-modules/distutils-cfg/default.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/distutils-cfg/default.nix b/pkgs/development/python-modules/distutils-cfg/default.nix
new file mode 100644
index 000000000000..7b0f36286980
--- /dev/null
+++ b/pkgs/development/python-modules/distutils-cfg/default.nix
@@ -0,0 +1,31 @@
+# global distutils configuration, see http://docs.python.org/2/install/index.html#distutils-configuration-files
+
+{ stdenv, python, writeText, extraCfg ? "" }:
+
+
+let
+  distutilsCfg = writeText "distutils.cfg" ''
+    [easy_install]
+
+    # don't allow network connections during build to ensure purity
+    allow-hosts = None
+
+    # make sure we always unzip installed packages otherwise setup hooks won't work
+    zip_ok = 0
+
+    ${extraCfg}
+  '';
+in stdenv.mkDerivation {
+  name = "distutils.cfg-python${python.version}";
+
+  buildInputs = [ python ];
+
+  unpackPhase = "true";
+
+  installPhase = ''
+    dest="$out/lib/${python.libPrefix}/site-packages/distutils"
+    mkdir -p $dest
+    ln -s ${python}/lib/${python.libPrefix}/distutils/* $dest
+    ln -s ${distutilsCfg} $dest/distutils.cfg
+  '';
+}