summaryrefslogtreecommitdiff
path: root/devel/py-qt5-core/files/patch-configure.py
blob: e42c1216987b760111413aed219f15f406e3e7ea (plain) (blame)
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
This patch is necessary for us to split PyQt5 up into several different ports.

It works by conditionally building and installing some tools (such as
pylupdate5 and pyrcc5), replacing the all-encompassing PyQt5.api file that
depends on different modules with module-specific .api files.

Also fixes a bug where dbus support drops multiple -I flags produced
by pkg-config --cflags dbus-1 .

Also fixes the build of www/py-qt5-webengine@py36 by adding printsupport to
QtWebEngineWidgets.

Also causes .pyi files to be installed regardless of the Python version to
simplify plist handling.
--- configure.py.orig	2019-07-04 16:44:01 UTC
+++ configure.py
@@ -528,7 +528,7 @@ class TargetConfiguration:
         self.no_pydbus = False
         self.no_qml_plugin = False
         self.no_tools = False
-        self.prot_is_public = (self.py_platform.startswith('linux') or self.py_platform == 'darwin')
+        self.prot_is_public = (self.py_platform.startswith('linux') or self.py_platform.startswith('freebsd') or self.py_platform == 'darwin')
         self.qmake = self._find_exe('qmake')
         self.qmake_spec = ''
         self.qmake_spec_default = ''
