pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/python39/patches python39: add patches



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2ad4a3d236d9
branches:  trunk
changeset: 440533:2ad4a3d236d9
user:      adam <adam%pkgsrc.org@localhost>
date:      Sat Oct 10 20:20:12 2020 +0000

description:
python39: add patches

diffstat:

 lang/python39/patches/patch-Lib_ctypes_util.py               |   76 +++++
 lang/python39/patches/patch-Lib_distutils_command_install.py |   12 +
 lang/python39/patches/patch-Lib_distutils_sysconfig.py       |   28 ++
 lang/python39/patches/patch-Lib_distutils_unixccompiler.py   |   31 ++
 lang/python39/patches/patch-Lib_lib2to3_pgen2_driver.py      |   32 ++
 lang/python39/patches/patch-Lib_sysconfig.py                 |   26 ++
 lang/python39/patches/patch-Makefile.pre.in                  |  114 ++++++++
 lang/python39/patches/patch-Modules_makesetup                |   15 +
 lang/python39/patches/patch-Modules_nismodule.c              |   16 +
 lang/python39/patches/patch-Modules_socketmodule.c           |   27 ++
 lang/python39/patches/patch-Modules_socketmodule.h           |   17 +
 lang/python39/patches/patch-Python_thread__pthread.h         |   14 +
 lang/python39/patches/patch-configure                        |   61 ++++
 lang/python39/patches/patch-pyconfig.h.in                    |   16 +
 lang/python39/patches/patch-setup.py                         |  143 +++++++++++
 15 files changed, 628 insertions(+), 0 deletions(-)

diffs (truncated from 688 to 300 lines):

