summaryrefslogtreecommitdiff
path: root/dev-qt/qtermwidget/files/qtermwidget-0.7.1-pyqt5.7-compat.patch
blob: dc2e27b921cd4825b06f1e6b8cd5797ee53bfd3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
diff -Nur a/pyqt/config.py b/pyqt/config.py
--- a/pyqt/config.py	2016-12-21 17:51:55.000000000 +0000
+++ b/pyqt/config.py	2017-12-04 00:32:48.237068001 +0000
@@ -5,66 +5,74 @@
 import site
 import pprint
 from distutils import sysconfig
-import pyqtconfig
 from PyQt5 import QtCore
 import PyQt5
 
+
 class Configuration(sipconfig.Configuration):
-	"""The class that represents PyQt configuration values.
-	"""
-	def getEnv(self,name, default):
-		return os.environ.get(name) or default
-
-	def __init__(self):
-		qtconfig = subprocess.check_output(["/usr/lib64/qt5/bin/qmake", "-query"], universal_newlines=True)
-		qtconfig = dict(x.split(":", 1) for x in qtconfig.splitlines())
-
-		self.pyQtIncludePath = self.getEnv('PYQT_INCLUDE_PATH','/usr/share/sip/PyQt5' )
-
-		pyqtconfig = {
-			"pyqt_config_args":   "--confirm-license -v "+str(self.pyQtIncludePath)+" --qsci-api -q /usr/lib64/qt5/bin/qmake",
-			"pyqt_version":       QtCore.PYQT_VERSION,
-			"pyqt_version_str":   QtCore.PYQT_VERSION_STR,
-			"pyqt_bin_dir":       PyQt5.__path__[0],
-			"pyqt_mod_dir":       PyQt5.__path__[0],
-			"pyqt_sip_dir":       str(self.pyQtIncludePath),
-			"pyqt_modules":       "QtCore QtGui QtWidgets",   #... and many more
-			"pyqt_sip_flags":     QtCore.PYQT_CONFIGURATION['sip_flags'],
-			"qt_version":         QtCore.QT_VERSION,
-			"qt_edition":         "free",
-			"qt_winconfig":       "shared",
-			"qt_framework":       0,
-			"qt_threaded":        1,
-			"qt_dir":             qtconfig['QT_INSTALL_PREFIX'],
-			"qt_data_dir":        qtconfig['QT_INSTALL_DATA'],
-			"qt_archdata_dir":    qtconfig['QT_INSTALL_DATA'],
-			"qt_inc_dir":         qtconfig['QT_INSTALL_HEADERS'],
-			"qt_lib_dir":         qtconfig['QT_INSTALL_LIBS']
-		}
-
-		macros = sipconfig._default_macros.copy()
-		macros['INCDIR_QT'] = qtconfig['QT_INSTALL_HEADERS']
-		macros['LIBDIR_QT'] = qtconfig['QT_INSTALL_LIBS']
-		macros['MOC'] = os.path.join(qtconfig['QT_INSTALL_BINS'], 'moc')
+    """The class that represents PyQt configuration values.
+    """
+
+    def getEnv(self, name, default):
+        return os.environ.get(name) or default
 
