Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3Packages.pip: allow setting reproducible temporary directory via NIX_PIP_INSTALL_TMPDIR #91272

Merged
merged 1 commit into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ pipInstallPhase() {
export PYTHONPATH="$out/@pythonSitePackages@:$PYTHONPATH"

pushd dist || return 1
@pythonInterpreter@ -m pip install ./*.whl --no-index --prefix="$out" --no-cache $pipInstallFlags --build tmpbuild
mkdir tmpbuild
NIX_PIP_INSTALL_TMPDIR=tmpbuild @pythonInterpreter@ -m pip install ./*.whl --no-index --prefix="$out" --no-cache $pipInstallFlags
rm -rf tmpbuild
misuzu marked this conversation as resolved.
Show resolved Hide resolved
popd || return 1

runHook postInstall
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/python-modules/pip/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ buildPythonPackage rec {
name = "${pname}-${version}-source";
};

# Remove when solved https://github.com/NixOS/nixpkgs/issues/81441
# Also update pkgs/development/interpreters/python/hooks/pip-install-hook.sh accordingly
patches = [ ./reproducible.patch ];

nativeBuildInputs = [ bootstrapped-pip ];

# pip detects that we already have bootstrapped_pip "installed", so we need
Expand Down
13 changes: 13 additions & 0 deletions pkgs/development/python-modules/pip/reproducible.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/pip/_internal/operations/install/wheel.py b/src/pip/_internal/operations/install/wheel.py
index e7315ee4..4e36b03d 100644
--- a/src/pip/_internal/operations/install/wheel.py
+++ b/src/pip/_internal/operations/install/wheel.py
@@ -615,6 +615,8 @@ def install_wheel(
direct_url=None, # type: Optional[DirectUrl]
):
# type: (...) -> None
+ _temp_dir_for_testing = (
+ _temp_dir_for_testing or os.environ.get("NIX_PIP_INSTALL_TMPDIR"))
with TempDirectory(
path=_temp_dir_for_testing, kind="unpacked-wheel"
) as unpacked_dir, ZipFile(wheel_path, allowZip64=True) as z: