cutienator 0.0.1.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. cutienator/__init__.py +44 -0
  2. cutienator/_cpp_addr.py +84 -0
  3. cutienator/_cpp_box.py +23 -0
  4. cutienator/_cute_load_hook.py +159 -0
  5. cutienator/_cute_mixin.py +166 -0
  6. cutienator/_cute_overload.py +285 -0
  7. cutienator/_cute_space.py +727 -0
  8. cutienator/_header_descriptor.py +4 -0
  9. cutienator/_meta_cute.py +444 -0
  10. cutienator/_q_binding_storage.py +101 -0
  11. cutienator/_q_event.py +185 -0
  12. cutienator/_q_meta_object.py +118 -0
  13. cutienator/_q_object.py +582 -0
  14. cutienator/_q_thread.py +106 -0
  15. cutienator/_q_widget.py +80 -0
  16. cutienator/_ugly.py +296 -0
  17. cutienator/_wait.py +303 -0
  18. cutienator/_waiting_overload.py +261 -0
  19. cutienator/example/__init__.py +21 -0
  20. cutienator/example/__main__.py +67 -0
  21. cutienator/example/_calls.py +107 -0
  22. cutienator/occult/__init__.py +27 -0
  23. cutienator/occult/__main__.py +50 -0
  24. cutienator/occult/_base_meta_ugly.py +29 -0
  25. cutienator/occult/_build.py +561 -0
  26. cutienator/occult/_cognito_warning.py +35 -0
  27. cutienator/occult/_declaration.py +572 -0
  28. cutienator/occult/_header.py +710 -0
  29. cutienator/occult/_ritual.py +19 -0
  30. cutienator/occult/_rituals.py +594 -0
  31. cutienator/occult/_shared_object.py +292 -0
  32. cutienator/occult/_symbol.py +162 -0
  33. cutienator/occult/rituals/q_event.cpp +70 -0
  34. cutienator/occult/rituals/q_meta_object.cpp +173 -0
  35. cutienator/occult/rituals/q_object.cpp +178 -0
  36. cutienator/trial/__init__.py +25 -0
  37. cutienator/trial/__main__.py +59 -0
  38. cutienator/trial/_judge.py +589 -0
  39. cutienator/trial/_q_object_trials.py +38 -0
  40. cutienator/trial/_trial.py +495 -0
  41. cutienator/trial/_verdict.py +332 -0
  42. cutienator-0.0.1.dev0.dist-info/METADATA +33 -0
  43. cutienator-0.0.1.dev0.dist-info/RECORD +46 -0
  44. cutienator-0.0.1.dev0.dist-info/WHEEL +5 -0
  45. cutienator-0.0.1.dev0.dist-info/licenses/LICENSE +201 -0
  46. cutienator-0.0.1.dev0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,561 @@
