summary refs log tree commit diff
path: root/pkgs/development/interpreters/python/hooks
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2020-10-31 21:24:36 +0100
committerGitHub <noreply@github.com>2020-10-31 21:24:36 +0100
commitc409f694807e8cd16db8e2affb630073c1aadc48 (patch)
treee629021876263b2e9370abd2129e98e3ee90fe00 /pkgs/development/interpreters/python/hooks
parent8f2be9ac36081fd1e9b2395e1662a5189bf917fb (diff)
downloadnixpkgs-c409f694807e8cd16db8e2affb630073c1aadc48.tar
nixpkgs-c409f694807e8cd16db8e2affb630073c1aadc48.tar.gz
nixpkgs-c409f694807e8cd16db8e2affb630073c1aadc48.tar.bz2
nixpkgs-c409f694807e8cd16db8e2affb630073c1aadc48.tar.lz
nixpkgs-c409f694807e8cd16db8e2affb630073c1aadc48.tar.xz
nixpkgs-c409f694807e8cd16db8e2affb630073c1aadc48.tar.zst
nixpkgs-c409f694807e8cd16db8e2affb630073c1aadc48.zip
pythonPackages.pip: make reproducible (#102222)
The previous attempt wasn't covering all of the bases. It relied on
invoking that pip-install-hook, and didn't apply to pip itself.

The core issue is that the generated .pyc files embed some of the
temporary paths, which are randomly generated. See
https://r13y.com/diff/bf8c3ca3148ebff9ecf41f294cc60b9f209c006d49699e356969ff32d736f1c6-8806a7cca91fdd300e48736bfcd57c4d0b54c1cc2fd61609f35143170862b59c.html

In this new attempt, the approach is to patch the TempFile
implementation directly, so that it creates stable temporary
directories. We also assume that if SOURCE_DATE_EPOCH is set, we are in
a scenario where reproducible builds are desirable and enter that
branch.

See also https://github.com/pypa/pip/issues/7808
Diffstat (limited to 'pkgs/development/interpreters/python/hooks')
-rw-r--r--pkgs/development/interpreters/python/hooks/pip-install-hook.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/development/interpreters/python/hooks/pip-install-hook.sh b/pkgs/development/interpreters/python/hooks/pip-install-hook.sh
index 770739b36bd..73d3c3cbbff 100644
--- a/pkgs/development/interpreters/python/hooks/pip-install-hook.sh
+++ b/pkgs/development/interpreters/python/hooks/pip-install-hook.sh
@@ -12,7 +12,7 @@ pipInstallPhase() {
 
     pushd dist || return 1
     mkdir tmpbuild
-    NIX_PIP_INSTALL_TMPDIR=tmpbuild @pythonInterpreter@ -m pip install ./*.whl --no-index --prefix="$out" --no-cache $pipInstallFlags
+    @pythonInterpreter@ -m pip install ./*.whl --no-index --prefix="$out" --no-cache $pipInstallFlags
     rm -rf tmpbuild
     popd || return 1