Merge pull request #160067 from NixOS/python-updates

This commit is contained in:
Martin Weinelt
2022-03-02 22:24:21 +01:00
committed by GitHub
18 changed files with 292 additions and 87 deletions
@@ -28,6 +28,10 @@ buildPythonPackage rec {
pytest-asyncio
];
pytestFlagsArray = [
"--asyncio-mode=strict"
];
disabledTests = [
# https://github.com/aio-libs/async-lru/issues/341
"test_alru_cache_deco"
@@ -1,24 +0,0 @@
{ lib, buildPythonPackage, fetchPypi
, python-dateutil, requests }:
buildPythonPackage rec {
pname = "bitcoin-price-api";
version = "0.0.4";
src = fetchPypi {
inherit pname version;
sha256 = "bc68076f9632aaa9a8009d916d67a709c1e045dd904cfc7a3e8be33960d32029";
};
propagatedBuildInputs = [ python-dateutil requests ];
# No tests in archive
doCheck = false;
meta = {
homepage = "https://github.com/dursk/bitcoin-price-api";
description = "Price APIs for bitcoin exchanges";
license = with lib.licenses; [ mit ];
maintainers = with lib.maintainers; [ bhipple ];
};
}
@@ -1,4 +1,16 @@
{ buildPythonPackage, fetchFromGitHub, python, lib, django }:
{ lib
, buildPythonPackage
, fetchFromGitHub
# native
, setuptools-scm
# propagated
, django
# tests
, python
}:
buildPythonPackage rec {
pname = "django-widget-tweaks";
@@ -11,15 +23,26 @@ buildPythonPackage rec {
sha256 = "1rhn2skx287k6nnkxlwvl9snbia6w6z4c2rqg22hwzbz5w05b24h";
};
checkPhase = "${python.interpreter} runtests.py";
propagatedBuildInputs = [ django ];
SETUPTOOLS_SCM_PRETEND_VERSION = version;
nativeBuildInputs = [
setuptools-scm
];
propagatedBuildInputs = [
django
];
checkPhase = ''
${python.interpreter} -m django test --settings=tests.settings
'';
meta = with lib; {
description = "Tweak the form field rendering in templates, not in python-level form definitions.";
homepage = "https://github.com/jazzband/django-widget-tweaks";
license = licenses.mit;
maintainers = with maintainers; [
maxxk
];
description = "Tweak the form field rendering in templates, not in python-level form definitions.";
homepage = "https://github.com/jazzband/django-widget-tweaks";
license = licenses.mit;
maintainers = with maintainers; [
maxxk
];
};
}
@@ -9,10 +9,19 @@ buildPythonPackage rec {
sha256 = "0fb7b3fd03d76eddd4474b0561e1c2662457593a74cc300fd27e5409cd4d7922";
};
postPatch = ''
substituteInPlace setup.py \
--replace "lark-parser" "lark"
'';
propagatedBuildInputs = [ hypothesis lark libcst ];
checkInputs = [ black parso pytestCheckHook pytest-cov pytest-xdist ];
pytestFlagsArray = [
"--numprocesses $NIX_BUILD_CORES"
];
pythonImportsCheck = [ "hypothesmith" ];
meta = with lib; {
@@ -19,6 +19,7 @@ buildPythonPackage rec {
description = "An HTTP handler for `urllib2` that supports HTTP 1.1 and keepalive";
homepage = "https://github.com/wikier/keepalive";
license = licenses.asl20;
broken = true; # uses use_2to3, which is no longer supported for setuptools>=58
};
}
@@ -1,27 +0,0 @@
{ lib
, buildPythonPackage
, fetchPypi
, nose
}:
buildPythonPackage rec {
pname = "nose-cover3";
version = "0.1.0";
src = fetchPypi {
inherit pname version;
sha256 = "1la4hhc1yszjpcchvkqk5xmzlb2g1b3fgxj9wwc58qc549whlcc1";
};
propagatedBuildInputs = [ nose ];
# No tests included
doCheck = false;
meta = with lib; {
description = "Coverage 3.x support for Nose";
homepage = "https://github.com/ask/nosecover3";
license = licenses.lgpl21;
};
}
@@ -27,5 +27,6 @@ buildPythonPackage rec {
homepage = "https://github.com/msabramo/python_unittest_parameterized_test_case";
license = licenses.mit;
maintainers = with maintainers; [ dotlambda ];
broken = python.isPy3k; # uses use_2to3
};
}
@@ -8,13 +8,13 @@
buildPythonPackage rec {
pname = "parse-type";
version = "0.5.6";
version = "0.6.0";
src = fetchFromGitHub {
owner = "jenisys";
repo = "parse_type";
rev = "v${version}";
sha256 = "sha256-CJroqJIi5DpmR8i1lr8OJ+234615PhpVUsqK91XOT3E=";
sha256 = "sha256-v79zzAAwXYoK2N8ZPl1L90qOwMRexAV2wCTMvo4vrSc=";
};
propagatedBuildInputs = [
@@ -29,7 +29,7 @@ buildPythonPackage rec {
postPatch = ''
substituteInPlace pytest.ini \
--replace "--metadata PACKAGE_UNDER_TEST parse_type" "" \
--replace "--metadata PACKAGE_VERSION 0.5.6" "" \
--replace "--metadata PACKAGE_VERSION ${version}" "" \
--replace "--html=build/testing/report.html --self-contained-html" "" \
--replace "--junit-xml=build/testing/report.xml" ""
'';
@@ -22,6 +22,10 @@ buildPythonPackage rec {
pytest-mypy
];
disabledTests = [
"test_combined" # no longer compatible with setuptools>=58
];
meta = with lib; {
description = "A library to provide an easy API to file locking";
homepage = "https://github.com/WoLpH/portalocker";
@@ -60,6 +60,8 @@ buildPythonPackage rec {
"tests/test_numpy_dtypes.py"
# no need to test internal packaging
"tests/extra_python_package/test_files.py"
# tests that try to parse setuptools stdout
"tests/extra_setuptools/test_setuphelper.py"
];
meta = with lib; {
@@ -43,6 +43,12 @@ buildPythonPackage rec {
disabledTests = [
# https://github.com/pypa/readme_renderer/issues/221
"test_GFM_"
# Relies on old distutils behaviour removed by setuptools (TypeError: dist must be a Distribution instance)
"test_valid_rst"
"test_invalid_rst"
"test_malicious_rst"
"test_invalid_missing"
"test_invalid_empty"
];
pythonImportsCheck = [
@@ -10,7 +10,7 @@
let
pname = "setuptools";
version = "57.2.0";
version = "60.8.2";
# Create an sdist of setuptools
sdist = stdenv.mkDerivation rec {
@@ -20,12 +20,13 @@ let
owner = "pypa";
repo = pname;
rev = "v${version}";
sha256 = "sha256-zFmndVoATNxfvDsacY+gj5bzIbbd/8ldbsJj4qOawTA=";
sha256 = "1mqpmbn58rx3g24dm6wnllx0xs97ampn2yga3qypqgwnh1nk477i";
name = "${pname}-${version}-source";
};
patches = [
./tag-date.patch
./setuptools-distutils-C++.patch
];
buildPhase = ''
@@ -0,0 +1,216 @@
Based on pkgs/development/interpreters/python/cpython/3.7/python-3.x-distutils-C++.patch,
adapted to apply to setuptools 60.x's bundled distutils.
diff --git a/setuptools/_distutils/cygwinccompiler.py b/setuptools/_distutils/cygwinccompiler.py
index c5c86d8f..b879e447 100644
--- a/setuptools/_distutils/cygwinccompiler.py
+++ b/setuptools/_distutils/cygwinccompiler.py
@@ -124,14 +124,19 @@ class CygwinCCompiler(UnixCCompiler):
self.cxx = os.environ.get('CXX', 'g++')
self.linker_dll = self.cc
+ self.linker_dll_cxx = self.cxx
shared_option = "-shared"
self.set_executables(compiler='%s -mcygwin -O -Wall' % self.cc,
compiler_so='%s -mcygwin -mdll -O -Wall' % self.cc,
compiler_cxx='%s -mcygwin -O -Wall' % self.cxx,
+ compiler_so_cxx='%s -mcygwin -mdll -O -Wall' % self.cxx,
linker_exe='%s -mcygwin' % self.cc,
linker_so=('%s -mcygwin %s' %
- (self.linker_dll, shared_option)))
+ (self.linker_dll, shared_option)),
+ linker_exe_cxx='%s -mcygwin' % self.cxx,
+ linker_so_cxx=('%s -mcygwin %s' %
+ (self.linker_dll_cxx, shared_option)))
# Include the appropriate MSVC runtime library if Python was built
# with MSVC 7.0 or later.
@@ -162,8 +167,12 @@ class CygwinCCompiler(UnixCCompiler):
raise CompileError(msg)
else: # for other files use the C-compiler
try:
- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
- extra_postargs)
+ if self.detect_language(src) == 'c++':
+ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
+ extra_postargs)
+ else:
+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
+ extra_postargs)
except DistutilsExecError as msg:
raise CompileError(msg)
@@ -279,9 +288,13 @@ class Mingw32CCompiler(CygwinCCompiler):
self.set_executables(compiler='%s -O -Wall' % self.cc,
compiler_so='%s -mdll -O -Wall' % self.cc,
compiler_cxx='%s -O -Wall' % self.cxx,
+ compiler_so_cxx='%s -mdll -O -Wall' % self.cxx,
linker_exe='%s' % self.cc,
linker_so='%s %s'
- % (self.linker_dll, shared_option))
+ % (self.linker_dll, shared_option),
+ linker_exe_cxx='%s' % self.cxx,
+ linker_so_cxx='%s %s'
+ % (self.linker_dll_cxx, shared_option))
# Maybe we should also append -mthreads, but then the finished
# dlls need another dll (mingwm10.dll see Mingw32 docs)
diff --git a/setuptools/_distutils/sysconfig.py b/setuptools/_distutils/sysconfig.py
index 4a77a431..1ad85181 100644
--- a/setuptools/_distutils/sysconfig.py
+++ b/setuptools/_distutils/sysconfig.py
@@ -216,9 +216,11 @@ def customize_compiler(compiler):
_osx_support.customize_compiler(_config_vars)
_config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
- (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
- get_config_vars('CC', 'CXX', 'CFLAGS',
- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
+ (cc, cxx, cflags, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \
+ get_config_vars('CC', 'CXX', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
+ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
+
+ cxxflags = cflags
if 'CC' in os.environ:
newcc = os.environ['CC']
@@ -232,19 +234,27 @@ def customize_compiler(compiler):
cxx = os.environ['CXX']
if 'LDSHARED' in os.environ:
ldshared = os.environ['LDSHARED']
+ if 'LDCXXSHARED' in os.environ:
+ ldcxxshared = os.environ['LDCXXSHARED']
if 'CPP' in os.environ:
cpp = os.environ['CPP']
else:
cpp = cc + " -E" # not always
if 'LDFLAGS' in os.environ:
ldshared = ldshared + ' ' + os.environ['LDFLAGS']
+ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
if 'CFLAGS' in os.environ:
- cflags = cflags + ' ' + os.environ['CFLAGS']
+ cflags = os.environ['CFLAGS']
ldshared = ldshared + ' ' + os.environ['CFLAGS']
+ if 'CXXFLAGS' in os.environ:
+ cxxflags = os.environ['CXXFLAGS']
+ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
if 'CPPFLAGS' in os.environ:
cpp = cpp + ' ' + os.environ['CPPFLAGS']
cflags = cflags + ' ' + os.environ['CPPFLAGS']
+ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
+ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
if 'AR' in os.environ:
ar = os.environ['AR']
if 'ARFLAGS' in os.environ:
@@ -253,13 +263,17 @@ def customize_compiler(compiler):
archiver = ar + ' ' + ar_flags
cc_cmd = cc + ' ' + cflags
+ cxx_cmd = cxx + ' ' + cxxflags
compiler.set_executables(
preprocessor=cpp,
compiler=cc_cmd,
compiler_so=cc_cmd + ' ' + ccshared,
- compiler_cxx=cxx,
+ compiler_cxx=cxx_cmd,
+ compiler_so_cxx=cxx_cmd + ' ' + ccshared,
linker_so=ldshared,
linker_exe=cc,
+ linker_so_cxx=ldcxxshared,
+ linker_exe_cxx=cxx,
archiver=archiver)
if 'RANLIB' in os.environ and compiler.executables.get('ranlib', None):
diff --git a/setuptools/_distutils/unixccompiler.py b/setuptools/_distutils/unixccompiler.py
index a07e5988..576ef490 100644
--- a/setuptools/_distutils/unixccompiler.py
+++ b/setuptools/_distutils/unixccompiler.py
@@ -52,14 +52,17 @@ class UnixCCompiler(CCompiler):
# are pretty generic; they will probably have to be set by an outsider
# (eg. using information discovered by the sysconfig about building
# Python extensions).
- executables = {'preprocessor' : None,
- 'compiler' : ["cc"],
- 'compiler_so' : ["cc"],
- 'compiler_cxx' : ["cc"],
- 'linker_so' : ["cc", "-shared"],
- 'linker_exe' : ["cc"],
- 'archiver' : ["ar", "-cr"],
- 'ranlib' : None,
+ executables = {'preprocessor' : None,
+ 'compiler' : ["cc"],
+ 'compiler_so' : ["cc"],
+ 'compiler_cxx' : ["c++"],
+ 'compiler_so_cxx' : ["c++"],
+ 'linker_so' : ["cc", "-shared"],
+ 'linker_exe' : ["cc"],
+ 'linker_so_cxx' : ["c++", "-shared"],
+ 'linker_exe_cxx' : ["c++"],
+ 'archiver' : ["ar", "-cr"],
+ 'ranlib' : None,
}
if sys.platform[:6] == "darwin":
@@ -110,12 +113,19 @@ class UnixCCompiler(CCompiler):
def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
compiler_so = self.compiler_so
+ compiler_so_cxx = self.compiler_so_cxx
if sys.platform == 'darwin':
compiler_so = _osx_support.compiler_fixup(compiler_so,
cc_args + extra_postargs)
+ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx,
+ cc_args + extra_postargs)
try:
- self.spawn(compiler_so + cc_args + [src, '-o', obj] +
- extra_postargs)
+ if self.detect_language(src) == 'c++':
+ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] +
+ extra_postargs)
+ else:
+ self.spawn(compiler_so + cc_args + [src, '-o', obj] +
+ extra_postargs)
except DistutilsExecError as msg:
raise CompileError(msg)
@@ -173,30 +183,16 @@ class UnixCCompiler(CCompiler):
ld_args.extend(extra_postargs)
self.mkpath(os.path.dirname(output_filename))
try:
- if target_desc == CCompiler.EXECUTABLE:
- linker = self.linker_exe[:]
+ if target_lang == "c++":
+ if target_desc == CCompiler.EXECUTABLE:
+ linker = self.linker_exe_cxx[:]
+ else:
+ linker = self.linker_so_cxx[:]
else:
- linker = self.linker_so[:]
- if target_lang == "c++" and self.compiler_cxx:
- # skip over environment variable settings if /usr/bin/env
- # is used to set up the linker's environment.
- # This is needed on OSX. Note: this assumes that the
- # normal and C++ compiler have the same environment
- # settings.
- i = 0
- if os.path.basename(linker[0]) == "env":
- i = 1
- while '=' in linker[i]:
- i += 1
-
- if os.path.basename(linker[i]) == 'ld_so_aix':
- # AIX platforms prefix the compiler with the ld_so_aix
- # script, so we need to adjust our linker index
- offset = 1
+ if target_desc == CCompiler.EXECUTABLE:
+ linker = self.linker_exe[:]
else:
- offset = 0
-
- linker[i+offset] = self.compiler_cxx[i]
+ linker = self.linker_so[:]
if sys.platform == 'darwin':
linker = _osx_support.compiler_fixup(linker, ld_args)
+3 -1
View File
@@ -50,7 +50,9 @@ with python3Packages; buildPythonApplication rec {
checkInputs = [ nose ];
checkPhase = ''
${python.interpreter} setup.py nosetests
runHook preCheck
${python.interpreter} -m nose
runHook postCheck
'';
passthru.tests = { inherit (nixosTests) isso; };
@@ -481,18 +481,6 @@ let
};
});
PyGithub = super.PyGithub.overridePythonAttrs(oldAttrs: rec {
version = "1.38";
src = super.fetchPypi {
inherit (oldAttrs) pname;
inherit version;
sha256 = "sha256-HtCPd17FBnvIRStyveLbuVz05S/yvVDMMsackf+tknI=";
};
doCheck = false;
});
knack = super.knack.overridePythonAttrs(oldAttrs: rec {
version = "0.9.0";
+2
View File
@@ -35,6 +35,7 @@ in
mapAliases ({
anyjson = throw "anyjson has been removed, it was using setuptools 2to3 translation feature, which has been removed in setuptools 58"; # added 2022-01-18
asyncio-nats-client = nats-py; # added 2022-02-08
bitcoin-price-api = throw "bitcoin-price-api has been removed, it was using setuptools 2to3 translation feautre, which has been removed in setuptools 58"; # added 2022-02-15
blockdiagcontrib-cisco = throw "blockdiagcontrib-cisco is not compatible with blockdiag 2.0.0 and has been removed."; # added 2020-11-29
bt_proximity = bt-proximity; # added 2021-07-02
bugseverywhere = throw "bugseverywhere has been removed: Abandoned by upstream."; # added 2019-11-27
@@ -73,6 +74,7 @@ mapAliases ({
lammps-cython = throw "lammps-cython no longer builds and is unmaintained"; # added 2021-07-04
Markups = markups; # added 2022-02-14
MechanicalSoup = mechanicalsoup; # added 2021-06-01
nose-cover3 = throw "nose-cover3 has been removed, it was using setuptools 2to3 translation feature, which has been removed in setuptools 58"; # added 2022-02-16
pam = python-pam; # added 2020-09-07.
PasteDeploy = pastedeploy; # added 2021-10-07
powerlineMemSegment = powerline-mem-segment; # added 2021-10-08
-4
View File
@@ -1214,8 +1214,6 @@ in {
bitcoinlib = callPackage ../development/python-modules/bitcoinlib { };
bitcoin-price-api = callPackage ../development/python-modules/bitcoin-price-api { };
bitcoin-utils-fork-minimal = callPackage ../development/python-modules/bitcoin-utils-fork-minimal { };
bitcoinrpc = callPackage ../development/python-modules/bitcoinrpc { };
@@ -5542,8 +5540,6 @@ in {
nose-cov = callPackage ../development/python-modules/nose-cov { };
nose-cover3 = callPackage ../development/python-modules/nose-cover3 { };
nose-cprof = callPackage ../development/python-modules/nose-cprof { };
nose-exclude = callPackage ../development/python-modules/nose-exclude { };
+6 -5
View File
@@ -35,11 +35,12 @@ let
name = "python-tested";
meta.description = "Release-critical packages from the python package sets";
constituents = [
jobs.remarshal.x86_64-linux # Used in pkgs.formats helper
jobs.python39Packages.colorama.x86_64-linux # Used in nixos test-driver
jobs.python39Packages.ptpython.x86_64-linux # Used in nixos test-driver
jobs.python39Packages.requests.x86_64-linux # Almost ubiquous package
jobs.python39Packages.sphinx.x86_64-linux # Document creation for many packages
jobs.remarshal.x86_64-linux # Used in pkgs.formats helper
jobs.python39Packages.buildcatrust.x86_64-linux # Used in pkgs.cacert
jobs.python39Packages.colorama.x86_64-linux # Used in nixos test-driver
jobs.python39Packages.ptpython.x86_64-linux # Used in nixos test-driver
jobs.python39Packages.requests.x86_64-linux # Almost ubiquous package
jobs.python39Packages.sphinx.x86_64-linux # Document creation for many packages
];
};