1
+ """Build compiles ritual files into one shared object."""
2
+ # Apache-2.0 license
3
+ # Copyright (c) 2026 Asger Jon Vistisen
4
+ from __future__ import annotations
5
+
6
+ import os
7
+ import subprocess
8
+ from typing import TYPE_CHECKING
9
+
10
+ from worktoy.waitaminute import MissingVariable, TypeException
11
+
12
+ if TYPE_CHECKING: # pragma: no cover, no mutate
13
+ from typing import Tuple, Optional
14
+
15
+ Paths = Tuple[str, ...]
16
+
17
+
18
+ class Build:
19
+ """
20
+ Compiles ritual files into one shared object by running 'clang++'.
21
+
22
+ build = Build()
23
+ build.setRitualFiles('/here/q_object.cpp', '/here/q_byte_array.cpp')
24
+ build.setTargetFile('/here/libexample.so')
25
+ build.setQtSharedObjects('/usr/lib/libQt6Core.so.6')
26
+ build.run()
27
+
28
+ Terms
29
+ -----
30
+
31
+ - A ritual is one function of ours that Python can call, and that
32
+ calls one Qt function, as 'QObject::parent()'.
33
+ - A ritual file is a C++ file we write, holding rituals. It is named
34
+ for what it provides, not for the language it is written in.
35
+ - The target file is the one shared object the build writes. It
36
+ offers every ritual of the ritual files.
37
+ - A Qt shared object is one of Qt's own compiled files, which the
38
+ rituals call into.
39
+
40
+ You provide
41
+ -----------
42
+
43
+ Three things, each through its own setter, in any order. All three are
44
+ required before 'run'.
45
+
46
+ - 'setRitualFiles': the ritual files to compile.
47
+ - 'setTargetFile': the target file to write.
48
+ - 'setQtSharedObjects': the Qt shared objects the rituals call into.
49
+
50
+ Found for you
51
+ -------------
52
+
53
+ Two things, which have no setter. Each is asked of Qt's own program
54
+ 'qmake6' the first time it is needed, and then remembered for every
55
+ 'Build', since Qt is installed in one place.
56
+
57
+ - 'getQtHeaderFolder': where Qt keeps its headers.
58
+ - 'getQtSharedObjectFolder': where Qt keeps its shared objects.
59
+
60
+ What to expect
61
+ --------------
62
+
63
+ - Nothing is compiled until 'run' is called.
64
+ - A setter refuses a wrong value at once: one that is not text, or a
65
+ path that leads nowhere.
66
+ - A getter whose setter was never called raises 'MissingVariable',
67
+ naming what is missing.
68
+ - 'getCommand' gives the exact 'clang++' command without running it.
69
+ - 'print(build)' lists the setters still to be called.
70
+ """
71
+
72
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
73
+ # STATIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
74
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
75
+
76
+ @staticmethod
77
+ def _run(*command: str) -> str:
78
+ """
79
+ Runs one program to its end and gives what it printed.
80
+
81
+ Every program this class needs, 'clang++' and 'qmake6', is run through
82
+ here, so a failure always carries the program's own message. The
83
+ program has finished by the time this returns: nothing is left
84
+ running, and there is nothing to close.
85
+
86
+ Parameters
87
+ ----------
88
+
89
+ *command : str
90
+ The program, then each of its arguments, one per entry.
91
+
92
+ Returns
93
+ -------
94
+
95
+ str
96
+ What the program printed.
97
+
98
+ Raises
99
+ ------
100
+
101
+ FileNotFoundError
102
+ The program is not installed on this machine.
103
+
104
+ RuntimeError
105
+ The program ran and reported a failure; its message is included.
106
+ """
107
+ try:
108
+ done = subprocess.run(command, capture_output=True, text=True)
109
+ except FileNotFoundError as fileNotFoundError:
110
+ infoSpec = """The program '%s' is needed and is not installed."""
111
+ raise FileNotFoundError(infoSpec % command[0]) from fileNotFoundError
112
+ if done.returncode:
113
+ infoSpec = """The program '%s' failed: %s"""
114
+ raise RuntimeError(infoSpec % (command[0], done.stderr.strip()))
115
+ return done.stdout
116
+
117
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
118
+ # NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
119
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
120
+
121
+ # Class Variables
122
+ __qt_header_folder__: Optional[str] = None
123
+ __qt_shared_object_folder__: Optional[str] = None
124
+
125
+ # Fallback Variables
126
+
127
+ # Private Variables
128
+ __ritual_files__ = None
129
+ __target_file__ = None
130
+ __qt_shared_objects__ = None
131
+
132
+ # Public Variables
133
+
134
+ # Virtual Variables
135
+
136
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
137
+ # GETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
138
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
139
+
140
+ @classmethod
141
+ def _createQtHeaderFolder(cls, ) -> None:
142
+ """Asks 'qmake6' where Qt keeps its headers and remembers it."""
143
+ answer = cls._run('qmake6', '-query', 'QT_INSTALL_HEADERS')
144
+ cls.__qt_header_folder__ = answer.strip()
145
+
146
+ @classmethod
147
+ def getQtHeaderFolder(cls, **kwargs) -> str:
148
+ """
149
+ Gives the folder where Qt keeps its headers, as '/usr/include/qt6'.
150
+
151
+ Found for you: there is no setter. The first call asks Qt's own
152
+ program 'qmake6', and the answer is remembered on the class for every
153
+ 'Build'. Call it on the class or on an instance, with no arguments;
154
+ the keyword is for the method's own use.
155
+
156
+ Returns
157
+ -------
158
+
159
+ str
160
+ The full path of the folder.
161
+
162
+ Raises
163
+ ------
164
+
165
+ FileNotFoundError
166
+ 'qmake6' is not installed, which usually means Qt's development
167
+ files are not either.
168
+
169
+ RuntimeError
170
+ 'qmake6' ran and reported a failure; its message is included.
171
+ """
172
+ if cls.__qt_header_folder__ is None:
173
+ if kwargs.get('_recursion', False):
174
+ raise RecursionError
175
+ cls._createQtHeaderFolder()
176
+ return cls.getQtHeaderFolder(_recursion=True)
177
+ return cls.__qt_header_folder__
178
+
179
+ @classmethod
180
+ def _createQtSharedObjectFolder(cls, ) -> None:
181
+ """Asks 'qmake6' where Qt keeps its shared objects and remembers it."""
182
+ answer = cls._run('qmake6', '-query', 'QT_INSTALL_LIBS')
183
+ cls.__qt_shared_object_folder__ = answer.strip()
184
+
185
+ @classmethod
186
+ def getQtSharedObjectFolder(cls, **kwargs) -> str:
187
+ """
188
+ Gives the folder where Qt keeps its shared objects, as '/usr/lib'.
189
+
190
+ Found for you: there is no setter. The first call asks Qt's own
191
+ program 'qmake6', and the answer is remembered on the class for every
192
+ 'Build'. Call it on the class or on an instance, with no arguments;
193
+ the keyword is for the method's own use.
194
+
195
+ Join it with a file name to get a path for 'setQtSharedObjects':
196
+ 'os.path.join(folder, "libQt6Core.so.6")'.
197
+
198
+ Returns
199
+ -------
200
+
201
+ str
202
+ The full path of the folder.
203
+
204
+ Raises
205
+ ------
206
+
207
+ FileNotFoundError
208
+ 'qmake6' is not installed, which usually means Qt's development
209
+ files are not either.
210
+
211
+ RuntimeError
212
+ 'qmake6' ran and reported a failure; its message is included.
213
+ """
214
+ if cls.__qt_shared_object_folder__ is None:
215
+ if kwargs.get('_recursion', False):
216
+ raise RecursionError
217
+ cls._createQtSharedObjectFolder()
218
+ return cls.getQtSharedObjectFolder(_recursion=True)
219
+ return cls.__qt_shared_object_folder__
220
+
221
+ def getRitualFiles(self) -> Paths:
222
+ """
223
+ Gives the ritual files this build compiles: the C++ files we write,
224
+ holding the plainly named functions the target file will offer.
225
+
226
+ Provided by you, through 'setRitualFiles'. Nothing fills it in for
227
+ you.
228
+
229
+ Returns
230
+ -------
231
+
232
+ Paths
233
+ A 'Tuple[str, ...]' of full paths, in the order you gave them.
234
+
235
+ Raises
236
+ ------
237
+
238
+ MissingVariable
239
+ 'setRitualFiles' has not been called on this build.
240
+ """
241
+ if self.__ritual_files__ is None:
242
+ raise MissingVariable(self, '__ritual_files__', tuple)
243
+ return self.__ritual_files__
244
+
245
+ def getTargetFile(self) -> str:
246
+ """
247
+ Gives the shared object this build writes.
248
+
249
+ Provided by you, through 'setTargetFile'. Nothing fills it in for
250
+ you. Having the path does not mean the file is there: it exists once
251
+ 'run' has been called.
252
+
253
+ Returns
254
+ -------
255
+
256
+ str
257
+ The full path of the file.
258
+
259
+ Raises
260
+ ------
261
+
262
+ MissingVariable
263
+ 'setTargetFile' has not been called on this build.
264
+ """
265
+ if self.__target_file__ is None:
266
+ raise MissingVariable(self, '__target_file__', str)
267
+ return self.__target_file__
268
+
269
+ def getQtSharedObjects(self, **kwargs) -> Paths:
270
+ """
271
+ Gives the Qt shared objects the target file will call into.
272
+
273
+ Provided by you, through 'setQtSharedObjects'. Nothing fills it in
274
+ for you: the build does not work out which of Qt's files your C++
275
+ files use.
276
+
277
+ Returns
278
+ -------
279
+
280
+ Paths
281
+ A 'Tuple[str, ...]' of full paths, in the order you gave them. It
282
+ is empty when you said the rituals call into nothing of Qt.
283
+
284
+ Raises
285
+ ------
286
+
287
+ MissingVariable
288
+ 'setQtSharedObjects' has not been called on this build.
289
+ """
290
+ if self.__qt_shared_objects__ is None:
291
+ if kwargs.get('_recursion', False):
292
+ raise RecursionError
293
+ self.setQtSharedObjects()
294
+ return self.getQtSharedObjects(_recursion=True)
295
+ return self.__qt_shared_objects__
296
+
297
+ def getCommand(self) -> Paths:
298
+ """
299
+ Gives the exact 'clang++' command that 'run' runs, without running
300
+ it.
301
+
302
+ Call it to see what a build will do, or to paste the command into a
303
+ terminal: "' '.join(build.getCommand())". It is put together from
304
+ what you provided through the three setters, and from Qt's header
305
+ folder, which is found for you.
306
+
307
+ The compiler and its '-std' are those that read Qt's headers when
308
+ the ritual files were generated. A header may give a class other
309
+ functions for another compiler or another standard, as Qt's
310
+ 'qfloat16.h' does, and a ritual written from what one of them read
311
+ would then not compile with the other.
312
+
313
+ Returns
314
+ -------
315
+
316
+ Paths
317
+ A 'Tuple[str, ...]', one argument per entry: 'clang++', then
318
+ '-std=c++17', the standard the headers were read by;
319
+ '-shared', to make a shared object and not a program;
320
+ '-fPIC', so the code can sit at any address;
321
+ '-O2', so the compiler tidies the result;
322
+ '-fvisibility-inlines-hidden', so Qt's inline code leaves no
323
+ scrambled names in the target file;
324
+ '-Wl,--no-undefined', so a ritual calling a function that no Qt
325
+ shared object offers stops the build here, and not the first
326
+ program that opens the target file;
327
+ '-Wl,-rpath,' with the folder of each Qt shared object, so the
328
+ target file opens the Qt it was built against. Without it the
329
+ target file looks only where the machine keeps its own shared
330
+ objects, as '/usr/lib': a Qt installed elsewhere is not found
331
+ there, and another Qt that is there would be opened instead;
332
+ '-I' with the folder of Qt's headers;
333
+ the path of each ritual file;
334
+ '-o' with the path of the target file;
335
+ the path of each Qt shared object the target file calls into.
336
+
337
+ Raises
338
+ ------
339
+
340
+ MissingVariable
341
+ One of the three setters has not been called; the message names
342
+ the missing value.
343
+
344
+ FileNotFoundError
345
+ 'qmake6' is not installed.
346
+ """
347
+ qtFolders = []
348
+ for qtSharedObject in self.getQtSharedObjects():
349
+ qtFolder = os.path.dirname(qtSharedObject)
350
+ if qtFolder not in qtFolders:
351
+ qtFolders.append(qtFolder)
352
+ return (
353
+ 'clang++', '-std=c++17', '-shared', '-fPIC', '-O2',
354
+ '-fvisibility-inlines-hidden',
355
+ '-Wl,--no-undefined',
356
+ *('-Wl,-rpath,%s' % qtFolder for qtFolder in qtFolders),
357
+ '-I%s' % self.getQtHeaderFolder(), *self.getRitualFiles(),
358
+ '-o', self.getTargetFile(), *self.getQtSharedObjects(),
359
+ )
360
+
361
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
362
+ # SETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
363
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
364
+
365
+ def setRitualFiles(self, *ritualFiles: str) -> None:
366
+ """
367
+ Tells the build which files hold the rituals: the plainly named
368
+ functions the target file will offer to Python, each calling one Qt
369
+ function. They are the C++ files we write ourselves, as
370
+ 'q_object.cpp', never Qt's own.
371
+
372
+ Required before 'run'. Calling it again replaces the files given
373
+ before.
374
+
375
+ Parameters
376
+ ----------
377
+
378
+ *ritualFiles : str
379
+ The path of each ritual file, one argument per file and at least
380
+ one. A path may be relative to where Python was started; it is
381
+ kept in full. Each file must exist already.
382
+
383
+ Raises
384
+ ------
385
+
386
+ ValueError
387
+ Called with no path at all.
388
+
389
+ TypeException
390
+ A path is not text.
391
+
392
+ FileNotFoundError
393
+ A path leads to no file.
394
+ """
395
+ if not ritualFiles:
396
+ infoSpec = """A build needs at least one ritual file, and no path
397
+ was given."""
398
+ raise ValueError(' '.join(infoSpec.split()))
399
+ for ritualFile in ritualFiles:
400
+ if not isinstance(ritualFile, str):
401
+ raise TypeException('ritualFile', ritualFile, str)
402
+ if not os.path.isfile(ritualFile):
403
+ infoSpec = """There is no ritual file at '%s'."""
404
+ raise FileNotFoundError(infoSpec % ritualFile)
405
+ self.__ritual_files__ = (
406
+ *(os.path.abspath(path) for path in ritualFiles),
407
+ )
408
+
409
+ def setTargetFile(self, targetFile: str) -> None:
410
+ """
411
+ Tells the build which shared object to write.
412
+
413
+ Required before 'run', which creates the file and replaces one
414
+ already there. Calling this again replaces the path given before.
415
+
416
+ Parameters
417
+ ----------
418
+
419
+ targetFile : str
420
+ The path of the one file to write, as 'libexample.so'. A path may
421
+ be relative to where Python was started; it is kept in full. The
422
+ folder it lies in must exist already; the file need not.
423
+
424
+ Raises
425
+ ------
426
+
427
+ TypeException
428
+ The path is not text.
429
+
430
+ FileNotFoundError
431
+ The folder the file would lie in does not exist.
432
+ """
433
+ if not isinstance(targetFile, str):
434
+ raise TypeException('targetFile', targetFile, str)
435
+ targetFile = os.path.abspath(targetFile)
436
+ folder = os.path.dirname(targetFile)
437
+ if not os.path.isdir(folder):
438
+ infoSpec = """The target file '%s' would lie in a folder that does
439
+ not exist."""
440
+ raise FileNotFoundError(' '.join((infoSpec % targetFile).split()))
441
+ self.__target_file__ = targetFile
442
+
443
+ def setQtSharedObjects(self, *qtSharedObjects: str) -> None:
444
+ """
445
+ Tells the build which of Qt's shared objects the rituals call into.
446
+
447
+ Required before 'run', even when the answer is none: call it with no
448
+ arguments then. Calling it again replaces the paths given before.
449
+
450
+ Name the file holding each Qt class the ritual files include: 'QObject'
451
+ is in 'libQt6Core.so.6', 'QWidget' in 'libQt6Widgets.so.6'. Those
452
+ files lie in the folder 'getQtSharedObjectFolder' gives.
453
+
454
+ Parameters
455
+ ----------
456
+
457
+ *qtSharedObjects : str
458
+ The path of each Qt shared object, one argument per file, as
459
+ '/usr/lib/libQt6Core.so.6'. A path may be relative to where Python
460
+ was started; it is kept in full. Each file must exist.
461
+
462
+ Raises
463
+ ------
464
+
465
+ TypeException
466
+ A path is not text.
467
+
468
+ FileNotFoundError
469
+ A path leads to no file.
470
+ """
471
+ for qtSharedObject in qtSharedObjects:
472
+ if not isinstance(qtSharedObject, str):
473
+ raise TypeException('qtSharedObject', qtSharedObject, str)
474
+ if not os.path.isfile(qtSharedObject):
475
+ infoSpec = """There is no Qt shared object at '%s'."""
476
+ raise FileNotFoundError(infoSpec % qtSharedObject)
477
+ self.__qt_shared_objects__ = (
478
+ *(os.path.abspath(f) for f in qtSharedObjects),
479
+ )
480
+
481
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
482
+ # NOTIFIERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
483
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
484
+
485
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
486
+ # Python API # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
487
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
488
+
489
+ def __str__(self) -> str:
490
+ """Says which setters are still to be called, or what will be made."""
491
+ clsName = type(self).__name__
492
+ unset = [
493
+ setter for setter, value in (
494
+ ('setRitualFiles', self.__ritual_files__),
495
+ ('setTargetFile', self.__target_file__),
496
+ ('setQtSharedObjects', self.__qt_shared_objects__),
497
+ ) if value is None
498
+ ]
499
+ if unset:
500
+ infoSpec = """<%s still waiting for: %s>"""
501
+ return infoSpec % (clsName, ', '.join(unset))
502
+ infoSpec = """<%s of %d ritual files into '%s'>"""
503
+ count = len(self.__ritual_files__)
504
+ return infoSpec % (clsName, count, self.__target_file__)
505
+
506
+ __repr__ = __str__
507
+
508
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
509
+ # CONSTRUCTORS # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
510
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
511
+
512
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
513
+ # DOMAIN SPECIFIC # # # # # # # # # # # # # # # # # # # # # # # # # # # #
514
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
515
+
516
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
517
+ # OPTIONAL METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
518
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
519
+
520
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
521
+ # REQUIRED METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # #
522
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
523
+
524
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
525
+ # PARENT METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
526
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
527
+
528
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
529
+ # PUBLIC METHODS # # # # # # # # # # # # # # # # # # # # # # # # # # # #
530
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
531
+
532
+ def run(self) -> str:
533
+ """
534
+ Compiles the ritual files into the target file.
535
+
536
+ This is the only method that compiles. All three setters must have
537
+ been called first. It returns when 'clang++' has finished, which takes
538
+ one to three seconds per ritual file that includes Qt's headers.
539
+
540
+ Returns
541
+ -------
542
+
543
+ str
544
+ The full path of the target file, which now exists.
545
+
546
+ Raises
547
+ ------
548
+
549
+ MissingVariable
550
+ One of the three setters has not been called; the message names
551
+ the missing value.
552
+
553
+ FileNotFoundError
554
+ 'clang++' or 'qmake6' is not installed.
555
+
556
+ RuntimeError
557
+ 'clang++' refused the ritual files. Its own message, with the file
558
+ names and line numbers, is included.
559
+ """
560
+ self._run(*self.getCommand())
561
+ return self.getTargetFile()
@@ -0,0 +1,35 @@
1
+ """
2
+ CognitoHazard subclasses 'UserWarning'.
3
+ """
4
+ # Apache-2.0 license
5
+ # Copyright (c) 2026 Asger Jon Vistisen
6
+ from __future__ import annotations
7
+
8
+ from typing import TYPE_CHECKING
9
+
10
+ import os
11
+
12
+ if TYPE_CHECKING: # pragma: no cover, no mutate
13
+ from typing import Optional
14
+
15
+
16
+ class CognitoWarning(UserWarning):
17
+ """
18
+ CognitoHazard subclasses 'UserWarning'.
19
+ """
20
+
21
+ __slots__ = ('note',)
22
+
23
+ def __init__(self, note: Optional[str] = None) -> None:
24
+ if note is not None:
25
+ self.note = note
26
+ super().__init__(self.__str__())
27
+
28
+ def __str__(self) -> str:
29
+ infoSpec: str = """Warning, Cognito Hazard Ahead!%s%s"""
30
+ try:
31
+ noteStr = self.note
32
+ except AttributeError:
33
+ return infoSpec % ('', '')
34
+ else:
35
+ return infoSpec % (os.linesep, noteStr)