Merge pull request #203385 from mweinelt/cpython-cleanup

This commit is contained in:
Martin Weinelt
2022-11-29 01:55:03 +01:00
committed by GitHub
53 changed files with 94 additions and 1243 deletions
@@ -3,14 +3,12 @@
, buildPythonApplication
, fetchFromGitHub
, python3
, pythonOlder
, html5lib
, invoke
, openpyxl
, poetry-core
, tidylib
, beautifulsoup4
, dataclasses
, datauri
, docutils
, jinja2
@@ -73,8 +71,6 @@ buildPythonApplication rec {
textx
xlrd
XlsxWriter
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
];
checkInputs = [
@@ -1,7 +1,7 @@
{ lib, buildPythonApplication, fetchPypi, pythonOlder
, installShellFiles
, mock, pytest, nose
, pyyaml, backports_ssl_match_hostname, colorama, docopt
, pyyaml, colorama, docopt
, dockerpty, docker, jsonschema, requests
, six, texttable, websocket-client, cached-property
, enum34, functools32, paramiko, distro, python-dotenv
@@ -24,7 +24,7 @@ buildPythonApplication rec {
pyyaml colorama dockerpty docker
jsonschema requests six texttable websocket-client
docopt cached-property paramiko distro python-dotenv
] ++ lib.optional (pythonOlder "3.7") backports_ssl_match_hostname
]
++ lib.optional (pythonOlder "3.4") enum34
++ lib.optional (pythonOlder "3.2") functools32;
@@ -1,17 +0,0 @@
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -139,3 +139,4 @@
source_stats = loader.path_stats(file)
+ source_mtime = 1 if 'DETERMINISTIC_BUILD' in os.environ else source_stats['mtime']
bytecode = importlib._bootstrap_external._code_to_bytecode(
- code, source_stats['mtime'], source_stats['size'])
+ code, source_mtime, source_stats['size'])
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -485,5 +485,5 @@
if source_stats is not None:
try:
- source_mtime = int(source_stats['mtime'])
+ source_mtime = 1
except KeyError:
pass
@@ -1,51 +0,0 @@
From 918201682127ed8a270a4bd1a448b490019e4ada Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Thu, 14 Sep 2017 10:00:31 +0200
Subject: [PATCH] ctypes.util: support LD_LIBRARY_PATH
Backports support for LD_LIBRARY_PATH from 3.6
---
Lib/ctypes/util.py | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
index e9957d7951..9926f6c881 100644
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -219,8 +219,32 @@ elif os.name == "posix":
def _findSoname_ldconfig(name):
return None
+ def _findLib_ld(name):
+ # See issue #9998 for why this is needed
+ expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)
+ cmd = ['ld', '-t']
+ libpath = os.environ.get('LD_LIBRARY_PATH')
+ if libpath:
+ for d in libpath.split(':'):
+ cmd.extend(['-L', d])
+ cmd.extend(['-o', os.devnull, '-l%s' % name])
+ result = None
+ try:
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ universal_newlines=True)
+ out, _ = p.communicate()
+ res = re.search(expr, os.fsdecode(out))
+ if res:
+ result = res.group(0)
+ except Exception as e:
+ pass # result will be None
+ return result
+
def find_library(name):
- return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name))
+ # See issue #9998
+ return _findSoname_ldconfig(name) or \
+ _get_soname(_findLib_gcc(name) or _findLib_ld(name))
################################################################
# test code
--
2.14.1
@@ -1,164 +0,0 @@
From 590c46bb04f79ab611b2f8fd682dd7e43a01f268 Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Mon, 28 Aug 2017 09:24:06 +0200
Subject: [PATCH] Don't use ldconfig and speed up uuid load
---
Lib/ctypes/util.py | 70 ++----------------------------------------------------
Lib/uuid.py | 49 --------------------------------------
2 files changed, 2 insertions(+), 117 deletions(-)
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
index 7684eab81d..e9957d7951 100644
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -95,46 +95,7 @@ elif os.name == "posix":
import re, tempfile
def _findLib_gcc(name):
- # Run GCC's linker with the -t (aka --trace) option and examine the
- # library name it prints out. The GCC command will fail because we
- # haven't supplied a proper program with main(), but that does not
- # matter.
- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name))
-
- c_compiler = shutil.which('gcc')
- if not c_compiler:
- c_compiler = shutil.which('cc')
- if not c_compiler:
- # No C compiler available, give up
- return None
-
- temp = tempfile.NamedTemporaryFile()
- try:
- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name]
-
- env = dict(os.environ)
- env['LC_ALL'] = 'C'
- env['LANG'] = 'C'
- try:
- proc = subprocess.Popen(args,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT,
- env=env)
- except OSError: # E.g. bad executable
- return None
- with proc:
- trace = proc.stdout.read()
- finally:
- try:
- temp.close()
- except FileNotFoundError:
- # Raised if the file was already removed, which is the normal
- # behaviour of GCC if linking fails
- pass
- res = re.search(expr, trace)
- if not res:
- return None
- return os.fsdecode(res.group(0))
+ return None
if sys.platform == "sunos5":
@@ -256,34 +217,7 @@ elif os.name == "posix":
else:
def _findSoname_ldconfig(name):
- import struct
- if struct.calcsize('l') == 4:
- machine = os.uname().machine + '-32'
- else:
- machine = os.uname().machine + '-64'
- mach_map = {
- 'x86_64-64': 'libc6,x86-64',
- 'ppc64-64': 'libc6,64bit',
- 'sparc64-64': 'libc6,64bit',
- 's390x-64': 'libc6,64bit',
- 'ia64-64': 'libc6,IA-64',
- }
- abi_type = mach_map.get(machine, 'libc6')
-
- # XXX assuming GLIBC's ldconfig (with option -p)
- regex = os.fsencode(
- '\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type))
- try:
- with subprocess.Popen(['/sbin/ldconfig', '-p'],
- stdin=subprocess.DEVNULL,
- stderr=subprocess.DEVNULL,
- stdout=subprocess.PIPE,
- env={'LC_ALL': 'C', 'LANG': 'C'}) as p:
- res = re.search(regex, p.stdout.read())
- if res:
- return os.fsdecode(res.group(1))
- except OSError:
- pass
+ return None
def find_library(name):
return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name))
diff --git a/Lib/uuid.py b/Lib/uuid.py
index e96e7e034c..31160ace95 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -455,58 +455,9 @@ def _netbios_getnode():
continue
return int.from_bytes(bytes, 'big')
-# Thanks to Thomas Heller for ctypes and for his help with its use here.
-# If ctypes is available, use it to find system routines for UUID generation.
-# XXX This makes the module non-thread-safe!
_uuid_generate_time = _UuidCreate = None
-try:
- import ctypes, ctypes.util
- import sys
- # The uuid_generate_* routines are provided by libuuid on at least
- # Linux and FreeBSD, and provided by libc on Mac OS X.
- _libnames = ['uuid']
- if not sys.platform.startswith('win'):
- _libnames.append('c')
- for libname in _libnames:
- try:
- lib = ctypes.CDLL(ctypes.util.find_library(libname))
- except Exception:
- continue
- if hasattr(lib, 'uuid_generate_time'):
- _uuid_generate_time = lib.uuid_generate_time
- break
- del _libnames
-
- # The uuid_generate_* functions are broken on MacOS X 10.5, as noted
- # in issue #8621 the function generates the same sequence of values
- # in the parent process and all children created using fork (unless
- # those children use exec as well).
- #
- # Assume that the uuid_generate functions are broken from 10.5 onward,
- # the test can be adjusted when a later version is fixed.
- if sys.platform == 'darwin':
- import os
- if int(os.uname().release.split('.')[0]) >= 9:
- _uuid_generate_time = None
-
- # On Windows prior to 2000, UuidCreate gives a UUID containing the
- # hardware address. On Windows 2000 and later, UuidCreate makes a
- # random UUID and UuidCreateSequential gives a UUID containing the
- # hardware address. These routines are provided by the RPC runtime.
- # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last
- # 6 bytes returned by UuidCreateSequential are fixed, they don't appear
- # to bear any relationship to the MAC address of any network device
- # on the box.
- try:
- lib = ctypes.windll.rpcrt4
- except:
- lib = None
- _UuidCreate = getattr(lib, 'UuidCreateSequential',
- getattr(lib, 'UuidCreate', None))
-except:
- pass
def _unixdll_getnode():
"""Get the hardware address on Unix using ctypes."""
--
2.14.1
@@ -1,21 +0,0 @@
Backport from CPython 3.8 of a good list of tests to run for PGO.
Upstream commit:
https://github.com/python/cpython/commit/4e16a4a31
Upstream discussion:
https://bugs.python.org/issue36044
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 00fdd21ce..713dc1e53 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -259,7 +259,7 @@ TCLTK_LIBS=
# The task to run while instrumented when building the profile-opt target.
# We exclude unittests with -x that take a rediculious amount of time to
# run in the instrumented training build or do not provide much value.
-PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_subprocess
+PROFILE_TASK=-m test.regrtest --pgo test_array test_base64 test_binascii test_binop test_bisect test_bytes test_bz2 test_cmath test_codecs test_collections test_complex test_dataclasses test_datetime test_decimal test_difflib test_embed test_float test_fstring test_functools test_generators test_hashlib test_heapq test_int test_itertools test_json test_long test_lzma test_math test_memoryview test_operator test_ordered_dict test_pickle test_pprint test_re test_set test_sqlite test_statistics test_struct test_tabnanny test_time test_unicode test_xml_etree test_xml_etree_c
# report files for gcov / lcov coverage report
COVERAGE_INFO= $(abs_builddir)/coverage.info
@@ -1,237 +0,0 @@
Source: https://bugs.python.org/file47046/python-3.x-distutils-C++.patch
--- a/Lib/distutils/cygwinccompiler.py
+++ b/Lib/distutils/cygwinccompiler.py
@@ -125,8 +125,10 @@
# dllwrap 2.10.90 is buggy
if self.ld_version >= "2.10.90":
self.linker_dll = "gcc"
+ self.linker_dll_cxx = "g++"
else:
self.linker_dll = "dllwrap"
+ self.linker_dll_cxx = "dllwrap"
# ld_version >= "2.13" support -shared so use it instead of
# -mdll -static
@@ -140,9 +142,13 @@
self.set_executables(compiler='gcc -mcygwin -O -Wall',
compiler_so='gcc -mcygwin -mdll -O -Wall',
compiler_cxx='g++ -mcygwin -O -Wall',
+ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall',
linker_exe='gcc -mcygwin',
linker_so=('%s -mcygwin %s' %
- (self.linker_dll, shared_option)))
+ (self.linker_dll, shared_option)),
+ linker_exe_cxx='g++ -mcygwin',
+ linker_so_cxx=('%s -mcygwin %s' %
+ (self.linker_dll_cxx, shared_option)))
# cygwin and mingw32 need different sets of libraries
if self.gcc_version == "2.91.57":
@@ -166,8 +172,12 @@
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)
@@ -302,9 +312,14 @@
self.set_executables(compiler='gcc -O -Wall',
compiler_so='gcc -mdll -O -Wall',
compiler_cxx='g++ -O -Wall',
+ compiler_so_cxx='g++ -mdll -O -Wall',
linker_exe='gcc',
linker_so='%s %s %s'
% (self.linker_dll, shared_option,
+ entry_point),
+ linker_exe_cxx='g++',
+ linker_so_cxx='%s %s %s'
+ % (self.linker_dll_cxx, shared_option,
entry_point))
# Maybe we should also append -mthreads, but then the finished
# dlls need another dll (mingwm10.dll see Mingw32 docs)
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -184,9 +184,11 @@
_osx_support.customize_compiler(_config_vars)
_config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
- get_config_vars('CC', 'CXX', 'OPT', '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']
@@ -201,19 +204,27 @@
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 = opt + ' ' + 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:
@@ -222,13 +233,17 @@
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)
compiler.shared_lib_extension = shlib_suffix
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -52,14 +52,17 @@
# 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":
@@ -108,12 +111,19 @@
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)
@@ -171,22 +181,16 @@
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
- linker[i] = self.compiler_cxx[i]
+ if target_desc == CCompiler.EXECUTABLE:
+ linker = self.linker_exe[:]
+ else:
+ linker = self.linker_so[:]
if sys.platform == 'darwin':
linker = _osx_support.compiler_fixup(linker, ld_args)
--- a/Lib/_osx_support.py
+++ b/Lib/_osx_support.py
@@ -14,13 +14,13 @@
# configuration variables that may contain universal build flags,
# like "-arch" or "-isdkroot", that may need customization for
# the user environment
-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS',
- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX',
- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS',
- 'PY_CORE_CFLAGS')
+_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS',
+ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED',
+ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS',
+ 'PY_CPPFLAGS', 'PY_CORE_CFLAGS')
# configuration variables that may contain compiler calls
-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX')
+_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX')
# prefix added to original configuration variable names
_INITPRE = '_OSX_SUPPORT_INITIAL_'
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -538,7 +538,7 @@
*\ -s*|s*) quiet="-q";; \
*) quiet="";; \
esac; \
- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
@@ -1,48 +0,0 @@
diff --git a/setup.py b/setup.py
index 2779658..902d0eb 100644
--- a/setup.py
+++ b/setup.py
@@ -1699,9 +1699,6 @@ class PyBuildExt(build_ext):
# Rather than complicate the code below, detecting and building
# AquaTk is a separate method. Only one Tkinter will be built on
# Darwin - either AquaTk, if it is found, or X11 based Tk.
- if (host_platform == 'darwin' and
- self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
- return
# Assume we haven't found any of the libraries or include files
# The versions with dots are used on Unix, and the versions without
@@ -1747,22 +1744,6 @@ class PyBuildExt(build_ext):
if dir not in include_dirs:
include_dirs.append(dir)
- # Check for various platform-specific directories
- if host_platform == 'sunos5':
- include_dirs.append('/usr/openwin/include')
- added_lib_dirs.append('/usr/openwin/lib')
- elif os.path.exists('/usr/X11R6/include'):
- include_dirs.append('/usr/X11R6/include')
- added_lib_dirs.append('/usr/X11R6/lib64')
- added_lib_dirs.append('/usr/X11R6/lib')
- elif os.path.exists('/usr/X11R5/include'):
- include_dirs.append('/usr/X11R5/include')
- added_lib_dirs.append('/usr/X11R5/lib')
- else:
- # Assume default location for X11
- include_dirs.append('/usr/X11/include')
- added_lib_dirs.append('/usr/X11/lib')
-
# If Cygwin, then verify that X is installed before proceeding
if host_platform == 'cygwin':
x11_inc = find_file('X11/Xlib.h', [], include_dirs)
@@ -1786,10 +1767,6 @@ class PyBuildExt(build_ext):
if host_platform in ['aix3', 'aix4']:
libs.append('ld')
- # Finally, link with the X11 libraries (not appropriate on cygwin)
- if host_platform != "cygwin":
- libs.append('X11')
-
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
define_macros=[('WITH_APPINIT', 1)] + defs,
include_dirs = include_dirs,
@@ -1,105 +0,0 @@
From 9b5a023a5dc3127da15253f7acad71019395ebe1 Mon Sep 17 00:00:00 2001
From: Pablo Galindo <Pablogsal@gmail.com>
Date: Thu, 8 Oct 2020 19:50:37 +0100
Subject: [PATCH] [3.7] bpo-41976: Fix the fallback to gcc of
ctypes.util.find_library when using gcc>9 (GH-22598). (GH-22601)
(cherry picked from commit 27ac19cca2c639caaf6fedf3632fe6beb265f24f)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
---
Lib/ctypes/test/test_find.py | 12 ++++++-
Lib/ctypes/util.py | 32 +++++++++++++++----
.../2020-10-08-18-22-28.bpo-41976.Svm0wb.rst | 3 ++
3 files changed, 39 insertions(+), 8 deletions(-)
create mode 100644 Misc/NEWS.d/next/Library/2020-10-08-18-22-28.bpo-41976.Svm0wb.rst
diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py
index b99fdcba7b28f..92ac1840ad7d4 100644
--- a/Lib/ctypes/test/test_find.py
+++ b/Lib/ctypes/test/test_find.py
@@ -1,4 +1,5 @@
import unittest
+import unittest.mock
import os.path
import sys
import test.support
@@ -72,7 +73,7 @@ def test_shell_injection(self):
@unittest.skipUnless(sys.platform.startswith('linux'),
'Test only valid for Linux')
-class LibPathFindTest(unittest.TestCase):
+class FindLibraryLinux(unittest.TestCase):
def test_find_on_libpath(self):
import subprocess
import tempfile
@@ -111,6 +112,15 @@ def test_find_on_libpath(self):
# LD_LIBRARY_PATH)
self.assertEqual(find_library(libname), 'lib%s.so' % libname)
+ def test_find_library_with_gcc(self):
+ with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None):
+ self.assertNotEqual(find_library('c'), None)
+
+ def test_find_library_with_ld(self):
+ with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None), \
+ unittest.mock.patch("ctypes.util._findLib_gcc", lambda *args: None):
+ self.assertNotEqual(find_library('c'), None)
+
if __name__ == "__main__":
unittest.main()
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
index 97973bce001d9..0c2510e1619c8 100644
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -93,6 +93,12 @@ def find_library(name):
# Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump
import re, tempfile
+ def _is_elf(filename):
+ "Return True if the given file is an ELF file"
+ elf_header = b'\x7fELF'
+ with open(filename, 'br') as thefile:
+ return thefile.read(4) == elf_header
+
def _findLib_gcc(name):
# Run GCC's linker with the -t (aka --trace) option and examine the
# library name it prints out. The GCC command will fail because we
@@ -299,17 +312,22 @@ def _findLib_ld(name):
stderr=subprocess.PIPE,
universal_newlines=True)
out, _ = p.communicate()
- res = re.search(expr, os.fsdecode(out))
- if res:
- result = res.group(0)
- except Exception as e:
+ res = re.findall(expr, os.fsdecode(out))
+ for file in res:
+ # Check if the given file is an elf file: gcc can report
+ # some files that are linker scripts and not actual
+ # shared objects. See bpo-41976 for more details
+ if not _is_elf(file):
+ continue
+ return os.fsdecode(file)
+ except Exception:
pass # result will be None
return result
def find_library(name):
# See issue #9998
return _findSoname_ldconfig(name) or \
- _get_soname(_findLib_gcc(name) or _findLib_ld(name))
+ _get_soname(_findLib_gcc(name)) or _get_soname(_findLib_ld(name))
################################################################
# test code
diff --git a/Misc/NEWS.d/next/Library/2020-10-08-18-22-28.bpo-41976.Svm0wb.rst b/Misc/NEWS.d/next/Library/2020-10-08-18-22-28.bpo-41976.Svm0wb.rst
new file mode 100644
index 0000000000000..c8b3fc771845e
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-10-08-18-22-28.bpo-41976.Svm0wb.rst
@@ -0,0 +1,3 @@
+Fixed a bug that was causing :func:`ctypes.util.find_library` to return
+``None`` when triying to locate a library in an environment when gcc>=9 is
+available and ``ldconfig`` is not. Patch by Pablo Galindo
@@ -1,54 +0,0 @@
From 45dfbbb4f5b67ab83e4365564ea569334e979f8e Mon Sep 17 00:00:00 2001
From: Ben Wolsieffer <benwolsieffer@gmail.com>
Date: Fri, 25 Sep 2020 16:49:16 -0400
Subject: [PATCH] Fix finding headers when cross compiling
When cross-compiling third-party extensions, get_python_inc() may be called to
return the path to Python's headers. However, it uses the sys.prefix or
sys.exec_prefix of the build Python, which returns incorrect paths when
cross-compiling (paths pointing to build system headers).
To fix this, we use the INCLUDEPY and CONFINCLUDEPY conf variables, which can
be configured to point at host Python by setting _PYTHON_SYSCONFIGDATA_NAME.
The existing behavior is maintained on non-POSIX platforms or if a prefix is
manually specified.
---
Lib/distutils/sysconfig.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 2bcd1dd288..567375e488 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -84,8 +84,6 @@ def get_python_inc(plat_specific=0, prefix=None):
If 'prefix' is supplied, use it instead of sys.base_prefix or
sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
"""
- if prefix is None:
- prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
if os.name == "posix":
if python_build:
# Assume the executable is in the build directory. The
@@ -98,9 +96,17 @@ def get_python_inc(plat_specific=0, prefix=None):
else:
incdir = os.path.join(get_config_var('srcdir'), 'Include')
return os.path.normpath(incdir)
- python_dir = 'python' + get_python_version() + build_flags
- return os.path.join(prefix, "include", python_dir)
+ if prefix is None:
+ if plat_specific:
+ return get_config_var('CONFINCLUDEPY')
+ else:
+ return get_config_var('INCLUDEPY')
+ else:
+ python_dir = 'python' + get_python_version() + build_flags
+ return os.path.join(prefix, "include", python_dir)
elif os.name == "nt":
+ if prefix is None:
+ prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
return os.path.join(prefix, "include")
else:
raise DistutilsPlatformError(
--
2.28.0
@@ -1,163 +0,0 @@
From 105621b99cc30615c79b5aa3d12d6732e14b0d59 Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Mon, 28 Aug 2017 09:24:06 +0200
Subject: [PATCH] Don't use ldconfig and speed up uuid load
---
Lib/ctypes/util.py | 70 ++----------------------------------------------------
Lib/uuid.py | 48 -------------------------------------
2 files changed, 2 insertions(+), 116 deletions(-)
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
index 339ae8aa8a..2944985c30 100644
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -85,46 +85,7 @@ elif os.name == "posix":
import re, tempfile
def _findLib_gcc(name):
- # Run GCC's linker with the -t (aka --trace) option and examine the
- # library name it prints out. The GCC command will fail because we
- # haven't supplied a proper program with main(), but that does not
- # matter.
- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name))
-
- c_compiler = shutil.which('gcc')
- if not c_compiler:
- c_compiler = shutil.which('cc')
- if not c_compiler:
- # No C compiler available, give up
- return None
-
- temp = tempfile.NamedTemporaryFile()
- try:
- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name]
-
- env = dict(os.environ)
- env['LC_ALL'] = 'C'
- env['LANG'] = 'C'
- try:
- proc = subprocess.Popen(args,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT,
- env=env)
- except OSError: # E.g. bad executable
- return None
- with proc:
- trace = proc.stdout.read()
- finally:
- try:
- temp.close()
- except FileNotFoundError:
- # Raised if the file was already removed, which is the normal
- # behaviour of GCC if linking fails
- pass
- res = re.search(expr, trace)
- if not res:
- return None
- return os.fsdecode(res.group(0))
+ return None
if sys.platform == "sunos5":
@@ -246,34 +207,7 @@ elif os.name == "posix":
else:
def _findSoname_ldconfig(name):
- import struct
- if struct.calcsize('l') == 4:
- machine = os.uname().machine + '-32'
- else:
- machine = os.uname().machine + '-64'
- mach_map = {
- 'x86_64-64': 'libc6,x86-64',
- 'ppc64-64': 'libc6,64bit',
- 'sparc64-64': 'libc6,64bit',
- 's390x-64': 'libc6,64bit',
- 'ia64-64': 'libc6,IA-64',
- }
- abi_type = mach_map.get(machine, 'libc6')
-
- # XXX assuming GLIBC's ldconfig (with option -p)
- regex = r'\s+(lib%s\.[^\s]+)\s+\(%s'
- regex = os.fsencode(regex % (re.escape(name), abi_type))
- try:
- with subprocess.Popen(['/sbin/ldconfig', '-p'],
- stdin=subprocess.DEVNULL,
- stderr=subprocess.DEVNULL,
- stdout=subprocess.PIPE,
- env={'LC_ALL': 'C', 'LANG': 'C'}) as p:
- res = re.search(regex, p.stdout.read())
- if res:
- return os.fsdecode(res.group(1))
- except OSError:
- pass
+ return None
def _findLib_ld(name):
# See issue #9998 for why this is needed
diff --git a/Lib/uuid.py b/Lib/uuid.py
index 200c800b34..31160ace95 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -455,57 +455,9 @@ def _netbios_getnode():
continue
return int.from_bytes(bytes, 'big')
-# Thanks to Thomas Heller for ctypes and for his help with its use here.
-# If ctypes is available, use it to find system routines for UUID generation.
-# XXX This makes the module non-thread-safe!
_uuid_generate_time = _UuidCreate = None
-try:
- import ctypes, ctypes.util
- import sys
- # The uuid_generate_* routines are provided by libuuid on at least
- # Linux and FreeBSD, and provided by libc on Mac OS X.
- _libnames = ['uuid']
- if not sys.platform.startswith('win'):
- _libnames.append('c')
- for libname in _libnames:
- try:
- lib = ctypes.CDLL(ctypes.util.find_library(libname))
- except Exception:
- continue
- if hasattr(lib, 'uuid_generate_time'):
- _uuid_generate_time = lib.uuid_generate_time
- break
- del _libnames
-
- # The uuid_generate_* functions are broken on MacOS X 10.5, as noted
- # in issue #8621 the function generates the same sequence of values
- # in the parent process and all children created using fork (unless
- # those children use exec as well).
- #
- # Assume that the uuid_generate functions are broken from 10.5 onward,
- # the test can be adjusted when a later version is fixed.
- if sys.platform == 'darwin':
- if int(os.uname().release.split('.')[0]) >= 9:
- _uuid_generate_time = None
-
- # On Windows prior to 2000, UuidCreate gives a UUID containing the
- # hardware address. On Windows 2000 and later, UuidCreate makes a
- # random UUID and UuidCreateSequential gives a UUID containing the
- # hardware address. These routines are provided by the RPC runtime.
- # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last
- # 6 bytes returned by UuidCreateSequential are fixed, they don't appear
- # to bear any relationship to the MAC address of any network device
- # on the box.
- try:
- lib = ctypes.windll.rpcrt4
- except:
- lib = None
- _UuidCreate = getattr(lib, 'UuidCreateSequential',
- getattr(lib, 'UuidCreate', None))
-except:
- pass
def _unixdll_getnode():
"""Get the hardware address on Unix using ctypes."""
--
2.14.1
@@ -1,48 +0,0 @@
diff --git a/setup.py b/setup.py
index 2779658..902d0eb 100644
--- a/setup.py
+++ b/setup.py
@@ -1699,9 +1699,6 @@ class PyBuildExt(build_ext):
# Rather than complicate the code below, detecting and building
# AquaTk is a separate method. Only one Tkinter will be built on
# Darwin - either AquaTk, if it is found, or X11 based Tk.
- if (host_platform == 'darwin' and
- self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
- return
# Assume we haven't found any of the libraries or include files
# The versions with dots are used on Unix, and the versions without
@@ -1747,22 +1744,6 @@ class PyBuildExt(build_ext):
if dir not in include_dirs:
include_dirs.append(dir)
- # Check for various platform-specific directories
- if host_platform == 'sunos5':
- include_dirs.append('/usr/openwin/include')
- added_lib_dirs.append('/usr/openwin/lib')
- elif os.path.exists('/usr/X11R6/include'):
- include_dirs.append('/usr/X11R6/include')
- added_lib_dirs.append('/usr/X11R6/lib64')
- added_lib_dirs.append('/usr/X11R6/lib')
- elif os.path.exists('/usr/X11R5/include'):
- include_dirs.append('/usr/X11R5/include')
- added_lib_dirs.append('/usr/X11R5/lib')
- else:
- # Assume default location for X11
- include_dirs.append('/usr/X11/include')
- added_lib_dirs.append('/usr/X11/lib')
-
# If Cygwin, then verify that X is installed before proceeding
if host_platform == 'cygwin':
x11_inc = find_file('X11/Xlib.h', [], include_dirs)
@@ -1786,10 +1767,6 @@ class PyBuildExt(build_ext):
if host_platform in ['aix3', 'aix4']:
libs.append('ld')
- # Finally, link with the X11 libraries (not appropriate on cygwin)
- if host_platform != "cygwin":
- libs.append('X11')
-
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
define_macros=[('WITH_APPINIT', 1)] + defs,
include_dirs = include_dirs,
@@ -180,7 +180,7 @@ let
if isDarwin then "darwin"
else "${multiarchCpu}-${parsed.kernel.name}-${pythonAbiName}";
abiFlags = optionalString (isPy36 || isPy37) "m";
abiFlags = optionalString isPy37 "m";
# https://github.com/python/cpython/blob/e488e300f5c01289c10906c2e53a8e43d6de32d8/configure.ac#L78
pythonSysconfigdataName = "_sysconfigdata_${abiFlags}_${parsed.kernel.name}_${multiarch}";
@@ -228,13 +228,7 @@ in with passthru; stdenv.mkDerivation {
] ++ optionals mimetypesSupport [
# Make the mimetypes module refer to the right file
./mimetypes.patch
] ++ optionals (isPy35 || isPy36) [
# Determinism: Write null timestamps when compiling python files.
./3.5/force_bytecode_determinism.patch
] ++ optionals isPy35 [
# Backports support for LD_LIBRARY_PATH from 3.6
./3.5/ld_library_path.patch
] ++ optionals (isPy35 || isPy36 || isPy37) [
] ++ optionals isPy37 [
# Backport a fix for discovering `rpmbuild` command when doing `python setup.py bdist_rpm` to 3.5, 3.6, 3.7.
# See: https://bugs.python.org/issue11122
./3.7/fix-hardcoded-path-checking-for-rpmbuild.patch
@@ -250,12 +244,7 @@ in with passthru; stdenv.mkDerivation {
./3.11/darwin-libutil.patch
] ++ optionals (pythonOlder "3.8") [
# Backport from CPython 3.8 of a good list of tests to run for PGO.
(
if isPy36 || isPy37 then
./3.6/profile-task.patch
else
./3.5/profile-task.patch
)
./3.7/profile-task.patch
] ++ optionals (pythonAtLeast "3.9" && pythonOlder "3.11" && stdenv.isDarwin) [
# Stop checking for TCL/TK in global macOS locations
./3.9/darwin-tcl-tk.patch
@@ -265,9 +254,7 @@ in with passthru; stdenv.mkDerivation {
# only works for GCC and Apple Clang. This makes distutils to call C++
# compiler when needed.
(
if isPy35 then
./3.5/python-3.x-distutils-C++.patch
else if pythonAtLeast "3.7" && pythonOlder "3.11" then
if pythonAtLeast "3.7" && pythonOlder "3.11" then
./3.7/python-3.x-distutils-C++.patch
else if pythonAtLeast "3.11" then
./3.11/python-3.x-distutils-C++.patch
@@ -281,15 +268,7 @@ in with passthru; stdenv.mkDerivation {
# LDSHARED now uses $CC instead of gcc. Fixes cross-compilation of extension modules.
./3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch
# Use sysconfigdata to find headers. Fixes cross-compilation of extension modules.
(
if isPy36 then
./3.6/fix-finding-headers-when-cross-compiling.patch
else
./3.7/fix-finding-headers-when-cross-compiling.patch
)
] ++ optionals (isPy36) [
# Backport a fix for ctypes.util.find_library.
./3.6/find_library.patch
./3.7/fix-finding-headers-when-cross-compiling.patch
];
postPatch = ''
@@ -84,8 +84,6 @@
});
in rec {
isPy27 = pythonVersion == "2.7";
isPy35 = pythonVersion == "3.5";
isPy36 = pythonVersion == "3.6";
isPy37 = pythonVersion == "3.7";
isPy38 = pythonVersion == "3.8";
isPy39 = pythonVersion == "3.9";
@@ -8,7 +8,7 @@ self:
let
inherit (self) callPackage;
inherit (python.passthru) isPy27 isPy35 isPy36 isPy37 isPy38 isPy39 isPy310 isPy311 isPy3k isPyPy pythonAtLeast pythonOlder;
inherit (python.passthru) isPy27 isPy37 isPy38 isPy39 isPy310 isPy311 isPy3k isPyPy pythonAtLeast pythonOlder;
namePrefix = python.libPrefix + "-";
@@ -87,7 +87,7 @@ let
in {
inherit lib pkgs stdenv;
inherit (python.passthru) isPy27 isPy35 isPy36 isPy37 isPy38 isPy39 isPy310 isPy311 isPy3k isPyPy pythonAtLeast pythonOlder;
inherit (python.passthru) isPy27 isPy37 isPy38 isPy39 isPy310 isPy311 isPy3k isPyPy pythonAtLeast pythonOlder;
inherit buildPythonPackage buildPythonApplication;
inherit fetchPypi;
inherit hasPythonModule requiredPythonModules makePythonPath disabled disabledIf;
@@ -2,17 +2,16 @@
, buildPythonPackage
, fetchFromGitHub
, pytest-runner
, pytest
, pytestCheckHook
, pytest-asyncio
, contextvars
, sqlalchemy
, isPy27
, pythonOlder
}:
buildPythonPackage rec {
pname = "aiocontextvars";
version = "0.2.2";
format = "setuptools";
disabled = isPy27;
src = fetchFromGitHub {
@@ -26,18 +25,14 @@ buildPythonPackage rec {
pytest-runner
];
checkInputs = [
pytest
pytest-asyncio
];
propagatedBuildInputs = [
sqlalchemy
] ++ lib.optionals (pythonOlder "3.7") [ contextvars ];
];
checkPhase = ''
pytest
'';
checkInputs = [
pytestCheckHook
pytest-asyncio
];
meta = with lib; {
description = "Asyncio support for PEP-567 contextvars backport";
@@ -16,7 +16,6 @@
, cron-descriptor
, croniter
, cryptography
, dataclasses
, deprecated
, dill
, flask
@@ -137,7 +136,7 @@ buildPythonPackage rec {
inherit version;
src = airflow-src;
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.7";
propagatedBuildInputs = [
alembic
@@ -203,8 +202,6 @@ buildPythonPackage rec {
typing-extensions
unicodecsv
werkzeug
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
] ++ lib.optionals (pythonOlder "3.9") [
importlib-metadata
] ++ providerDependencies;
@@ -1,21 +1,34 @@
{ lib, buildPythonPackage, fetchPypi }:
{ lib
, buildPythonPackage
, fetchFromGitHub
, pytz
, unittestCheckHook
}:
buildPythonPackage rec {
pname = "backports-datetime-fromisoformat";
version = "1.0.0";
version = "2.0.0";
format = "setuptools";
src = fetchPypi {
inherit pname version;
sha256 = "0p0gyhfqq6gssf3prsy0pcfq5w0wx2w3pcjqbwx3imvc92ls4xwm";
src = fetchFromGitHub {
owner = "movermeyer";
repo = "backports.datetime_fromisoformat";
rev = "refs/tags/v${version}";
hash = "sha256-aHF3E/fLN+j/T4W9lvuVSMy6iRSEn+ARWmL01rY+ixs=";
};
# no tests in pypi package
doCheck = false;
checkInputs = [
pytz
unittestCheckHook
];
pythonImportsCheck = [ "backports.datetime_fromisoformat" ];
pythonImportsCheck = [
"backports.datetime_fromisoformat"
];
meta = with lib; {
description = "Backport of Python 3.7's datetime.fromisoformat";
changelog = "https://github.com/movermeyer/backports.datetime_fromisoformat/releases/tag/v${version}";
description = "Backport of Python 3.11's datetime.fromisoformat";
homepage = "https://github.com/movermeyer/backports.datetime_fromisoformat";
license = licenses.mit;
maintainers = with maintainers; [ SuperSandro2000 ];
@@ -1,16 +1,27 @@
{ lib, buildPythonPackage, fetchPypi, pythonOlder, setuptools-scm, importlib-metadata }:
{ lib
, buildPythonPackage
, fetchPypi
, pythonOlder
, setuptools-scm
, importlib-metadata
}:
buildPythonPackage rec {
pname = "backports-entry-points-selectable";
version = "1.1.1";
version = "1.2.0";
format = "pyproject";
disabled = pythonOlder "3.7";
src = fetchPypi {
pname = "backports.entry_points_selectable";
inherit version;
sha256 = "914b21a479fde881635f7af5adc7f6e38d6b274be32269070c53b698c60d5386";
hash = "sha256-Rwb1kXllfKfB0yWlQ+4TcPj0YzH0MrysYvqyQv3wr6U=";
};
nativeBuildInputs = [ setuptools-scm ];
nativeBuildInputs = [
setuptools-scm
];
propagatedBuildInputs = lib.optionals (pythonOlder "3.8") [
importlib-metadata
@@ -24,6 +35,7 @@ buildPythonPackage rec {
pythonNamespaces = [ "backports" ];
meta = with lib; {
changelog = "https://github.com/jaraco/backports.entry_points_selectable/blob/v${version}/CHANGES.rst";
description = "Compatibility shim providing selectable entry points for older implementations";
homepage = "https://github.com/jaraco/backports.entry_points_selectable";
license = licenses.mit;
@@ -1,23 +0,0 @@
{ lib
, buildPythonPackage
, fetchPypi
, unittestCheckHook
}:
buildPythonPackage rec {
pname = "backports_abc";
version = "0.5";
src = fetchPypi {
inherit pname version;
sha256 = "033be54514a03e255df75c5aee8f9e672f663f93abb723444caec8fe43437bde";
};
checkInputs = [ unittestCheckHook ];
meta = {
homepage = "https://github.com/cython/backports_abc";
license = lib.licenses.psfl;
description = "A backport of recent additions to the 'collections.abc' module";
};
}
@@ -1,18 +0,0 @@
{ lib, buildPythonPackage, fetchPypi, pythonAtLeast }:
buildPythonPackage rec {
pname = "backports.ssl_match_hostname";
version = "3.7.0.1";
disabled = pythonAtLeast "3.7";
src = fetchPypi {
inherit pname version;
sha256 = "bb82e60f9fbf4c080eabd957c39f0641f0fc247d9a16e31e26d594d8f42b9fd2";
};
meta = with lib; {
description = "The Secure Sockets layer is only actually *secure*";
homepage = "https://bitbucket.org/brandon/backports.ssl_match_hostname";
license = licenses.psfl;
};
}
@@ -3,7 +3,6 @@
, fetchFromGitHub
, click
, click-log
, dataclasses
, pure-pcapy3
, pyserial-asyncio
, voluptuous
@@ -34,8 +33,6 @@ buildPythonPackage rec {
pyserial-asyncio
voluptuous
zigpy
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
];
checkInputs = [
@@ -5,7 +5,6 @@
, poetry-core
, grpclib
, python-dateutil
, dataclasses
, black
, jinja2
, isort
@@ -21,7 +20,7 @@ buildPythonPackage rec {
pname = "betterproto";
version = "2.0.0b5";
format = "pyproject";
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "danielgtaylor";
@@ -35,8 +34,6 @@ buildPythonPackage rec {
propagatedBuildInputs = [
grpclib
python-dateutil
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
];
passthru.optional-dependencies.compiler = [
@@ -3,7 +3,6 @@
, fetchPypi
, curtsies
, cwcwidth
, dataclasses
, greenlet
, jedi
, pygments
@@ -23,7 +22,7 @@ buildPythonPackage rec {
version = "0.23";
format = "setuptools";
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
@@ -42,8 +41,6 @@ buildPythonPackage rec {
typing-extensions
urwid
watchdog
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
];
postInstall = ''
@@ -1,4 +1,4 @@
{ lib, buildPythonPackage, fetchFromGitHub, isPy36, flake8, click, pyyaml, six, pytestCheckHook, pytest-cov }:
{ lib, buildPythonPackage, fetchFromGitHub, flake8, click, pyyaml, six, pytestCheckHook, pytest-cov }:
buildPythonPackage rec {
pname = "clickclick";
@@ -17,8 +17,6 @@ buildPythonPackage rec {
# test_cli asserts on exact quoting style of output
disabledTests = [
"test_cli"
] ++ lib.optionals isPy36 [
"test_choice_default"
];
meta = with lib; {
@@ -1,21 +0,0 @@
{ lib, buildPythonPackage, fetchPypi, isPy36, immutables }:
buildPythonPackage rec {
pname = "contextvars";
version = "2.4";
disabled = !isPy36;
src = fetchPypi {
inherit pname version;
sha256 = "f38c908aaa59c14335eeea12abea5f443646216c4e29380d7bf34d2018e2c39e";
};
propagatedBuildInputs = [ immutables ];
meta = {
description = "A backport of the Python 3.7 contextvars module for Python 3.6";
homepage = "https://github.com/MagicStack/contextvars";
license = with lib.licenses; [ asl20 ];
maintainers = with lib.maintainers; [ catern ];
};
}
@@ -1,21 +0,0 @@
{ lib, buildPythonPackage, fetchPypi, isPy36 }:
buildPythonPackage rec {
pname = "dataclasses";
version = "0.8";
# backport only works on Python 3.6, and is in the standard library in Python 3.7
disabled = !isPy36;
src = fetchPypi {
inherit pname version;
sha256 = "8479067f342acf957dc82ec415d355ab5edb7e7646b90dc6e2fd1d96ad084c97";
};
meta = with lib; {
description = "An implementation of PEP 557: Data Classes";
homepage = "https://github.com/ericvsmith/dataclasses";
license = licenses.asl20;
maintainers = with maintainers; [ catern ];
};
}
@@ -1,55 +0,0 @@
{ lib
, buildPythonPackage
, pythonAtLeast
, fetchFromGitHub
, net-snmp
, openssl
, pytest
, pytest-cov
, pytest-flake8
, pytest-sugar
, termcolor
}:
buildPythonPackage rec {
pname = "easysnmp";
version = "0.2.5";
# See https://github.com/kamakazikamikaze/easysnmp/issues/108
disabled = pythonAtLeast "3.7";
src = fetchFromGitHub {
owner = "kamakazikamikaze";
repo = pname;
rev = version;
sha256 = "1si9iyxqj6z22jzn6m93lwpinsqn20lix2py3jm3g3fmwawkd735";
};
checkInputs = [
pytest
pytest-cov
pytest-flake8
pytest-sugar
termcolor
];
buildInputs = [
net-snmp
openssl
];
buildPhase = ''
python setup.py build bdist_wheel --basedir=${lib.getBin net-snmp}/bin
'';
# Unable to get tests to pass, even running by hand. The pytest tests have
# become stale.
doCheck = false;
meta = with lib; {
description = "A blazingly fast and Pythonic SNMP library based on the official Net-SNMP bindings";
homepage = "https://easysnmp.readthedocs.io/en/latest/";
license = licenses.bsd3;
maintainers = with maintainers; [ WhittlesJr ];
};
}
@@ -1,13 +1,11 @@
{ lib
, buildPythonPackage
, fetchPypi
, pythonOlder
, python
, isPyPy
, six
, filetype
, deprecation
, dataclasses
}:
buildPythonPackage rec {
@@ -25,8 +23,10 @@ buildPythonPackage rec {
doCheck = false;
propagatedBuildInputs = [
six filetype deprecation
] ++ lib.optional (pythonOlder "3.7") dataclasses;
deprecation
filetype
six
];
postInstall = ''
for prog in "$out/bin/"*; do
@@ -1,7 +1,6 @@
{ lib
, buildPythonPackage
, callPackage
, pythonOlder
, fetchFromGitHub
, babel
, gruut-ipa
@@ -9,7 +8,6 @@
, jsonlines
, num2words
, python-crfsuite
, dataclasses
, python
, networkx
, glibcLocales
@@ -61,8 +59,6 @@ buildPythonPackage rec {
python-crfsuite
dateparser
networkx
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
] ++ (map (lang: callPackage ./language-pack.nix {
inherit lang version format src;
}) langPkgs);
@@ -5,7 +5,6 @@
, anyio
, asyncio-rlock
, asyncio-throttle
, dataclasses
, ircstates
, async_stagger
, async-timeout
@@ -15,7 +14,7 @@
buildPythonPackage rec {
pname = "ircrobots";
version = "0.4.6";
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "jesopo";
@@ -38,8 +37,6 @@ buildPythonPackage rec {
ircstates
async_stagger
async-timeout
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
];
checkPhase = ''
@@ -2,7 +2,6 @@
, backoff
, backports-datetime-fromisoformat
, buildPythonPackage
, dataclasses
, fetchFromGitHub
, google-api-core
, jinja2
@@ -20,7 +19,7 @@
buildPythonPackage rec {
pname = "labelbox";
version = "3.24.1";
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "Labelbox";
@@ -32,7 +31,6 @@ buildPythonPackage rec {
propagatedBuildInputs = [
backoff
backports-datetime-fromisoformat
dataclasses
google-api-core
jinja2
ndjson
@@ -1,13 +1,12 @@
{ lib
, buildPythonPackage
, fetchPypi
, isPy36
}:
buildPythonPackage rec {
pname = "mailcap-fix";
version = "1.0.1";
disabled = isPy36; # this fix is merged into python 3.6
format = "setuptools";
src = fetchPypi {
inherit pname version;
@@ -1,6 +1,5 @@
{ lib
, buildPythonPackage
, dataclasses
, fetchPypi
, fetchpatch
, google-cloud-storage
@@ -16,7 +15,7 @@ buildPythonPackage rec {
version = "0.6.1";
format = "setuptools";
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
@@ -27,8 +26,6 @@ buildPythonPackage rec {
smart-open
typer
google-cloud-storage
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
];
checkInputs = [
@@ -5,7 +5,6 @@
, docopt
, pillow
, requests
, dataclasses
, pythonOlder
}:
@@ -13,7 +12,7 @@ buildPythonPackage rec {
pname = "pixcat";
version = "0.1.4";
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
@@ -5,7 +5,6 @@
, cachy
, cleo
, crashtest
, dataclasses
, deepdiff
, dulwich
, fetchFromGitHub
@@ -1,6 +1,5 @@
{ lib
, buildPythonPackage
, dataclasses
, fetchPypi
, jedi
, pygments
@@ -16,7 +15,7 @@ buildPythonPackage rec {
version = "2022.1.2";
format = "setuptools";
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.8";
src = fetchPypi {
inherit pname version;
@@ -28,8 +27,6 @@ buildPythonPackage rec {
pygments
urwid
urwid-readline
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
];
checkInputs = [
@@ -1,13 +1,11 @@
{ lib
, buildPythonPackage
, python
, pythonOlder
, fetchFromGitHub
, poetry-core
, beautifulsoup4
, lxml
, jinja2
, dataclasses
, pytestCheckHook
}:
@@ -39,8 +37,6 @@ buildPythonPackage rec {
beautifulsoup4
lxml
jinja2
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
];
pythonImportsCheck = [
@@ -3,7 +3,6 @@
, fetchFromGitHub
, pythonOlder
, CommonMark
, dataclasses
, poetry-core
, pygments
, typing-extensions
@@ -20,7 +19,7 @@ buildPythonPackage rec {
pname = "rich";
version = "12.6.0";
format = "pyproject";
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "Textualize";
@@ -34,8 +33,6 @@ buildPythonPackage rec {
propagatedBuildInputs = [
CommonMark
pygments
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
] ++ lib.optionals (pythonOlder "3.9") [
typing-extensions
];
@@ -1,29 +0,0 @@
{ lib, buildPythonPackage, fetchPypi
, isPy35, isPy27
, numpy, pytz, six, enum-compat, sentinel
}:
buildPythonPackage rec {
pname = "rig";
version = "2.4.1";
src = fetchPypi {
inherit pname version;
sha256 = "5a3896dbde3f291c5dd34769e7329ef5d5e4da34fee53479bd13dc5e5d540b8a";
};
propagatedBuildInputs = [ numpy pytz six sentinel enum-compat ];
# This is the list of officially supported versions. Other versions may work
# as well.
disabled = !(isPy27 || isPy35);
# Test Phase is only supported in development sources.
doCheck = false;
meta = with lib; {
description = "A collection of tools for developing SpiNNaker applications";
homepage = "https://github.com/project-rig/rig";
license = licenses.gpl2;
};
}
@@ -1,7 +1,6 @@
{ stdenv
, lib
, buildPythonPackage
, dataclasses
, fetchFromGitHub
, libX11
, libXinerama
@@ -16,7 +15,7 @@ buildPythonPackage rec {
version = "0.8.1";
format = "pyproject";
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "rr-";
@@ -29,10 +28,6 @@ buildPythonPackage rec {
poetry-core
];
propagatedBuildInputs = lib.optionals (pythonOlder "3.7") [
dataclasses
];
postPatch = ''
substituteInPlace screeninfo/enumerators/xinerama.py \
--replace 'load_library("X11")' 'ctypes.cdll.LoadLibrary("${libX11}/lib/libX11.so")' \
@@ -4,7 +4,6 @@
, fetchPypi
, setuptools
, typing-extensions
, dataclasses
}:
buildPythonPackage rec {
@@ -23,8 +22,6 @@ buildPythonPackage rec {
propagatedBuildInputs = [
setuptools
typing-extensions
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
];
pythonImportsCheck = [
@@ -1,27 +1,33 @@
{ buildPythonPackage, lib, fetchPypi, glibcLocales, isPy3k, contextvars
, pythonOlder, pytest, curio
{ buildPythonPackage
, lib
, fetchPypi
, glibcLocales
, isPy3k
, pythonOlder
, pytestCheckHook
, curio
}:
buildPythonPackage rec {
pname = "sniffio";
version = "1.3.0";
format = "setuptools";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-5gMFxeXTFPU4klm38iqqM9j33uSXYxGSNK83VcVbkQE=";
hash = "sha256-5gMFxeXTFPU4klm38iqqM9j33uSXYxGSNK83VcVbkQE=";
};
disabled = !isPy3k;
buildInputs = [ glibcLocales ];
buildInputs = [
glibcLocales
];
propagatedBuildInputs = lib.optionals (pythonOlder "3.7") [ contextvars ];
checkInputs = [ pytest curio ];
checkPhase = ''
pytest
'';
checkInputs = [
curio
pytestCheckHook
];
meta = with lib; {
homepage = "https://github.com/python-trio/sniffio";
@@ -2,7 +2,6 @@
, callPackage
, fetchPypi
, buildPythonPackage
, dataclasses
, torch
, pythonOlder
, spacy
@@ -16,7 +15,7 @@ buildPythonPackage rec {
version = "1.1.8";
format = "setuptools";
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
@@ -29,8 +28,6 @@ buildPythonPackage rec {
spacy-alignments
srsly
transformers
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
];
postPatch = ''
@@ -5,13 +5,11 @@
, buildPythonPackage
, catalogue
, confection
, contextvars
, CoreFoundation
, CoreGraphics
, CoreVideo
, cymem
, cython
, dataclasses
, fetchPypi
, hypothesis
, mock
@@ -34,7 +32,7 @@ buildPythonPackage rec {
version = "8.1.1";
format = "setuptools";
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
@@ -65,9 +63,6 @@ buildPythonPackage rec {
wasabi
] ++ lib.optionals (pythonOlder "3.8") [
typing-extensions
] ++ lib.optionals (pythonOlder "3.7") [
contextvars
dataclasses
];
checkInputs = [
@@ -4,7 +4,6 @@
, async_generator
, idna
, outcome
, contextvars
, pytestCheckHook
, pyopenssl
, trustme
@@ -19,7 +18,7 @@
buildPythonPackage rec {
pname = "trio";
version = "0.21.0";
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
@@ -33,7 +32,7 @@ buildPythonPackage rec {
idna
outcome
sniffio
] ++ lib.optionals (pythonOlder "3.7") [ contextvars ];
];
# tests are failing on Darwin
doCheck = !stdenv.isDarwin;
@@ -10,7 +10,6 @@
, automat
, bcrypt
, constantly
, contextvars
, cryptography
, git
, glibcLocales
@@ -139,7 +138,6 @@ buildPythonPackage rec {
optional-dependencies = rec {
conch = [ appdirs bcrypt cryptography pyasn1 ];
conch_nacl = conch ++ [ pynacl ];
contextvars = lib.optionals (pythonOlder "3.7") [ contextvars ];
http2 = [ h2 priority ];
serial = [ pyserial ];
tls = [ idna pyopenssl service-identity ];
@@ -4,7 +4,6 @@
, pythonOlder
, fetchPypi
, watchdog
, dataclasses
, ephemeral-port-reserve
, pytest-timeout
, pytest-xprocess
@@ -32,8 +31,6 @@ buildPythonPackage rec {
] ++ lib.optionals (!stdenv.isDarwin) [
# watchdog requires macos-sdk 10.13+
watchdog
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
];
checkInputs = [
@@ -31,8 +31,6 @@ python3.pkgs.buildPythonApplication rec {
toml
tqdm
typing-extensions
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
] ++ lib.optionals (pythonOlder "3.8") [
backports.cached-property
importlib_metadata
+2 -1
View File
@@ -18,7 +18,6 @@ python3.pkgs.buildPythonApplication rec {
propagatedBuildInputs = with python3.pkgs; [
APScheduler
advocate
backports_abc
chardet
flask-babel
flask-login
@@ -54,6 +53,8 @@ python3.pkgs.buildPythonApplication rec {
mv cps.py src/calibreweb/__init__.py
mv cps src/calibreweb
sed -i "/backports_abc/d" setup.cfg
substituteInPlace setup.cfg \
--replace "cps = calibreweb:main" "calibre-web = calibreweb:main" \
--replace "chardet>=3.0.0,<4.1.0" "chardet>=3.0.0,<6" \
+1
View File
@@ -186,6 +186,7 @@ mapAliases ({
repeated_test = repeated-test; # added 2022-11-15
requests_oauthlib = requests-oauthlib; # added 2022-02-12
requests_toolbelt = requests-toolbelt; # added 2017-09-26
rig = throw "rig has been removed because it was pinned to python 2.7 and 3.5, failed to build and is otherwise unmaintained"; # added 2022-11-28
roboschool = throw "roboschool is deprecated in favor of PyBullet and has been removed"; # added 2022-01-15
ROPGadget = ropgadget; # added 2021-07-06
rotate-backups = throw "rotate-backups was removed in favor of the top-level rotate-backups"; # added 2021-07-01
-12
View File
@@ -1098,8 +1098,6 @@ self: super: with self; {
backports-cached-property = callPackage ../development/python-modules/backports-cached-property { };
backports_abc = callPackage ../development/python-modules/backports_abc { };
backports_csv = callPackage ../development/python-modules/backports_csv { };
backports-datetime-fromisoformat = callPackage ../development/python-modules/backports-datetime-fromisoformat { };
@@ -1112,8 +1110,6 @@ self: super: with self; {
backports-shutil-which = callPackage ../development/python-modules/backports-shutil-which { };
backports_ssl_match_hostname = callPackage ../development/python-modules/backports_ssl_match_hostname { };
backports_tempfile = callPackage ../development/python-modules/backports_tempfile { };
backports_unittest-mock = callPackage ../development/python-modules/backports_unittest-mock { };
@@ -1956,8 +1952,6 @@ self: super: with self; {
contextlib2 = callPackage ../development/python-modules/contextlib2 { };
contextvars = callPackage ../development/python-modules/contextvars { };
contexttimer = callPackage ../development/python-modules/contexttimer { };
convertdate = callPackage ../development/python-modules/convertdate { };
@@ -2173,8 +2167,6 @@ self: super: with self; {
databricks-sql-connector = callPackage ../development/python-modules/databricks-sql-connector { };
dataclasses = callPackage ../development/python-modules/dataclasses { };
dataclasses-json = callPackage ../development/python-modules/dataclasses-json { };
dataclasses-serialization = callPackage ../development/python-modules/dataclasses-serialization { };
@@ -2836,8 +2828,6 @@ self: super: with self; {
EasyProcess = callPackage ../development/python-modules/easyprocess { };
easysnmp = callPackage ../development/python-modules/easysnmp { };
easy-thumbnails = callPackage ../development/python-modules/easy-thumbnails { };
easywatch = callPackage ../development/python-modules/easywatch { };
@@ -9794,8 +9784,6 @@ self: super: with self; {
rich-rst = callPackage ../development/python-modules/rich-rst { };
rig = callPackage ../development/python-modules/rig { };
ring-doorbell = callPackage ../development/python-modules/ring-doorbell { };
ripe-atlas-cousteau = callPackage ../development/python-modules/ripe-atlas-cousteau { };