f0bb568b74
In https://github.com/NixOS/nixpkgs/issues/139292 we found out that pytest leaves pytest-generated bytecode in install directory (as tests are ran after install). That bytecode is: - non-deterministic (was copied from cpython before cpython got support for deterministic bytecode) - unneeded after test run The change cleans bytecode up and provides a hook variable to avoid it if needed. Tested on `python39Packages.pytest-xdist` and `python27Packages.flaky` as: $ nix build -f. python39Packages.pytest-xdist $ nix build -f. python39Packages.pytest-xdist --rebuild $ nix build -f. python27Packages.flaky $ nix build -f. python27Packages.flaky --rebuild Closes: https://github.com/NixOS/nixpkgs/issues/139292