aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
Commit message (Collapse)AuthorAgeFilesLines
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-281-665/+0
| | | | | | | | Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I4cb5ee4c8df539546014b08202a7b1e98ed3ff07 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-201-0/+10
|\ | | | | | | Change-Id: Iaabea628351fac9da88b5779b537f62262ff82a7
| * Add some more classes from QtConcurrentFriedemann Kleint2020-10-161-0/+10
| | | | | | | | | | | | | | | | | | This lays the foundation for adding further specializations of QFuture and QFutureWatcher to dependent modules. Task-number: PYSIDE-1202 Change-Id: I82f9940db9d50ced95d4e1388c6460c6efc0469b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-161-8/+0
|\| | | | | | | Change-Id: I27beffe4a6e2fc2f818960c3b9f5ffbfaac4a670
| * Enable typesystem typedefs across modulesFriedemann Kleint2020-10-151-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding a specialization of template type ValueWithUnit from libsample to libother would fail since the SBK index array of libsample would be used with the index from libother for it. Build up the inheritance for typesystem typedefs early on and add a lookup which matches the template specializations found during traversing functions to the type def and the class that is generated for it so that it can be used. As a side effect, special case entries for template specializations can be deleted from the signature mappings since they change to the class name and thus are normal types. Task-number: PYSIDE-1202 Change-Id: I5cc9650f70e9dc975171c80919685ebf5e752749 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Add QStringView/QByteArrayViewFriedemann Kleint2020-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | View types as function parameters cannot be converted in the standard way shiboken does it: QStringView cppArg0; pythonToCpp(pyArg, &cppArg0); since they reference some other data. Introduce a new "viewOn" member to type system entry for them. It causes the function arguments to be replaced by their viewed-on types (stringview->string) via metatype. Add a test in libsample and a test for QUuid::fromString(QStringView). Test returning QStringView via QRegularExpressionMatch::capturedView(). Task-number: QTBUG-84319 Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Task-number: PYSIDE-487 Change-Id: Iddb4ea268a54928d290e29012e2738772fae83f0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | signature: Add size_t as int typeFriedemann Kleint2020-09-181-0/+1
| | | | | | | | | | | | | | Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I4cf3e74cd53b06884f7fdfc7d0f023c9bbb62cce Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-171-0/+1
|\| | | | | | | Change-Id: I8aa48d07067c45c888c73af87314f6a88c2a6e14
| * shiboken2: Work around signature problems with smart pointer instantiationsFriedemann Kleint2020-09-161-0/+1
| | | | | | | | | | | | | | | | | | | | - Drop the module of the instantiations. - Add a dummy mapping entry, declaring it to be a 1-tuple. Task-number: PYSIDE-1212 Task-number: PYSIDE-1367 Change-Id: Iddb1feaafbe416ae57d761a33276cb4a1d88e9e3 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Adapt to recent Qt 6 changesFriedemann Kleint2020-09-011-1/+0
| | | | | | | | | | | | | | | | | | | | - Removal of the statemachine framework from QtCore - Addition of QAbstractFileIconProvider - Adapt some signatures - QMetaType deprecations Change-Id: Ia51354542ad1d2f0bb5530e45ebef0d6ccdb633d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-08-311-0/+5
|\| | | | | | | Change-Id: Icf4b3535be52b64ef15eced7103bb1280e031e30
| * signature: pass `self` directly from parserChristian Tismer2020-08-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The signature module took the info from the PyCFunction flags for a long time to check if something is a function, method or staticmethod. It turned out that there are functions with multiple signatures where the method/staticmethod info varies in the signatures. This invalidated the PyCFunction flag usage. Instead, we now compute that info directly from abstractmetalang.cpp which has access to the correct info. Fixes: PYSIDE-1328 Change-Id: I6ba7237efcc486de014184b1787d05d87bee5a5e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Signature parser: Adjustments for Qt 6Friedemann Kleint2020-07-071-0/+3
| | | | | | | | | | Change-Id: Ib928ee6b9aab4f1aa4e6007736a0e1f8b4692d76 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-07-071-0/+7
|\| | | | | | | Change-Id: I299a65f15fb6b7eb900256590bbe76ad0568f546
| * Silence some warnings of the signature parserFriedemann Kleint2020-07-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Add mappings for QDeadlineTimer, SocketDescriptor::DescriptorType and QNetworkRequest.TransferTimeoutConstant, fixing: UNRECOGNIZED: 'DescriptorType(-1)' UNRECOGNIZED: 'QDeadlineTimer(QDeadlineTimer.Forever)' UNRECOGNIZED: 'QNetworkRequest.DefaultTransferTimeoutConstant' UNRECOGNIZED: 'DefaultTransferTimeoutConstant' Change-Id: I633153a2cb0b272d76804ea6c10c2526e7ab9514 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Fix QQmlIncubationController::incubateWhile()Friedemann Kleint2020-07-061-0/+1
|/ | | | | | | | | The bool * has been changed into a std::atomic<bool>. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: Ie64668e145e9233760610985dcb86cea68dfb1f3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* signature: Fix and simplify for mypy compatibilityChristian Tismer2020-04-211-47/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a problem with the typing module for Python2 that showed the wrong name. The generated signature files are further simplified. They no longer contain fancy definitions like "Char", which made little sense and was replaced by "int", which our competitor does as well. The mypy compatibility should be considered mostly complete. Update.. QChar was not changed to "int" but "str" because we got clashes. Therefore, recreation of the registry was necessary. Hard to solve stay the definitions "Virtual, Missing, Invalid, Default, Instance". They are very rarely used for special cases. Mypy cannot see these definitions since the module path does not exist in the file system. I tried hard to fix this by building a mypy plugin, but I seem to be forced to generate real files in a temp dir. This was too much effort. A plugin may make sense in the future when we need to improve the type support. Change-Id: Id80c2da1a4a379a80ec5f3019a916a9c00cc87ff Task-number: PYSIDE-1100 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix the registry after QTEST_ENVIRONMENT=ci was restoredChristian Tismer2019-12-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | Since the QTEST_ENVIRONMENT variable was no longer set, a number of crucial checks were not performed. One side effect are the two new keys which were missing in the registry. Additionally, the registry is missing very many entries on macOS, and I have no idea what the reason is. This could be an effect of the macOS 10.15.1 version or of my maybe outdated Qt 5.14.0 version. The registry files from 2019-10-31 have all entries. If I build that version from 2019-10-31 and test it, I get the same missing keys. Therefore, I doubt my results quite a bit! To verify this, we simply check this change in, together with https://codereview.qt-project.org/c/pyside/pyside-setup/+/284809 If that works, then I have a serious bug somewhere, but we know then that the harm of that CI bug was a minimum. Fingers crossed!! Change-Id: I25555d60d6911fca6de67110c35dff8d23c2fd8a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Improve the NumPy Support by iterablesChristian Tismer2019-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Working example, by overriding cppgenerator: >>> from PySide2 import * >>> QtCore.QUrl.fromStringList(("asd", "def")) [PySide2.QtCore.QUrl('asd'), PySide2.QtCore.QUrl('def')] >>> def func(lis): ... for thing in lis: ... yield thing ... >>> QtCore.QUrl.fromStringList(func(["asd", "def"])) [PySide2.QtCore.QUrl('asd'), PySide2.QtCore.QUrl('def')] Also working, by overriding shibokengenerator >>> QtGui.QMatrix4x4(func(range(16))) And all other QMatrix sizes as well: >>> QtGui.QMatrix2x2(func(range(4))) >>> QtGui.QMatrix2x3(func(range(6))) The PySequence cases seem to be quite completely covered. Supporting lists and QVector is not yet clear and needs more research. Note.. QtOpenGLFunctions is not tested at all and nothing works on macOS, segfault. Ignored for now! A simple numpy test shows how versatile this solution is. We now need to improve signatures and error messages to optimize the experience. Task-number: PYSIDE-795 Change-Id: I195cd46cf47c2eb83276fe48fce8e6070cf30fda Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Enable the Function Registry for 5.14 augmentedChristian Tismer2019-09-301-0/+1
| | | | | | | This patch fixes some small quirks and improves the scraping. Change-Id: Ia0366e2e29c833fe985353768de166fd538f0d24 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix Signature after Merging 5.14Christian Tismer2019-09-131-0/+2
| | | | | | | | | | | Somehow, a few changes had diverged and needed fixing. No idea how this could have passed CI - was it deactivated? This checkin also changes the "*.inc" file names to "_inc.h" in favor of one developer's needs. Change-Id: I0687bc2ba542e07da796b9d0eebc0f16210e8387 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Friedemann Kleint2019-09-051-16/+6
|\ | | | | | | Change-Id: I235035ccd510bcb548ffde00244215192d06e600
| * signature: Support typing.Optional[T] and refine a bitChristian Tismer2019-08-291-16/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The signature was missing "typing.Optional[T]" which has to be wrapped around any argument with a default value of "None". This is the only case where the repr of a type looks different than it was written, because it renders as "typing.Union[T, NoneType]". Solving that by redefining a few typing structures was way too hard and too error prone. It was finally solved by a regex replacemet that is run as a post process in generate_pyi.py . The enumerations are now even more complete, since toplevel enums are also included. This had the effect that enums with Python keywords were revealed, and so the function "createEnumItem" had to be modified. The order of creation was also changed to avoid name clashes. The overall structure was improved, and instead of parsing the generated signatures to find out if something is a class method, this is now very cleanly implemented as an inquiry to get_signature(). I tried to make sense of the flags structure that comes with many enums. PyQt5 has a standard set of "__...__" methods without useful signature information. I could mimick that as well, but that would create a whole lot of pointless extra information. We should decide later if it makes sense to include that. Right now the flags structures show the class name, only. This patch will be merged with the 5.14 branch. The additions of this patch could fortunately be placed into areas which do almost not overlap with the 5.14 signature additions. Change-Id: Ie513e15917b04d746ab597fb7a9eb1fd766f7c73 Fixes: PYSIDE-1079 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * Add QtCore.Slot.__signature__ and much more manuallyChristian Tismer2019-08-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The signature of QtCore.Slot and other classes could not automatically be generated because the function is not generated by cppgenerator.cpp . We add it manually in the C++ code into the generation process. The case of QtCore.Slot had diverse follow-up issues to be solved: - Classes which did not inherit from Shiboken were not generated. This is a long-standing omission and creates very many new simple types. - The arity of Slot has default arguments after the varargs parameter "*types". This needed an extended Python parser analysis that fixes the arguments given to the inspect module, accordingly. - The signature generation was completely new implemented and relies no longer on the restricted syntax of a Python (2) function but generates signatures directly as Parameter instances. Implemented classes with hand-made signatures: QtCore.ClassInfo QtCore.MetaFunction, QtCore.MetaSignal QtCore.Property QtCore.Signal QtCore.SignalInstance QtCore.Slot QtQml.ListProperty QtQml.VolatileBool As a side effect, many more subtypes were published. Enums are done, which concludes this work. Fixes: PYSIDE-945 Fixes: PYSIDE-1052 Change-Id: Ic09f02ece3a90325519e42e4e39719beb0c27ae9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Support Pointer Primitive Types by Arrays or Result TuplesChristian Tismer2019-08-071-64/+107
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- This change is part of the improved numpy support -- Most primitive types are handled in XML, but this was not reflected by the signatures, error messages, doc strings and hinting stubs. In order to enhance the information shown to be more correct, the C++ parser part was rewritten for Python. It is written closely to Python syntax, but keeps the existing information about primitive types intact. AbstractMetaType::NativePointerAsArrayPattern is now used to mark a variable as an array. Heuristics are no longer used. If a pointer variable is not marked as an array, the Python parser generates a return value. If more than one value would be returned, a result-tuple is generated. Because we now have a deterministic categorization of types, the "const" attribute is no more needed and the entries in mapping.py are reduced. A few missing <array/> markers were added. The tool also now handles typing.List[] differently in arguments and return types. While return types stay lists, they are for now changed to typing.Sequence[] in argument lists. A test was included. These messages belong to the previous "deprecated functions" patch: Further, QMatrixMxN.constData was removed from the typesystem and replaced by a surrogate function that calls QMatrixMxN.data, but also generates a warning. The long forgotten generate_pyi.py was now published in the same course. Task-number: PYSIDE-795 Task-number: PYSIDE-951 Change-Id: Ia59fe4986919525a70ea7cc453c64cdf46e7fba0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix RuntimeError: dictionary changed size during iterationJulien Schueller2019-07-191-1/+1
| | | | | | | | Seems the dictionary of modules needs to be copied before iterating Fixes https://github.com/spyder-ide/qtpy/issues/195 Change-Id: I8517e031c4a250856d3318b364b1cd5dab3f8f80 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Cleanup signature module before substantial changeChristian Tismer2019-07-171-195/+165
| | | | | | | | | | | | | | | | | | | | | | There were some refinements applied while developing "Support Pointer Primitive Types by Arrays or Result Tuples". This patch moves these changes out which are not essential for that patch. They include - sort all mapping groups by name - replace huge regex by a pattern generator - replace dictionary string entries by SimpleNameSpace - improve PEP 563 handling - simplify "zero(sometype)" substantially - better handling of "QGenericMatrix" (preview) A test for the generated pattern against a reference parser was added. Task-number: PYSIDE-795 Task-number: PYSIDE-951 Change-Id: I5a6b236850c63a7db77b7f7b88881486fd1e61be Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Signature: Try to recognize unknown modules in errorhandler.pyChristian Tismer2019-05-301-52/+42
| | | | | | | | | | | | There were unknown modules built with shiboken which mapping.py did not recognize. This is too restrictive, since we can import this module and try to produce something useful. This was rewritten to respect every binary module in sys.modules . Change-Id: I6626c69f002c307bae3eb78a557d1a7309983324 Fixes: PYSIDE-1009 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Signatures: Add support for PySide2.QtCore.short/ushort/signed charFriedemann Kleint2019-04-161-0/+3
| | | | | | Task-number: PYSIDE-955 Change-Id: I2b4c05281cd44a32257039f62adad89004208b77 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Implement Embedding To Make Signatures Always AvailableChristian Tismer2019-03-201-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Situation.. PySide works fine with normal applications. But when installers are used to pack the application together, then the signature extension cannot be loaded. This is a problem that exists since the signature extension was written. But starting with PySide 5.12.1, the signature extension is very visible, because it is used to support the __doc__ attribute. There have beed successful attempts to solve the problem for PyInstaller and Py2App. But there are more packers available, and they all need a change both in PySide and in the packer. Solution.. To solve this problem once and for all, we embed the Python support files in the binary shiboken package. When the Python files are not normally accessible, they are unpacked from a ZIP file. Details.. - The embedded files shall only be used when the normal files are not available, - The signature extension should no longer be lazily loaded. When the application starts, all files should be present. - We drop support for shiboken2.support.signature and use a single, independen folder 'shibokensupport' (proposal). This avoids problems with multiple existence of the shiboken2 folder. PySide2.support.signature remains the official interface, but it's only an alias when PySide2 exists. - The embedding is used when the normal files cannot be loaded for some reason. It can be enforced by a sys variable "pyside_uses_embedding". - Testcase is included. - Tested with PyInstaller on macOS Fixes: PYSIDE-932 Fixes: PYSIDE-942 Change-Id: Iaa62dc0623503a2e0943eedd10d2b2484c65cc2d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Simplify Python Imports For EmbeddingChristian Tismer2019-03-201-0/+683
| | | | | | | | | | | | | | | | | | | | | | After the project split, shiboken exposed its own modules, and the overall structure with shiboken2.support.signature and PySide2.support.signature was already quite complicated. When introducing embedding, it is necessary to have some support folder that gets unpacked from a zipfile. That means, the shiboken2 root directory would be in the zip file in the embedding case. This does not only increase the complexity, it further means that we must make shiboken2.so available in the shiboken2 containing zipfile! In order to avoid that, we stop the dependency from the two support directories and use shibokensupport, instead. The simplification of the loader and other modules is also significant. Task-number: PYSIDE-510 Change-Id: Ic735a8d36f10f03698378f2ac9685a5955e40b0c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* remove pyside2 and shiboken2 submodules (dev edition)Oswald Buddenhagen2017-05-221-25/+0
| | | | to be replaced by a subtree merge.
* update: bring repositories back in syncChristian Tismer2017-02-151-15/+21
| | | | | | | From time to time, it is good to update the master project. Change-Id: I50c45caf7c37ebb4ea865b4e4f5896e5cd8915fd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Update the pyside-setup submodulesChristian Tismer2016-12-121-15/+15
| | | | | | | | | | From time to time, submodules need to be updated. Actually, I would even like to update the master module after every submodule checkin, but this seems to be not easy to do all the time. Change-Id: I52f266c58086186df05ddcc85085f35e2e28ead7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix OS/X inclusion of framework headers.Alexandru Croitor2016-06-161-6/+16
| | | | | | | | | | | | | | | | | | | | | The recent change that made use of framework headers on OS/X did not work with homebrew Qt, and it didn't work with official builds either, because neither of the chosen include folders contained all the necessary headers to lead to a successful build. Fortunately shiboken actually supports being passed multiple include locations, separated by a colon on OS/X, and a semicolon on Windows. This patch makes sure to always pass the Qt include folder, and in case if the Qt build is a framework build, also passes the root frameworks location, with headers found by shiboken under frameworkName.framewework/Headers. This works for homebrew builds, official builds and custom non-installed prefix / in-source builds of Qt. Change-Id: I47b24e197839883de2ab873461efc1f4d4d33743 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add option to link with libc++ on older OSX versions.Alexandru Croitor2016-05-111-5/+8
| | | | | | | | | | | | | | Versions of OSX lower than 10.9 link libstdc++ by default. Also libstdc++ is linked when the osx minimum deployment target is lower than 10.9. The new option allows explicitly linking libc++ in the cases mentioned above. It is not enabled by default, because most libraries and executables on versions lower than 10.9 are compiled with libstdc++, and mixing standard library versions can lead to crashes. Change-Id: I7397d2bbce2cfceaeb848f25e0bbf1a24ac9bde8 Reviewed-by: Christian Tismer <tismer@stackless.com>
* a quick shiboken fix that should work, but will become obsolete with Qt 5.6.1Christian Tismer2016-04-191-11/+5
|
* fix the name pyside2uicChristian Tismer2016-04-191-5/+11
| | | | This was modified, but not corrected in setup.py
* UpdateThomas-Karl Pietrowski2016-04-021-5/+5
|
* shiboken should build with tests.Christian Tismer2016-02-231-8/+5
| | | | We will see how travis works now.
* updateChristian Tismer2015-12-291-8/+7
|
* updateChristian Tismer2015-12-281-7/+8
|
* fixing debug builds on windows.Christian Tismer2015-11-121-9/+7
| | | | | How on earth did people debug without debug builds? This must have been wrong before the move to Qt5.
* merge the new signal supportChristian Tismer2015-11-071-5/+10
|
* updateChristian Tismer2015-10-241-8/+5
|
* Merge pull request #9 from thopiekar/cmake-workChristian Tismer2015-09-281-7/+7
| | | | Fix for empty PYTHON*_VERSION_* variables
* Merge pull request #8 from thopiekar/cmake-workChristian Tismer2015-09-281-7/+7
| | | | Quick fix for last PR.
* sub-reposChristian Tismer2015-09-281-7/+7
|
* )small fixes (right wiki, name changesChristian Tismer2015-09-251-5/+8
|
* change all scripts to respect the new PySide2 module name.Christian Tismer2015-09-211-9/+5
| | | | still, there seem to be errors....