@@ -799,7 +799,7 @@ class TargetConfiguration:
         """
 
         # The platform may have changed so update the default.
-        if self.py_platform.startswith('linux') or self.py_platform == 'darwin':
+        if self.py_platform.startswith('linux') or self.py_platform.startswith('freebsd') or self.py_platform == 'darwin':
             self.prot_is_public = True
 
         self.vend_inc_dir = self.py_venv_inc_dir
@@ -1494,8 +1494,9 @@ def generate_makefiles(target_config, verbose, parts, 
 
     # Add the internal modules if they are required.
     if not target_config.no_tools:
-        pyqt_modules.append('pylupdate')
-        pyqt_modules.append('pyrcc')
+        if "QtXml" in target_config.pyqt_modules:
+            pyqt_modules.append('pylupdate')
+            pyqt_modules.append('pyrcc')
 
     for mname in pyqt_modules:
         metadata = MODULE_METADATA[mname]
@@ -1539,7 +1540,8 @@ def generate_makefiles(target_config, verbose, parts, 
 
     generate_sip_module_code(target_config, verbose, parts, tracing, 'Qt',
             fatal_warnings, sip_flags, False)
-    subdirs.append('Qt')
+    if "QtCore" in target_config.pyqt_modules:
+        subdirs.append('Qt')
 
     # Generate the top-level __init__.py.
     inf = open(source_path('__init__.py'))
@@ -1583,16 +1585,18 @@ del find_qt
     # Generate any executable wrappers.
     wrappers = []
     if not target_config.no_tools:
-        # Generate the pylupdate5 and pyrcc5 wrappers.
-        for tool in ('pylupdate', 'pyrcc'):
-            wrappers.append((tool,
-                    generate_tool_wrapper(target_config, tool + '5',
-                            'PyQt5.%s_main' % tool)))
+        if "QtXml" in target_config.pyqt_modules:
+            # Generate the pylupdate5 and pyrcc5 wrappers.
+            for tool in ('pylupdate', 'pyrcc'):
+                wrappers.append((tool,
+                        generate_tool_wrapper(target_config, tool + '5',
+                                'PyQt5.%s_main' % tool)))
 
-        # Generate the pyuic5 wrapper.
-        wrappers.append(('pyuic',
-                generate_tool_wrapper(target_config, 'pyuic5',
-                        'PyQt5.uic.pyuic')))
+        if "QtCore" in target_config.pyqt_modules:
+            # Generate the pyuic5 wrapper.
+            wrappers.append(('pyuic',
+                    generate_tool_wrapper(target_config, 'pyuic5',
+                            'PyQt5.uic.pyuic')))
 
     # Generate the Qt Designer plugin.
     if not target_config.no_designer_plugin and 'QtDesigner' in target_config.pyqt_modules:
@@ -1608,23 +1612,6 @@ del find_qt
                     source_path('examples', 'quick', 'tutorials', 'extending',
                             'chapter6-plugins'))
 
-    # Generate the QScintilla API file.
-    if target_config.qsci_api:
-        inform("Generating the QScintilla API file...")
-        f = open_for_writing('PyQt5.api')
-
-        for mname in target_config.pyqt_modules:
-            if MODULE_METADATA[mname].public:
-                api = open(mname + '.api')
-
-                for l in api:
-                    f.write('PyQt5.' + l)
-
-                api.close()
-                os.remove(mname + '.api')
-
-        f.close()
-
     # Generate the Python dbus module.
     if target_config.pydbus_module_dir != '':
         mname = 'dbus'
@@ -1655,27 +1642,31 @@ del find_qt
         all_installs.append(
                 root_dir + '/' + module_file_name(target_config, mname))
 
-    all_installs.append(root_dir + '/' + module_file_name(target_config, 'Qt'))
+    # all_installs.append(root_dir + '/' + module_file_name(target_config, 'Qt'))
 
     out_f.write('''TEMPLATE = subdirs
 CONFIG += ordered nostrip
 SUBDIRS = %s
+''' % (' '.join(subdirs)))
 
-init_py.files = __init__.py
+    if "QtCore" in target_config.pyqt_modules:
+        out_f.write('''
+init_py.files = %s
 init_py.path = %s
 INSTALLS += init_py
-''' % (' '.join(subdirs), root_dir))
+''' % (source_path('__init__.py'), root_dir))
 
-    all_installs.append(root_dir + '/__init__.py')
+    # all_installs.append(root_dir + '/__init__.py')
 
-    # Install the uic module.
-    out_f.write('''
+        if not target_config.no_tools:
+            # Install the uic module.
+            out_f.write('''
 uic_package.files = %s
 uic_package.path = %s
 INSTALLS += uic_package
 ''' % (source_path('pyuic', 'uic'), root_dir))
 
-    all_installs.append(root_dir + '/uic')
+    # all_installs.append(root_dir + '/uic')
 
     # Install the tool main scripts and wrappers.
     if wrappers:
@@ -1704,6 +1695,8 @@ INSTALLS += tools
     # Install the .sip files.
     if target_config.pyqt_sip_dir:
         for mname, metadata in MODULE_METADATA.items():
+            if mname not in pyqt_modules:
+                continue
             if metadata.public and mname != 'Qt':
                 sip_files = matching_files(source_path('sip', mname, '*.sip'))
 
@@ -1723,7 +1716,7 @@ INSTALLS += sip%s
                     all_installs.append(mdir)
 
     # Install the stub files.
-    if target_config.py_version >= 0x030500 and target_config.pyqt_stubs_dir:
+    if target_config.pyqt_stubs_dir:
         pyi_names = [mname + '.pyi'
                 for mname in target_config.pyqt_modules if mname[0] != '_']
 
@@ -1741,14 +1734,15 @@ INSTALLS += pep484_stubs
     # Install the QScintilla .api file.
     if target_config.qsci_api:
         api_dir = target_config.qsci_api_dir + '/api/python'
+        api_list = ' '.join(['%s.api' % m for m in target_config.pyqt_modules])
 
         out_f.write('''
-qscintilla_api.files = PyQt5.api
+qscintilla_api.files = %s 
 qscintilla_api.path = %s
 INSTALLS += qscintilla_api
-''' % qmake_quote(api_dir))
+''' % (api_list, qmake_quote(api_dir)))
 
-        all_installs.append(api_dir + '/PyQt5.api')
+    # all_installs.append(api_dir + '/PyQt5.api')
 
     if distinfo:
         # The command to run to generate the .dist-info directory.
@@ -2012,7 +2006,7 @@ def inform_user(target_config, sip_version):
                         os.path.join(
                                 target_config.qsci_api_dir, 'api', 'python'))
 
-    if target_config.py_version >= 0x030500 and target_config.pyqt_stubs_dir:
+    if target_config.pyqt_stubs_dir:
         inform("The PyQt5 PEP 484 stub files will be installed in %s." %
                 target_config.pyqt_stubs_dir)
 
@@ -2589,7 +2583,7 @@ def generate_sip_module_code(target_config, verbose, p
             argv.append('-a')
             argv.append(mname + '.api')
 
-        if target_config.py_version >= 0x030500 and target_config.pyqt_stubs_dir:
+        if target_config.pyqt_stubs_dir:
             argv.append('-y')
             argv.append(mname + '.pyi')
 
@@ -2762,7 +2756,7 @@ target.files = $$PY_MODULE
     pro_lines.append('INSTALLS += target')
 
     # This optimisation could apply to other platforms.
-    if 'linux' in target_config.qmake_spec and not target_config.static:
+    if not target_config.static:
         if target_config.py_version >= 0x030000:
             entry_point = 'PyInit_%s' % target_name
         else: