about summary refs log tree commit diff
path: root/pkgs/development/interpreters
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2019-08-18 23:31:45 +0200
committerFlorian Klink <flokli@flokli.de>2019-08-18 23:47:44 +0200
commitdb087f226d8fe649f1c437e7afe7f105375c729d (patch)
tree82da4c0c92d073b9a8acc1e280501f9d1468a0d0 /pkgs/development/interpreters
parent52fcbbff44980b27183087f210bf27a820a50541 (diff)
downloadnixlib-db087f226d8fe649f1c437e7afe7f105375c729d.tar
nixlib-db087f226d8fe649f1c437e7afe7f105375c729d.tar.gz
nixlib-db087f226d8fe649f1c437e7afe7f105375c729d.tar.bz2
nixlib-db087f226d8fe649f1c437e7afe7f105375c729d.tar.lz
nixlib-db087f226d8fe649f1c437e7afe7f105375c729d.tar.xz
nixlib-db087f226d8fe649f1c437e7afe7f105375c729d.tar.zst
nixlib-db087f226d8fe649f1c437e7afe7f105375c729d.zip
python: allow stripping bytecode
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r--pkgs/development/interpreters/python/cpython/default.nix3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix
index 3f2e7ebaf021..3eddadeda1d3 100644
--- a/pkgs/development/interpreters/python/cpython/default.nix
+++ b/pkgs/development/interpreters/python/cpython/default.nix
@@ -25,6 +25,7 @@
 , stripIdlelib ? false
 , stripTests ? false
 , rebuildBytecode ? true
+, stripBytecode ? false
 }:
 
 assert x11Support -> tcl != null
@@ -247,6 +248,8 @@ in with passthru; stdenv.mkDerivation {
     find $out -name "*.py" | ${pythonForBuildInterpreter}     -m compileall -q -f -x "lib2to3" -i -
     find $out -name "*.py" | ${pythonForBuildInterpreter} -O  -m compileall -q -f -x "lib2to3" -i -
     find $out -name "*.py" | ${pythonForBuildInterpreter} -OO -m compileall -q -f -x "lib2to3" -i -
+    '' + optionalString stripBytecode ''
+    find $out -type d -name __pycache__ -print0 | xargs -0 -I {} rm -rf "{}"
   '';
 
   preFixup = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''