| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
enum_sig.py is used to generate .pyi files (in
sources/pyside2/PySide2/support/generate_pyi.py) from the bindings.
The file can also be useful by external modules that were generated by
shiboken, however the check for the modulename being PySide2 or
shiboken2 prevents this.
Remove this check, as discussed on IRC. This seems to be working
internally as well and re-adds support for usages by external modules.
Change-Id: I81af943c43f8f84aa0b0d89260cd99215acdb10d
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
| |
- Do not try to resolve modified default expressions (add enumeration
scopes or similar)
- Fix the signature parser to handle arbitrary expressions
Fixes: PYSIDE-1095
Change-Id: I059c3a1f066687d7c2f0dad9ea7f0d93e292b1b5
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
First step of this process that only considers the idea of
encapsulate the diffrent CMake processes we currently have in all
our main CMakeLists.txt files.
This patch simply takes some sections of the existing cmake files
and move them to a macro file.
Additionally, a couple of macros were written twice in shiboken
and pyside, so now they are only once.
Task-number: PYSIDE-1033
Change-Id: I2c63d8a2eba3d8951097ec9c9042c782fde5dd62
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The typing module has problems if it exists twice.
This gave trouble with matplotlib, when typing was imported
and then called PySide indirectly.
The only reliable cure appears to be to use the typing
module if it is already in sys.modules .
The typing27 modue was updated to the latest version
of https://github.com/python/typing (original file with
additional license headers).
Fixes: PYSIDE-1073
Change-Id: Iebfdfe7fd51080a9334db332719928c001501381
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use target_* commands instead of subdirectory based commands
for adding link options, compile definitions, include directories,
etc.
Remove some non-used compile definitions.
Move around some of the find_package() and option() calls.
Simplify some of the package dependent logic.
Replace the qt include and linking variables with CMake targets.
Change-Id: I815595344e63a32dce3dc78652359beede3ff593
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The signature module used to use large strings with the signatures
of all functions in a class. This can lead to an overflow in MSVC,
because the maximum string length funnily still is 32K unicode
characters.
This patch solves that by using a single string per function.
Instead of a huge string, a list of strings is passed to each class.
To prevent any runtime increase, the string list creation is deferred
until the actual usage. At initialization time only a ssize_t holding
the structure address is passed.
As a result, the signature module should be even slightly faster.
Task-number: PYSIDE-955
Change-Id: I99faf942a3cca03456928b8aec5e8a4b9924b8b2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
| |
Task-number: PYSIDE-955
Change-Id: I2b4c05281cd44a32257039f62adad89004208b77
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
| |
Task-number: PYSIDE-510
Change-Id: I73c441b56a19a0ac836e3598ff6fc8c9ba4d1cd2
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A simple hello.py script was modified for running in
PyInstaller and stopping to execute after 2 seconds.
The reason is to test that PyInstaller works correctly
together with the embedded mode of the signature
extension on all platforms.
The script did first not work on Windows. This is now
solved, after an import in pyside2_config.py is fixed.
Currently, there are several configuration errors in COIN.
Errors are therefore skipped in the PyInstaller build.
The test tests only if the generated script works.
Change-Id: I7a1b1e738d523b83cc3fe5beafa7e2579f9c7f48
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While developing the embedding for installer support, some functionality
was moved from loader.py to signature_bootstrap.py, especially a "with"
statement, that needed a contextlib import.
When using PyInstaller or cxFreeze, this gave a problem when running
in virtualenv and Python 2. We extended the pre-loading to contextlib.
It is not completely clear why Python 2 needs that and Python 3 doesn't.
The problem did not show up without virtualenv. Perhaps some different
installed packages have hidden that problem, because they loaded the
contextlib, themselves. This does not happen with a freshly installed
virtual environment.
Change-Id: I2188cb67129e596f6492d0f5dc9b303a67bfe870
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
After the bug found in PYSIDE-928, the contextlib problem of
Python 3.5 also vanished.
What remains is the crash on shutdown which is caused by
module 'testbinding'.
Task-number: PYSIDE-953
Change-Id: I07f18fa468fdb0758ee4e4b7663c3a42bec42822
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Python 3.5 has a bug that crashes the build.
See the description in the issue tracker.
The cure is to use a more recent contextlib.py and to avoid
a PySide cleanup function that creates the crash.
The problem is not solved for Python 3.5, and it is not clear
if the testbinding module has a hidden bug, too.
But this fix seems to be good enough for the moment.
We should decide if we are going to fix Python 3.5 or abandon
it altogether.
Change-Id: Iacf2237de1f34d2b3cd1d68f1fb5833bdca3fdc2
Fixes: PYSIDE-953
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Attempts to load the module directly from Python if loading it manually from
the .py file fails. This exposes the support submodule to installers. The
loader.py module was also patched to allow direct import from installers.
Change-Id: If225ae7a2e916912a581e09d1a02c18fd3a17526
Fixes: PYSIDE-942
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a CMake super project that includes the shiboken2, PySide2 and
pyside2-tools subprojects, so that it's possible to build everything
from Qt Creator (or any other IDE that supports CMake)
with minimal set up effort, and thus inform the IDE CMake integration
of all relevant files, for easier code editing, navigation and
refactoring.
This also lays the foundation for allowing 3rd parties to use the
shiboken2 generator to generate custom modules. This is
achieved by eliminating various hardcoded paths for libraries and
include directories.
Start using CMake targets throughout the build code to correctly
propagate link flags and include dirs for libshiboken and
shiboken2 executable targets. Same for the libpyside target.
Generate two separate cmake config files (build-tree / install-tree)
that can be used with find_package(Shiboken2), to make sure that
the PySide2 project can be built as part of the super project build.
This is currently the only way I've found to allow the super build
to work.
Note that for the build-tree find_package() to work, the
CMAKE_MODULE_PATH has to be adjusted in the super project file.
The generated config files contain variables and logic that allow
usage of the installed shiboken package in downstream projects
(PySide2). This involves things like getting the includes and
libraries for the currently found python interpreter, the shiboken
build type (release or debug), was shiboken built with limited
api support, etc.
Generate 2 separate (build-tree and install-tree) config files
for PySide2, similar to how it's done for the shiboken case, for
pyside2-tools to build correctly.
Install shiboken2 target files using install(EXPORT)
to allow building PySide2 with an installed Shiboken2 package
(as opposed to one that is built as part of the super project).
Same with PySide2 targets for pyside2-tools subproject.
Make sure not to redefine uninstall targets if they are already
defined.
Add a --shorter-paths setup.py option, which would be used by
the Windows CI, to circumvent creating paths that are too long,
and thus avoiding build issues.
Output the build characteristics / classifiers into the generated
build_history/YYYY-MM-DD_AAAAAA/build_dir.txt file, so it can be
used by the test runner to properly filter out blacklisted
tests. This was necessary due to the shorter paths options.
Fix various issues regarding target includes and library
dependencies.
Remove certain duplicated cmake code (like limited api check and build
type checks) in PySide2, given that that information will now be
present in the exported shiboken2 config file.
Include a short README.cmake.md file that describes how to build
the super project.
References used
https://rix0r.nl/blog/2015/08/13/cmake-guide/
https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/
https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1
https://cliutils.gitlab.io/modern-cmake/chapters/basics/functions.html
https://cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html
https://github.com/ComicSansMS/libstratcom/blob/master/CMakeLists.txt
Abandoned approach using ExternalProject references:
https://cmake.org/cmake/help/latest/module/ExternalProject.html
https://stackoverflow.com/questions/44990964/how-to-perform-cmakefind-package-at-build-stage-only
Fixes: PYSIDE-919
Change-Id: Iaa15d20b279a04c5e16ce2795d03f912bc44a389
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The correction to container types has a small bug which
does not exist in reality, but could give a problem in the
future:
- We need not only avoid instantiation in Missing, but
generally in all _NotCalled classes. Otherwise, when called
during processing of container types, they would loose
their (Missing, Default, ...whatever) tag.
Change-Id: I4eb154100da6f3067b816c190af314b2a710ff39
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An error was reported that we had a bug in this .pyi line:
def parseErrors(self) -> PySide2.QtScxml.QScxmlError: ...
which actually had to be a list like
def parseErrors(self) -> typing.List[PySide2.QtScxml.QScxmlError]: ...
A deeper look revealed that we had very many other examples,
also in the argument lists, were we did not handle containers
properly. (For example, 90 times in QtCore!)
This is a leftover from the type error messages which
were generated in C++, and never really understood.
This is now a clean rewrite of the C++ part to expose all
information and an extension of the Python parser that
systematically uses the container types from the typing
module.
The implementation became a bit more complex because of
Python 2: We need to provide our own copy of the public
typing module, because it is not safe to assume that this module
can be loaded. Importing it from support.signature gave a
problem because we now need to find the names of instances
to produce List[...], which needed to be implemented in the
loader.
Implemented the "Pair" type now as a native generic type.
This is more correct than the former implementation and
shorter in the .pyi files.
Additionally, an own definition of "Char" was provided for
brevity. This was not important to implement and could also
be done with "int", but it is helpful for the future to know how
to implement own types (and it was fun).
Task-number: PYSIDE-921
Task-number: PYSIDE-795
Change-Id: I0e565b38d7b4fff39dd606950f9f8d97c45acbf5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The signature module will be used to generate automated
documentation by using the function signatures as docstrings.
This functionality should be low-hanging fruit. Actually, it was a
bit tricky to get this working. The crucial point was to use
PyType_Modified().
The function works fine on methods.
Supporting types needs some more effort.
It is not clear why the __signature__ attribute can be added,
but the change to __doc__ is not recognized. May be related to
the absence of Py_TPFLAGS_HAVE_VERSION_TAG ?
This will be addressed another time.
Task-number: PYSIDE-908
Change-Id: If8faa87927899f4c072d42b91eafd8f7658c6abc
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The TypeError messages can now be produced, based upon the
signature module.
As a feature under test, we produce ValueErrors instead in
certain cases. This will probably improve, later.
We are currently investigating how much can be determined,
automatically.
Task-number: PYSIDE-795
Change-Id: Ie8a648beaf8a3bed388e3c01ba501bb36859722e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When building type hints during the PySide build, it can happen that
the QtMultimedia module already exists, but the QtMultimediaWidgets
module is not yet built.
Since during the build also directories exist alongside with the not yet
existing modules, it can happen that such a directory is picked up by
Python 3, which supports namespace modules without __init__.py .
This case was already handled by the mapping modules, but
QtMultimediaWidgets was directly imported and not checked.
Now the check code has been extracted from the mapping reloader,
and there is no more unchecked module left.
Task-number: PYSIDE-735
Change-Id: I1a1f53525417651005d0759e417082fe71b02773
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The signature module has been quite far developed.
In the course of making things fit for the TypeErrors with
the signature module, now also all signatures from all
shiboken modules are queried.
Instead of writing an extra signature existence test for
shiboken, it made more sense to extend the existing
init_platform.py by the shiboken modules.
In fact, by this query a corner case was exploited that
worked on Python 2 but assertion-crashed on Python 3.
The mapping.py modules were also completed to support
all new PySide2 modules.
Special care had to be taken because the "shiboken2" module
exists both as directory and as binary module. The fix was
tricky, and I will add a task that replaces such workarounds
by a better design.
Task-number: PYSIDE-510
Change-Id: Ibf8e322d1905976a0044a702ea178b7f98629fb4
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The script is now automatically called in the cmake build,
as part of the create_pyside_module macro.
The script runs after every module build and tries to
generate .pyi files. This does not need to succeed, but
will generate all files in the end. The script has been prepared
to allow partial runs without overhead.
After integration of the .pyi generation into cmake, these files
are also installed into the install directory by cmake.
For wheel building, setup.py has entries, too.
Building a full project with all modules revealed a bug in the
signature module that allowed unsupported function objects.
Module enum_sig had to be changed to suppress types
which have no ancestry in shiboken.
PYTHONPATH was avoided because it was not Windows
compatible. Instead, the script was changed to accept
"--sys-path" and "--lib-path" parameters. The latter evaluates
either to PATH or LD_LIBRARY_PATH.
The necessity to create .pyi files while the project is in the
build process showed a hard to track down error condition
in PySide_BuildSignatureProps.
Simple logging was added as a start of introducing logging
everywhere.
Task-number: PYSIDE-735
Change-Id: I6b3eec4b823d026583e902023badedeb06fe0961
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implementation formats all signatures in a way
that is known as type hinting files (.pyi).
Usage
-----
The script is to be called by the same Python interpreter that
was used to build PySide. It works with Python 2 and 3.
On Python 3, it performs a self-test.
python3 sources/pyside2/PySide2/support/generate_pyi.py run
will generate .pyi files for all compiled PySide modules
and places them into site packages to the binaries.
An optional outpath can be specified.
It is planned to call this script automatically after install.
o Local constants are not included, yet.
Maybe they never will, unless requested.
o The keyword "from" appears 43 times in argument lists.
It is fixed in Python, only which does not matter.
o When using Python 3.7 or above, it respects Pep 563 and
avoids imports which are deferred to runtime.
Task-number: PYSIDE-735
Change-Id: I3bcd5d9284b853fe955376bf35c7897e3698da2b
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The PySide project has been split into three pieces, including
Shiboken. This had far-reaching consequences for the signature project.
Shiboken can be run together with PySide or alone,
with tests or without. In every configuration, the signature
module has to work correctly.
During tests, the shiboken binary also hides the shiboken module,
and we had to use extra efforts to always guarantee the accessibility
of all signature modules.
This commit is the preparation for typeerrors implemented with the
signature module. It has been split off because the splitting
is not directly related, besides these unawaited consequences.
I re-added and corrected voidptr_test and simplified the calls.
Remark.. We should rename shiboken to Shiboken in all imports.
I also simplified initialization. After "from PySide2 import QtCore",
now a simple access like "type.__signature__" triggers initialization.
Further, I removed all traces of "signature_loader" and allowed
loading everything from PySide2.support.signature, again. The
loader is now needed internally, only.
Also, moved the type patching into FinishSignatureInitialization
to support modules with no classes at all.
The "testbinding" problem was finally identified as a name clash
when the same function is also a signal. A further investigation
showed that there exists also a regular PySide method with
that problem. The test was extended to all methods, and it
maps now all these cases to "{name}.overload".
Updated the included typing27.py from https://pypi.org/project/typing/
from version 3.6.2 to version 3.6.6 .
Task-number: PYSIDE-749
Change-Id: Ie33b8c6b0df5640212f8991539088593a041a05c
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously whenever a typesystem XML file changed, this resulted in a
full rebuild of all cpp files generated for that particular module.
This change shifts the rules of building in such a way, that files
are rebuilt only if their content has changed.
XML modifications should generally not cause full
rebuilds anymore, unless the change is in a global header.
This is achieved in the following way, assuming a binding library
"foo" added by add_library(foo ...):
1) CMake calls shiboken via add_custom_command.
2) The OUTPUT file for the command is the generated
mjb_rejected_classes.log file, which serves as a timestamp
for when shiboken was last run.
3) All the generated cpp files are marked as "Generated" via the
add_custom_command BYPRODUCTS option. This allows the files
to have an older timestamp than that of an XML file, thus not
forcing constant shiboken re-execution.
4) A new custom target foo_generator is added via add_custom_target.
5) This target has a dependency on the mjb_rejected_classes.log file,
and the target itself is added as a dependency to the "foo" target.
6) Whenever "foo" is built, it will first try to build "foo_generator"
which will force the shiboken custom command to be run, which will
generate the cpp files and mjb_rejected_classes.txt file.
The BYPRODUCT cpp files can then be used as sources in the
"foo" target.
7) If a user modifies the XML file listed in the add_custom_command
DEPENDS option, this will re-trigger shiboken execution, which
will create a new mjb_rejected_classes.log file, which means that
the "foo" target might be rebuilt if, and only if, any of the cpp
file timestamps are new. Otherwise "foo" doesn't need to be
rebuilt.
Change-Id: I9a3844a2fa775106288acc01cb4570a903e16991
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Actually this creates 3 wheel packages:
- shiboken2 (the python module and libshiboken shared library)
- shiboken2-generator (contains the generator executable, libclang and
dependent Qt libraries)
- PySide2 (the PySide2 modules and Qt shared libraries, and tools like
rcc, uic)
Calling the setup.py script will not do the actual build now (in the
sense of calling CMake, make, etc.). Instead it will spawn new
processes (via subprocess.call) calling the same setup.py script,
but with different arguments. These "sub-invocations" will do the
actual building. Thus, the "top-level invocation" will decide which
packages to build and delegate that to the "sub-invocations" of
setup.py.
A new optional command line argument is introduced called
"--build-type" which defaults to "all", and can also be set to
"shiboken2", "shiboken2-generator" and "pyside2". A user can choose
which packages to build using this option. The "top-level invocation"
uses this option to decide how many "sub-invocations" to execute.
A new command line argument called "--internal-build-type"
takes the same values as the one above. It defines which package
will actually be built in the new spawned "sub-invocation" process.
The "top-level invocation" sets this automatically for each
"sub-invocation" depending on the value of "--build-type".
This option is also useful for developers that may want to debug the
python building code in the "sub-invocation".
Developers can set this manually via the command line, and
thus avoid the process spawning indirection.
A new class Config is introduced to facilitate storage of
the various state needed for building a single package.
A new class SetupRunner is introduced that takes care of the
"--build-type" and "--internal-build-type" argument handling
and delegation of "sub-invocations".
A new class Options is introduced to 'hopefully', in the future, streamline
the mess of option handling that we currently have.
setup.py now is now simplified to mostly just call
SetupRunner.run_setup().
Certain refactorings were done to facilitate further clean-up of the
build code, the current code is definitely not the end all be all.
Various other changes that were needed to implement the wheel
separation:
- a new cmake_helpers directory is added to share common cmake
code between packages.
- the custom popenasync.py file is removed in favor of using
subprocess.call in as many places as possible, and thus
avoid 10 different functions for process creation.
- Manifest.in is removed, because copying to the setuptools
build dir is now done directly by prepare_packages functions.
- because prepare_packages copies directly to the setuptools
build dir, avoiding the pyside_package dir, we do less copying
of big Qt files now.
- versioning of PySide2 and shiboken2 packages is now separate.
shiboken2 and shiboken2-generator share the same versions for
now though.
- shiboken2 is now listed as a required package for PySide2, to
facilitate pip requirements.txt dependencies.
- coin_build_instructions currently needs to install an unreleased
version of wheel, due to a bug that breaks installation of
generated wheel files.
- added separate command line options to pyside2_config.py for
shiboken2-module and shiboken2-generator.
- adapted samplebinding and scriptableapplication projects due to
shiboken being a separate package.
- adapted pyside2-tool and shiboken2-tool python scripts for setup
tools entry points.
- made some optimizations not to invoke cmake for shiboken2-generator
when doing a top-level "all" build.
- fixed unnecessary rpaths not to be included on Linux (mainly the
Qt rpaths).
Task-nubmer: PYSIDE-749
Change-Id: I0336043955624c1d12ed254802c442608cced5fb
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change introduces a new type into the shiboken2 module which is
imported by calling "import PySide2.support.VoidPtr".
The type takes care of conversions from / to void* values in function
signatures.
Creating an instance can be done by passing either a shiboken wrapped
object, or an integer representing an address, or a python object that
implements the buffer interface.
For example, this is useful for passing numpy arrays to C OpenGL
functions that take void* parameters. First you convert the array into
a bytestring (using numpy.array.tobytes(), then you instantiate a
VoidPtr from that bytestring, and finally you pass it along to a GL
function.
One corner case that is currently not supported is void** parameters.
Change-Id: I01e291d6856cb6bd8b5175adc3ead6b728036535
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use the same imp.get_suffixes() mechanism as on Unix, to determine
the suffix part of module extension files.
This fixes debug builds to work on Windows.
Note that the whole build stack has to use the same configuration,
no mixing is allowed on Windows.
For release build you need: python.exe + setup.py without --debug
flag + release build of Qt5.
For debug build you need: python_d.exe + setup.py with --debug
flag + debug build of Qt5.
Change-Id: I6188c859b5757d11e87d6a9e32b9ba558f7f609e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change decouples the naming of general shared libraries, python
module extensions, and cmake configuration files. All of them are now
computed depending on the python version and python build
configuration, and can also be manually set via CMake variables.
The module extensions names now use the most detailed 'import' prefix,
which usually informs whether a debug or release python was used, or
the Python ABI flags (for Python >= 3.2).
When a debug Python interpreter is used for building PySide2, the
preprocessor define Py_Debug is now correctly propagated to PySide2
sources, which fixes previous crashes in debug builds.
This affects only Linux and macOS builds. There is a subsequent change
for making it work for Windows builds.
All in all, this now allows proper mixing of debug / release versions
of the Python interpreter with debug / release versions of PySide2 on
Linux and macOS.
Task-number: PYSIDE-508
Change-Id: I88a05c3ada0fb32c7c29bdb86d7a2c15acc963b8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
in preparation for a subtree merge.
this should not be necessary to do in a separate commit, but git is a
tad stupid about following history correctly without it.
|