Warning, /graphics/krita/3rdparty/ext_pyqt/0001-Support-MinGW-and-MSYS-Python-builds.patch is written in an unsupported language. File is not indexed.

0001 From 492e19d22d6ed91c22cbf7a7d7798431fd6e40c1 Mon Sep 17 00:00:00 2001
0002 From: "L. E. Segovia" <amy@amyspark.me>
0003 Date: Sun, 2 Oct 2022 16:07:12 -0300
0004 Subject: [PATCH] Support MinGW and MSYS Python builds
0005 
0006 Based on
0007 https://github.com/msys2/MINGW-packages/blame/master/mingw-w64-pyqt-builder/001-mingw-python.patch
0008 
0009 Co-authored-by: Mehdi Chinoune <mehdi.chinoune@hotmail.com>
0010 Co-authored-by: Alexey Pavlov <alexpux@gmail.com>
0011 Co-authored-by: Biswapriyo Nath <nathbappai@gmail.com>
0012 
0013 Signed-off-by: L. E. Segovia <amy@amyspark.me>
0014 ---
0015  pyqtbuild/builder.py | 27 +++++++++++++++++++++------
0016  pyqtbuild/project.py |  6 +++++-
0017  2 files changed, 26 insertions(+), 7 deletions(-)
0018 
0019 diff --git a/pyqtbuild/builder.py b/pyqtbuild/builder.py
0020 index 3f35a7f..c5dbe04 100644
0021 --- a/pyqtbuild/builder.py
0022 +++ b/pyqtbuild/builder.py
0023 @@ -26,6 +26,11 @@ import os
0024  import sys
0025  import sysconfig
0026  
0027 +try:
0028 +    from sysconfig import _POSIX_BUILD
0029 +except:
0030 +    _POSIX_BUILD = False
0031 +
0032  from sipbuild import (Buildable, BuildableModule, Builder, Option, Project,
0033          PyProjectOptionException, UserException)
0034  
0035 @@ -57,7 +62,8 @@ class QmakeBuilder(Builder):
0036              # be on PATH).
0037              if tool != 'pep517':
0038                  self._sip_distinfo = os.path.join(
0039 -                        os.path.abspath(os.path.dirname(sys.argv[0])),
0040 +                        os.path.abspath(os.path.dirname(
0041 +                            sys.argv[0]).replace('\\', '/')),
0042                          self._sip_distinfo)
0043  
0044              # Check we have a qmake.
0045 @@ -237,8 +243,13 @@ class QmakeBuilder(Builder):
0046                              ['install_' + installable.name
0047                                      for installable in project.installables])))
0048              pro_lines.append('distinfo.extra = {}'.format(' '.join(args)))
0049 +            if self.project.py_platform == 'win32' and "MSYSTEM" in os.environ:
0050 +                distinfo_dir = os.popen(
0051 +                    ' '.join(['cygpath', '--unix', target_dir])).readline().strip()
0052 +            else:
0053 +                distinfo_dir = target_dir
0054              pro_lines.append(
0055 -                    'distinfo.path = {}'.format(self.qmake_quote(target_dir)))
0056 +                    'distinfo.path = {}'.format(self.qmake_quote(distinfo_dir)))
0057              pro_lines.append('INSTALLS += distinfo')
0058  
0059          pro_name = os.path.join(project.build_dir, project.name + '.pro')
0060 @@ -336,6 +347,8 @@ class QmakeBuilder(Builder):
0061          if self.project.py_platform == 'win32':
0062              if 'g++' in self.spec:
0063                  make = 'make'
0064 +                if self._find_exe(make) is None:
0065 +                    make = 'mingw32-make'
0066              else:
0067                  make = 'nmake'
0068          else:
0069 @@ -462,11 +475,10 @@ macx {
0070  
0071          # Python.h on Windows seems to embed the need for pythonXY.lib, so tell
0072          # it where it is.
0073 -        # TODO: is this still necessary for Python v3.8?
0074          if not buildable.static:
0075              pro_lines.extend(['win32 {',
0076 -                    '    LIBS += -L{}'.format(
0077 -                            self.qmake_quote(project.py_pylib_dir)),
0078 +                    '    LIBS += -L{} -l{}'.format(
0079 +                            self.qmake_quote(project.py_pylib_dir), self.qmake_quote(project.py_pylib_lib)),
0080                      '}'])
0081  
0082          # Add any installables from the buildable.
0083 @@ -497,6 +509,9 @@ macx {
0084                              "Unexpected output from qmake: '{0}'".format(line))
0085  
0086                  name, value = tokens
0087 +                if _POSIX_BUILD and "MSYSTEM" in os.environ and value != "":
0088 +                    value = os.popen(
0089 +                        ' '.join(['cygpath', '--unix', value])).readline().strip()
0090              else:
0091                  name = tokens
0092                  value = None
0093 @@ -627,7 +642,7 @@ macx {
0094  
0095          if install:
0096              args.append('install')
0097 -        elif project.py_platform != 'win32' and self.jobs:
0098 +        elif 'make' in args[0] and self.jobs:
0099              args.append('-j')
0100              args.append(str(self.jobs))
0101  
0102 diff --git a/pyqtbuild/project.py b/pyqtbuild/project.py
0103 index 8a816ad..5f8fd79 100644
0104 --- a/pyqtbuild/project.py
0105 +++ b/pyqtbuild/project.py
0106 @@ -24,6 +24,10 @@
0107  
0108  import os
0109  import sys
0110 +try:
0111 +    from sysconfig import _POSIX_BUILD
0112 +except:
0113 +    _POSIX_BUILD = False
0114  
0115  from sipbuild import Option, Project, UserException
0116  
0117 @@ -72,7 +76,7 @@ class PyQtProject(Project):
0118          # Get the details of the default Python interpreter library.  Note that
0119          # these are actually non-user options but we need the 'link_full_dll'
0120          # user option in order to set them.
0121 -        if self.py_platform == 'win32':
0122 +        if self.py_platform == 'win32' and not _POSIX_BUILD:
0123              pylib_dir = os.path.join(sys.base_prefix, 'libs')
0124  
0125              debug_suffix = '_d' if self.py_debug else ''
0126 -- 
0127 2.37.1.windows.1
0128