Merge pull request #90636 from jonringer/disable-byterecompile-py2

python2Packages: default to dontUsePythonRecompileBytecode = true;
This commit is contained in:
Frederik Rietdijk 2020-06-17 08:36:16 +02:00 committed by GitHub
commit c610d82167
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 117 additions and 19 deletions

View File

@ -165,6 +165,11 @@ let
# Python packages built through cross-compilation are always for the host platform. # Python packages built through cross-compilation are always for the host platform.
disallowedReferences = lib.optionals (python.stdenv.hostPlatform != python.stdenv.buildPlatform) [ python.pythonForBuild ]; disallowedReferences = lib.optionals (python.stdenv.hostPlatform != python.stdenv.buildPlatform) [ python.pythonForBuild ];
# many packages that support python2, may include code
# which python2 is not able to compile
# mkDerivation hash will not change when passed null attrs
dontUsePythonRecompileBytecode = attrs.dontUsePythonRecompileBytecode or (if python.isPy27 then true else null);
meta = { meta = {
# default to python's platforms # default to python's platforms
platforms = python.meta.platforms; platforms = python.meta.platforms;

View File

@ -1,12 +1,14 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, isPy27
, pytest , pytest
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "JPype1"; pname = "JPype1";
version = "0.7.5"; version = "0.7.5";
disabled = isPy27;
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -1,8 +1,9 @@
{ stdenv, buildPythonPackage, fetchPypi, pytz, requests, pytest }: { stdenv, buildPythonPackage, fetchPypi, isPy27, pytz, requests, pytest }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "astral"; pname = "astral";
version = "2.2"; version = "2.2";
disabled = isPy27;
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -3,6 +3,7 @@
, fetchPypi , fetchPypi
, requests , requests
, mock , mock
, pytestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -20,6 +21,17 @@ buildPythonPackage rec {
checkInputs = [ checkInputs = [
mock mock
pytestCheckHook
];
pytestFlagsArray = [
# jwt package is not available in nixpkgs
"--ignore=auth0/v3/test/authentication/test_token_verifier.py"
];
# tries to ping websites (e.g. google.com)
disabledTests = [
"can_timeout"
]; ];
meta = with lib; { meta = with lib; {

View File

@ -1,6 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, isPy27
, numpy , numpy
, ffmpeg_4 , ffmpeg_4
, pkgconfig , pkgconfig
@ -9,6 +10,7 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "av"; pname = "av";
version = "8.0.2"; version = "8.0.2";
disabled = isPy27; # setup.py no longer compatible
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -1,4 +1,4 @@
{ stdenv, buildPythonPackage, fetchPypi, isPy3k }: { stdenv, buildPythonPackage, fetchPypi, isPy3k, pycodestyle, isort }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "avro"; pname = "avro";
@ -10,6 +10,9 @@ buildPythonPackage rec {
sha256 = "4487f0e91d0d44142bd08b3c6da57073b720c3effb02eeb4e2e822804964c56b"; sha256 = "4487f0e91d0d44142bd08b3c6da57073b720c3effb02eeb4e2e822804964c56b";
}; };
nativeBuildInputs = [ pycodestyle ];
propagatedBuildInputs = [ isort ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A serialization and RPC framework"; description = "A serialization and RPC framework";
homepage = "https://pypi.python.org/pypi/avro/"; homepage = "https://pypi.python.org/pypi/avro/";

View File

@ -1,8 +1,9 @@
{ stdenv, fetchPypi, buildPythonPackage, pytest, pyhamcrest }: { stdenv, fetchPypi, buildPythonPackage, isPy27, pytest, pyhamcrest }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "base58"; pname = "base58";
version = "2.0.0"; version = "2.0.0";
disabled = isPy27; # python 2 abandoned upstream
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -1,8 +1,9 @@
{ lib, buildPythonPackage, fetchPypi, six }: { lib, buildPythonPackage, fetchPypi, isPy27, six }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "cfgv"; pname = "cfgv";
version = "3.1.0"; version = "3.1.0";
disabled = isPy27;
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -1,8 +1,9 @@
{ stdenv, buildPythonPackage, fetchPypi, pytest, mock }: { stdenv, buildPythonPackage, fetchPypi, isPy27, pytest, mock }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "cloudpickle"; pname = "cloudpickle";
version = "1.4.1"; version = "1.4.1";
disabled = isPy27; # abandoned upstream
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -1,6 +1,7 @@
{ buildPythonPackage { buildPythonPackage
, lib , lib
, fetchPypi , fetchPypi
, isPy27
, mock , mock
, pytest , pytest
, pytestrunner , pytestrunner
@ -15,8 +16,8 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "coveralls"; pname = "coveralls";
name = "${pname}-python-${version}";
version = "2.0.0"; version = "2.0.0";
disabled = isPy27;
# wanted by tests # wanted by tests
src = fetchPypi { src = fetchPypi {

View File

@ -1,10 +1,11 @@
{ stdenv, fetchPypi, buildPythonPackage { stdenv, fetchPypi, buildPythonPackage, isPy27
, mock, pytestCheckHook, nose, hypothesis , mock, pytestCheckHook, nose, hypothesis
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "dpath"; pname = "dpath";
version = "2.0.1"; version = "2.0.1";
disabled = isPy27; # uses python3 imports
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -1,8 +1,9 @@
{ lib, buildPythonPackage, fetchPypi, requests, pytest }: { lib, buildPythonPackage, fetchPypi, isPy27, requests, pytest }:
buildPythonPackage rec { buildPythonPackage rec {
version = "0.2.1"; version = "0.2.1";
pname = "etelemetry"; pname = "etelemetry";
disabled = isPy27;
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -4,6 +4,7 @@
buildPythonPackage { buildPythonPackage {
pname = "filemagic"; pname = "filemagic";
version = "1.6"; version = "1.6";
disabled = !isPy3k; # asserts on ResourceWarning
# Don't use the PyPI source because it's missing files required for testing # Don't use the PyPI source because it's missing files required for testing
src = fetchFromGitHub { src = fetchFromGitHub {
@ -18,7 +19,7 @@ buildPythonPackage {
"'${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}'" "'${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}'"
''; '';
checkInputs = [ (if isPy3k then mock else unittest2) ]; checkInputs = [ mock ] ++ lib.optionals (!isPy3k) [ unittest2 ];
meta = with lib; { meta = with lib; {
description = "File type identification using libmagic"; description = "File type identification using libmagic";

View File

@ -1,4 +1,10 @@
{ lib, fetchPypi, buildPythonPackage, flake8, pycodestyle, pytestrunner, pytest }: { lib, fetchPypi, buildPythonPackage, pythonOlder
, flake8
, importlib-metadata
, pycodestyle
, pytestrunner
, pytest
}:
buildPythonPackage rec { buildPythonPackage rec {
pname = "flake8-debugger"; pname = "flake8-debugger";
@ -11,7 +17,8 @@ buildPythonPackage rec {
nativeBuildInputs = [ pytestrunner ]; nativeBuildInputs = [ pytestrunner ];
propagatedBuildInputs = [ flake8 pycodestyle ]; propagatedBuildInputs = [ flake8 pycodestyle ]
++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
checkInputs = [ pytest ]; checkInputs = [ pytest ];

View File

@ -1,6 +1,7 @@
{ stdenv { stdenv
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, isPy27
, dateutil , dateutil
, six , six
, mock , mock
@ -19,6 +20,8 @@ buildPythonPackage rec {
propagatedBuildInputs = [ dateutil six ]; propagatedBuildInputs = [ dateutil six ];
checkInputs = [ mock nose pytest ]; checkInputs = [ mock nose pytest ];
# contains python3 specific code
doCheck = !isPy27;
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "FreezeGun: Let your Python tests travel through time"; description = "FreezeGun: Let your Python tests travel through time";

View File

@ -1,5 +1,5 @@
{ lib, fetchPypi, buildPythonPackage { lib, fetchPypi, buildPythonPackage, pythonOlder
, coverage, flake8, mock, nose , coverage, flake8, mock, nose, importlib-metadata
, cryptography }: , cryptography }:
buildPythonPackage rec { buildPythonPackage rec {
@ -11,7 +11,8 @@ buildPythonPackage rec {
sha256 = "1y5ln09ji4dwpzhxr77cggk02kghq7lql60a6969a5n2lwpvqblk"; sha256 = "1y5ln09ji4dwpzhxr77cggk02kghq7lql60a6969a5n2lwpvqblk";
}; };
propagatedBuildInputs = [ cryptography ]; propagatedBuildInputs = [ cryptography ]
++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
checkInputs = [ coverage flake8 mock nose ]; checkInputs = [ coverage flake8 mock nose ];

View File

@ -1,11 +1,13 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, isPy27
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "httptools"; pname = "httptools";
version = "0.1.1"; version = "0.1.1";
disabled = isPy27;
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -1,6 +1,7 @@
{ stdenv { stdenv
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, isPy27
, mock , mock
, setuptools_scm , setuptools_scm
}: }:
@ -8,6 +9,7 @@
buildPythonPackage rec { buildPythonPackage rec {
version = "2.4.0"; version = "2.4.0";
pname = "humanize"; pname = "humanize";
disabled = isPy27; # setup.py no longer compatible
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -1,8 +1,9 @@
{ lib, fetchPypi, buildPythonPackage, pytest } : { lib, fetchPypi, buildPythonPackage, isPy27, pytest } :
buildPythonPackage rec { buildPythonPackage rec {
pname = "inflection"; pname = "inflection";
version = "0.4.0"; version = "0.4.0";
disabled = isPy27;
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -1,12 +1,14 @@
{ stdenv { stdenv
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, isPy27
, pkgs , pkgs
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "limnoria"; pname = "limnoria";
version = "2020.04.11"; version = "2020.04.11";
disabled = isPy27; # abandoned upstream
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -0,0 +1,35 @@
{ lib
, buildPythonPackage
, fetchPypi
, fetchpatch
, hypothesis
, pycodestyle
, pyflakes
, pytest
, setuptools
, pkgs
}:
buildPythonPackage rec {
pname = "mutagen";
version = "1.43.0";
src = fetchPypi {
inherit pname version;
sha256 = "125m0pkiw5lsffc0236xdlxfhwpr8csvxpmg6855405qy4wjv61s";
};
propagatedBuildInputs = [ setuptools ];
checkInputs = [
pkgs.faad2 pkgs.flac pkgs.vorbis-tools pkgs.liboggz
pkgs.glibcLocales pycodestyle pyflakes pytest hypothesis
];
LC_ALL = "en_US.UTF-8";
meta = with lib; {
description = "Python multimedia tagging library";
homepage = "https://mutagen.readthedocs.io";
license = licenses.lgpl2Plus;
platforms = platforms.all;
};
}

View File

@ -1,6 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, isPy27
, fetchpatch , fetchpatch
, hypothesis , hypothesis
, pycodestyle , pycodestyle
@ -13,6 +14,7 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "mutagen"; pname = "mutagen";
version = "1.44.0"; version = "1.44.0";
disabled = isPy27; # abandoned
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -1,8 +1,9 @@
{ buildPythonPackage, fetchPypi, lib, pytest }: { buildPythonPackage, fetchPypi, lib, isPy27, pytest }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "ordered-set"; pname = "ordered-set";
version = "4.0.1"; version = "4.0.1";
disabled = isPy27;
checkInputs = [ pytest ]; checkInputs = [ pytest ];

View File

@ -1,6 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, isPy27
, appdirs , appdirs
, requests , requests
, pytest , pytest
@ -9,6 +10,7 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "pipdate"; pname = "pipdate";
version = "0.5.1"; version = "0.5.1";
disabled = isPy27; # abandoned
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, fetchPypi, pytest, isort }: { lib, buildPythonPackage, fetchPypi, isPy27, mock, pytest, isort }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "pytest-isort"; pname = "pytest-isort";
@ -11,7 +11,8 @@ buildPythonPackage rec {
propagatedBuildInputs = [ isort ]; propagatedBuildInputs = [ isort ];
checkInputs = [ pytest ]; checkInputs = [ pytest ]
++ lib.optionals isPy27 [ mock ];
checkPhase = '' checkPhase = ''
py.test -vs --cache-clear py.test -vs --cache-clear

View File

@ -1,6 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, isPy27
, pytest , pytest
, pytestCheckHook , pytestCheckHook
, psutil , psutil
@ -10,6 +11,7 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "pytest-openfiles"; pname = "pytest-openfiles";
version = "0.5.0"; version = "0.5.0";
disabled = isPy27; # abandoned
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -1,6 +1,7 @@
{ stdenv { stdenv
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, isPy27
, python , python
, pytest , pytest
, numpy , numpy
@ -9,6 +10,7 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "traits"; pname = "traits";
version = "6.1.0"; version = "6.1.0";
disabled = isPy27; # setup.py no longer py3 compat
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -4655,7 +4655,10 @@ in {
mutag = callPackage ../development/python-modules/mutag { }; mutag = callPackage ../development/python-modules/mutag { };
mutagen = callPackage ../development/python-modules/mutagen { }; mutagen = if isPy27 then
callPackage ../development/python-modules/mutagen/1.43.nix { }
else
callPackage ../development/python-modules/mutagen { };
muttils = callPackage ../development/python-modules/muttils { }; muttils = callPackage ../development/python-modules/muttils { };