-		sipconfig.Configuration.__init__(self, [pyqtconfig])
-		self.set_build_macros(macros)
+    def __init__(self):
+        qmake_bin = subprocess.check_output(
+            ["which", "qmake"], universal_newlines=True).strip(' \t\n\r')
+        qtconfig = subprocess.check_output(
+            [qmake_bin, "-query"], universal_newlines=True)
+        qtconfig = dict(x.split(":", 1) for x in qtconfig.splitlines())
+
+        self.pyQtIncludePath = self.getEnv(
+            'PYQT_INCLUDE_PATH', '/usr/share/sip/PyQt5')
+
+        pyqtconfig = {
+            "pyqt_config_args":   "--confirm-license -v " + str(self.pyQtIncludePath) + " --qsci-api -q " + qmake_bin,
+            "pyqt_version":       QtCore.PYQT_VERSION,
+            "pyqt_version_str":   QtCore.PYQT_VERSION_STR,
+            "pyqt_bin_dir":       PyQt5.__path__[0],
+            "pyqt_mod_dir":       PyQt5.__path__[0],
+            "pyqt_sip_dir":       str(self.pyQtIncludePath),
+            "pyqt_modules":       "QtCore QtGui QtWidgets",  # ... and many more
+            "pyqt_sip_flags":     QtCore.PYQT_CONFIGURATION['sip_flags'],
+            "qt_version":         QtCore.QT_VERSION,
+            "qt_edition":         "free",
+            "qt_winconfig":       "shared",
+            "qt_framework":       0,
+            "qt_threaded":        1,
+            "qt_dir":             qtconfig['QT_INSTALL_PREFIX'],
+            "qt_data_dir":        qtconfig['QT_INSTALL_DATA'],
+            "qt_archdata_dir":    qtconfig['QT_INSTALL_DATA'],
+            "qt_inc_dir":         qtconfig['QT_INSTALL_HEADERS'],
+            "qt_lib_dir":         qtconfig['QT_INSTALL_LIBS']
+        }
+
+        macros = sipconfig._default_macros.copy()
+        macros['INCDIR_QT'] = qtconfig['QT_INSTALL_HEADERS']
+        macros['LIBDIR_QT'] = qtconfig['QT_INSTALL_LIBS']
+        macros['MOC'] = os.path.join(qtconfig['QT_INSTALL_BINS'], 'moc')
 
+        sipconfig.Configuration.__init__(self, [pyqtconfig])
+        self.set_build_macros(macros)
 
-## The name of the SIP build file generated by SIP and used by the build system.
+
+# The name of the SIP build file generated by SIP and used by the build system.
 build_file = "qtermwidget.sbf"
 
 # Get the SIP configuration information.
 config = Configuration()
 
 # Run SIP to generate the build_file
-os.system(" ".join([config.sip_bin, '-I' , str(config.pyQtIncludePath), str(config.pyqt_sip_flags), "-b", build_file,"-o", "-c", ". " " qtermwidget.sip"]))
+os.system(" ".join([config.sip_bin, '-I', str(config.pyQtIncludePath), str(
+    config.pyqt_sip_flags), "-b", build_file, "-o", "-c", ". " " qtermwidget.sip"]))
 
 installs = []
-installs.append(["qtermwidget.sip", os.path.join(config.pyqt_sip_dir,"qtermwidget")])
+installs.append(["qtermwidget.sip", os.path.join(
+    config.pyqt_sip_dir, "qtermwidget")])
 installs.append(["qtermwidgetconfig.py", config.pyqt_mod_dir])
 
-makefile = sipconfig.SIPModuleMakefile( configuration = config, build_file = build_file, installs = installs,  qt=["QtCore" ,"QtGui", "QtWidgets"] )
+makefile = sipconfig.SIPModuleMakefile(
+    configuration=config, build_file=build_file, installs=installs,  qt=["QtCore", "QtGui", "QtWidgets"])
 
 # Add the library we are wrapping.  The name doesn't include any platform
 # specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
@@ -73,20 +81,23 @@
 makefile.extra_lib_dirs.append("..")
 makefile.extra_libs = ["qtermwidget5"]
 
+# Support for C++11
+makefile.extra_cxxflags.append('-std=c++11')
+
 # Generate the Makefile itself.
 makefile.generate()
 
 content = {
-	# Publish where the SIP specifications for this module will be
-	# installed.
-	"qtermwidget_sip_dir": config.pyqt_sip_dir,
-
-	# Publish the set of SIP flags needed by this module.  As these are the
-	# same flags needed by the qt module we could leave it out, but this
-	# allows us to change the flags at a later date without breaking
-	# scripts that import the configuration module.
-	"qtermwidget_sip_flags": config.pyqt_sip_flags
-	}
+    # Publish where the SIP specifications for this module will be
+    # installed.
+    "qtermwidget_sip_dir": config.pyqt_sip_dir,
+
+    # Publish the set of SIP flags needed by this module.  As these are the
+    # same flags needed by the qt module we could leave it out, but this
+    # allows us to change the flags at a later date without breaking
+    # scripts that import the configuration module.
+    "qtermwidget_sip_flags": config.pyqt_sip_flags
+}
 
 # This creates the qtermwidgetconfig.py module from the qtermwidgetconfig.py.in
 # template and the dictionary.