diff -r 5c40edacabf0 -r 2ad4a3d236d9 lang/python39/patches/patch-Lib_ctypes_util.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Lib_ctypes_util.py    Sat Oct 10 20:20:12 2020 +0000
@@ -0,0 +1,76 @@
+$NetBSD: patch-Lib_ctypes_util.py,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+Fallback to clang.
+
+Look for shared libraries in PkgSrc prefix.
+Note: /usr/local will get replaced by SUBST.
+
+Pull in patch for http://bugs.python.org/issue23287 for SunOS
+
+--- Lib/ctypes/util.py.orig    2019-03-25 20:21:05.000000000 +0000
++++ Lib/ctypes/util.py
+@@ -102,6 +102,8 @@ elif os.name == "posix":
+ 
+         c_compiler = shutil.which('gcc')
+         if not c_compiler:
++            c_compiler = shutil.which('clang')
++        if not c_compiler:
+             c_compiler = shutil.which('cc')
+         if not c_compiler:
+             # No C compiler available, give up
+@@ -213,34 +215,15 @@ elif os.name == "posix":
+ 
+     elif sys.platform == "sunos5":
+ 
+-        def _findLib_crle(name, is64):
+-            if not os.path.exists('/usr/bin/crle'):
+-                return None
++        def _findLib_path(name, is64):
+ 
+             env = dict(os.environ)
+             env['LC_ALL'] = 'C'
+ 
+             if is64:
+-                args = ('/usr/bin/crle', '-64')
++                paths = "/lib/64:/usr/lib/64:/usr/local/lib"
+             else:
+-                args = ('/usr/bin/crle',)
+-
+-            paths = None
+-            try:
+-                proc = subprocess.Popen(args,
+-                                        stdout=subprocess.PIPE,
+-                                        stderr=subprocess.DEVNULL,
+-                                        env=env)
+-            except OSError:  # E.g. bad executable
+-                return None
+-            with proc:
+-                for line in proc.stdout:
+-                    line = line.strip()
+-                    if line.startswith(b'Default Library Path (ELF):'):
+-                        paths = os.fsdecode(line).split()[4]
+-
+-            if not paths:
+-                return None
++                paths = "/lib:/usr/lib:/usr/local/lib"
+ 
+             for dir in paths.split(":"):
+                 libfile = os.path.join(dir, "lib%s.so" % name)
+@@ -250,7 +233,7 @@ elif os.name == "posix":
+             return None
+ 
+         def find_library(name, is64 = False):
+-            return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
++            return _get_soname(_findLib_path(name, is64) or _findLib_gcc(name))
+ 
+     else:
+ 
+@@ -287,7 +270,7 @@ elif os.name == "posix":
+         def _findLib_ld(name):
+             # See issue #9998 for why this is needed
+             expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)
+-            cmd = ['ld', '-t']
++            cmd = ['ld', '-t', '-L', '/usr/local/lib']
+             libpath = os.environ.get('LD_LIBRARY_PATH')
+             if libpath:
+                 for d in libpath.split(':'):
diff -r 5c40edacabf0 -r 2ad4a3d236d9 lang/python39/patches/patch-Lib_distutils_command_install.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Lib_distutils_command_install.py      Sat Oct 10 20:20:12 2020 +0000
@@ -0,0 +1,12 @@
+$NetBSD: patch-Lib_distutils_command_install.py,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+--- Lib/distutils/command/install.py.orig      2016-12-23 02:21:19.000000000 +0000
++++ Lib/distutils/command/install.py
+@@ -652,5 +652,6 @@ class install(Command):
+                     ('install_headers', has_headers),
+                     ('install_scripts', has_scripts),
+                     ('install_data',    has_data),
+-                    ('install_egg_info', lambda self:True),
+                    ]
++    if not os.environ.get('PKGSRC_PYTHON_NO_EGG'):
++        sub_commands += [('install_egg_info', lambda self:True),]
diff -r 5c40edacabf0 -r 2ad4a3d236d9 lang/python39/patches/patch-Lib_distutils_sysconfig.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Lib_distutils_sysconfig.py    Sat Oct 10 20:20:12 2020 +0000
@@ -0,0 +1,28 @@
+$NetBSD: patch-Lib_distutils_sysconfig.py,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+Remove _multiarch from config path (differs across platforms).
+Simplify _sysconfigdata to include only platform name.
+
+--- Lib/distutils/sysconfig.py.orig    2016-12-23 02:21:19.000000000 +0000
++++ Lib/distutils/sysconfig.py
+@@ -242,8 +242,6 @@ def get_makefile_filename():
+         return os.path.join(_sys_home or project_base, "Makefile")
+     lib_dir = get_python_lib(plat_specific=0, standard_lib=1)
+     config_file = 'config-{}{}'.format(get_python_version(), build_flags)
+-    if hasattr(sys.implementation, '_multiarch'):
+-        config_file += '-%s' % sys.implementation._multiarch
+     return os.path.join(lib_dir, config_file, 'Makefile')
+ 
+ 
+@@ -419,10 +417,8 @@ def _init_posix():
+     """Initialize the module as appropriate for POSIX systems."""
+     # _sysconfigdata is generated at build time, see the sysconfig module
+     name = os.environ.get('_PYTHON_SYSCONFIGDATA_NAME',
+-        '_sysconfigdata_{abi}_{platform}_{multiarch}'.format(
+-        abi=sys.abiflags,
++        '_sysconfigdata_{platform}'.format(
+         platform=sys.platform,
+-        multiarch=getattr(sys.implementation, '_multiarch', ''),
+     ))
+     _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
+     build_time_vars = _temp.build_time_vars
diff -r 5c40edacabf0 -r 2ad4a3d236d9 lang/python39/patches/patch-Lib_distutils_unixccompiler.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Lib_distutils_unixccompiler.py        Sat Oct 10 20:20:12 2020 +0000
@@ -0,0 +1,31 @@
+$NetBSD: patch-Lib_distutils_unixccompiler.py,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+Do not force RUNPATH vs RPATH, trust the compiler to know what the
+platform wants.
+
+--- Lib/distutils/unixccompiler.py.orig        2018-03-29 11:57:55.000000000 +0000
++++ Lib/distutils/unixccompiler.py
+@@ -234,22 +234,7 @@ class UnixCCompiler(CCompiler):
+                 return ["-Wl,+s", "-L" + dir]
+             return ["+s", "-L" + dir]
+         else:
+-            if self._is_gcc(compiler):
+-                # gcc on non-GNU systems does not need -Wl, but can
+-                # use it anyway.  Since distutils has always passed in
+-                # -Wl whenever gcc was used in the past it is probably
+-                # safest to keep doing so.
+-                if sysconfig.get_config_var("GNULD") == "yes":
+-                    # GNU ld needs an extra option to get a RUNPATH
+-                    # instead of just an RPATH.
+-                    return "-Wl,--enable-new-dtags,-R" + dir
+-                else:
+-                    return "-Wl,-R" + dir
+-            else:
+-                # No idea how --enable-new-dtags would be passed on to
+-                # ld if this system was using GNU ld.  Don't know if a
+-                # system like this even exists.
+-                return "-R" + dir
++            return "-Wl,-R" + dir
+ 
+     def library_option(self, lib):
+         return "-l" + lib
diff -r 5c40edacabf0 -r 2ad4a3d236d9 lang/python39/patches/patch-Lib_lib2to3_pgen2_driver.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Lib_lib2to3_pgen2_driver.py   Sat Oct 10 20:20:12 2020 +0000
@@ -0,0 +1,32 @@
+$NetBSD: patch-Lib_lib2to3_pgen2_driver.py,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+On systems where both of the conditions
+
+1. LD_LIBRARY_PATH does _not_ take precedence over DT_RPATH
+   (e.g. Linux)
+2. A previous libpython with the same major.minor is already installed
+   (e.g. a previous version of this package)
+
+hold, the built python will be linked with the installed libpython,
+causing it to report an old teeny version in sys.version_info while
+staging the install. Then "make package" fails with PLIST mismatches for
+{,Pattern}Grammar.*.pickle.
+
+pkgsrc knows which version we're building. Pass that down instead.
+
+In patch-Lib_distutils_unixccompiler.py, we override Python maintainers'
+expectations for Linux builds in favor of pkgsrc's expectations for
+builds on all platforms. This patch is needed because of that patch.
+
+--- Lib/lib2to3/pgen2/driver.py.orig   2020-06-27 08:35:53.000000000 +0000
++++ Lib/lib2to3/pgen2/driver.py
+@@ -108,7 +108,8 @@ def _generate_pickle_name(gt):
+     head, tail = os.path.splitext(gt)
+     if tail == ".txt":
+         tail = ""
+-    return head + tail + ".".join(map(str, sys.version_info)) + ".pickle"
++    sys_version_info = "@PKGVERSION_NOREV@" + ".final.0"
++    return head + tail + sys_version_info + ".pickle"
+ 
+ 
+ def load_grammar(gt="Grammar.txt", gp=None,
diff -r 5c40edacabf0 -r 2ad4a3d236d9 lang/python39/patches/patch-Lib_sysconfig.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Lib_sysconfig.py      Sat Oct 10 20:20:12 2020 +0000
@@ -0,0 +1,26 @@
+$NetBSD: patch-Lib_sysconfig.py,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+Remove _multiarch from config path (differs across platforms).
+Simplify _sysconfigdata to include only platform name.
+
+--- Lib/sysconfig.py.orig      2016-12-23 02:21:19.000000000 +0000
++++ Lib/sysconfig.py
+@@ -337,17 +337,13 @@ def get_makefile_filename():
+         config_dir_name = 'config-%s%s' % (_PY_VERSION_SHORT, sys.abiflags)
+     else:
+         config_dir_name = 'config'
+-    if hasattr(sys.implementation, '_multiarch'):
+-        config_dir_name += '-%s' % sys.implementation._multiarch
+     return os.path.join(get_path('stdlib'), config_dir_name, 'Makefile')
+ 
+ 
+ def _get_sysconfigdata_name():
+     return os.environ.get('_PYTHON_SYSCONFIGDATA_NAME',
+-        '_sysconfigdata_{abi}_{platform}_{multiarch}'.format(
+-        abi=sys.abiflags,
++        '_sysconfigdata_{platform}'.format(
+         platform=sys.platform,
+-        multiarch=getattr(sys.implementation, '_multiarch', ''),
+     ))
+ 
+ 
diff -r 5c40edacabf0 -r 2ad4a3d236d9 lang/python39/patches/patch-Makefile.pre.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/python39/patches/patch-Makefile.pre.in       Sat Oct 10 20:20:12 2020 +0000
@@ -0,0 +1,114 @@
+$NetBSD: patch-Makefile.pre.in,v 1.1 2020/10/10 20:20:12 adam Exp $
+
+Use only one optimisation level; needed for PLIST and setuptools compatibility.
+Do not build/install libpython3.so.
+Simplify _sysconfigdata to include only platform name.
+Swap targets libinstall and libainstall, to byte-compile python-config.py.
+
+--- Makefile.pre.in.orig       2019-08-29 21:59:20.000000000 +0000
++++ Makefile.pre.in
+@@ -100,7 +100,7 @@ PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODI
+ # be able to build extension modules using the directories specified in the
+ # environment variables
+ PY_CPPFLAGS=  $(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
+-PY_LDFLAGS=   $(CONFIGURE_LDFLAGS) $(LDFLAGS)
++PY_LDFLAGS=   -L. $(CONFIGURE_LDFLAGS) $(LDFLAGS)
+ PY_LDFLAGS_NODIST=$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)
+ NO_AS_NEEDED= @NO_AS_NEEDED@
+ SGI_ABI=      @SGI_ABI@
+@@ -222,7 +222,7 @@ DIST=              $(DISTFILES) $(DISTDIRS)
+ LIBRARY=      @LIBRARY@
+ LDLIBRARY=      @LDLIBRARY@
+ BLDLIBRARY=     @BLDLIBRARY@
+-PY3LIBRARY=     @PY3LIBRARY@
++PY3LIBRARY=
+ DLLLIBRARY=   @DLLLIBRARY@
+ LDLIBRARYDIR=   @LDLIBRARYDIR@
+ INSTSONAME=   @INSTSONAME@
+@@ -923,8 +923,6 @@ regen-opcode-targets:
+               $(srcdir)/Python/opcode_targets.h.new
+       $(UPDATE_FILE) $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/opcode_targets.h.new
+ 
+-Python/ceval.o: $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/ceval_gil.h \
+-              $(srcdir)/Python/condvar.h
+ 
+ Python/frozen.o: $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib_external.h \
+               $(srcdir)/Python/importlib_zipimport.h
+@@ -934,7 +932,7 @@ Python/frozen.o: $(srcdir)/Python/import
+ # an include guard, so we can't use a pipeline to transform its output.
+ Include/pydtrace_probes.h: $(srcdir)/Include/pydtrace.d
+       $(MKDIR_P) Include
+-      $(DTRACE) $(DFLAGS) -o $@ -h -s $<
++      $(DTRACE) $(DFLAGS) -o $@ -h -s $(srcdir)/Include/pydtrace.d
+       : sed in-place edit with POSIX-only tools
+       sed 's/PYTHON_/PyDTrace_/' $@ > $@.tmp
+       mv $@.tmp $@
+@@ -944,7 +942,7 @@ Python/import.o: $(srcdir)/Include/pydtr
+ Modules/gcmodule.o: $(srcdir)/Include/pydtrace.h
+ 
+ Python/pydtrace.o: $(srcdir)/Include/pydtrace.d $(DTRACE_DEPS)
+-      $(DTRACE) $(DFLAGS) -o $@ -G -s $< $(DTRACE_DEPS)
++      $(DTRACE) $(DFLAGS) -o $@ -G -s $(srcdir)/Include/pydtrace.d $(DTRACE_DEPS)
+ 
+ Objects/typeobject.o: Objects/typeslots.inc
+ 
+@@ -1187,7 +1185,7 @@ altinstall: commoninstall
+       fi
+ 
+ commoninstall:  check-clean-src @FRAMEWORKALTINSTALLFIRST@ \
+-              altbininstall libinstall inclinstall libainstall \
++              altbininstall libainstall inclinstall libinstall \
+               sharedinstall oldsharedinstall altmaninstall \
+               @FRAMEWORKALTINSTALLLAST@
+ 
+@@ -1246,7 +1244,8 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORK
+               if test -n "$(PY3LIBRARY)"; then \
+                       $(INSTALL_SHARED) $(PY3LIBRARY) $(DESTDIR)$(LIBDIR)/$(PY3LIBRARY); \
+               fi; \



Home | Main Index | Thread Index | Old Index