aboutsummaryrefslogtreecommitdiffstats
path: root/tools/snippets_translate
Commit message (Collapse)AuthorAgeFilesLines
...
* snippets_translate: Enable all modulesFriedemann Kleint2021-11-292-12/+25
| | | | | | | | | | | | | Fix a fixme commment. To make this pass, make the conditions matches more strict and add some warnings and error handling. Remove the checking of stderr from the CMake statement as this will produce some warnings. Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: I8aeefa8355144d98524a622733d82d337cd3c23b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* snippets_translate: Fix broken loggingFriedemann Kleint2021-11-271-1/+1
| | | | | | | | | Amends 742a39962f1ba9c0e42f387394768c13793144c0 Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: Ib1cbfd99a7a96e902df4f273c0b997e694a6a7a9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* snippets_translate: Handle header files as wellFriedemann Kleint2021-11-271-7/+4
| | | | | | | | | Use suffix .h.py for them to distinguish them from .cpp files. Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: Iea4bfa770833f319b65c1ea7f83fb1a325ce8c62 Reviewed-by: Christian Tismer <tismer@stackless.com>
* snippets_translate: Streamline writing filesFriedemann Kleint2021-11-271-12/+12
| | | | | | | | | | | | | | The code created all example directories first and extracted the snippets to .cpp files which were later moved to .py files to overwrite the snippets in the repository (back then). Write to the Python file directly and create the directory only when needed. This removes a lot of empty directories. Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: I38e695db4aae386be18cd3b85708f684bfa228d5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* snippets_translate: Fix example pathFriedemann Kleint2021-11-271-1/+1
| | | | | | | | | Remove superfluous doc/codesnippets element. Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: Iff81bf9b3dc7a26d3f9c8924a450508ccbdb1dd4 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* snippets_translate: Fix parsing of overlapping snippetsFriedemann Kleint2021-11-261-41/+42
| | | | | | | | | | | Change get_snippets() to return a flat list of all snippets. It internally uses a list of active snippet ids to decide whether a line should be included. Pick-to: 6.2 Task-number: PYSIDE-1721 Change-Id: Ifaa313a7aaa36dd125767b8b0c50a25db637c0ed Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Purge remaining app.exec_()Friedemann Kleint2021-05-171-1/+1
| | | | | | | | Add a porting note. Pick-to: 6.1 Change-Id: I4ccb1dc2a3a5925e55e94e7f3d23b1fb199afe4a Reviewed-by: Christian Tismer <tismer@stackless.com>
* doc: snippets_translate make quiet mode by defaultCristian Maureira-Fredes2021-04-281-23/+24
| | | | | | | | | | | | | | | | | Without being 'quiet' the script was generating output to the stdout and stderr, which was triggering the cmake instruction to make the build fail This change makes the quiet mode by default, the old output that summarize each snippet file can be obtained by using the '--verbose' option. A new option called '--debug' was introduced to get even more output related to each translation happening per file. Pick-to: 6.0.4 Change-Id: I7fce09f0b60e626c957efc4fe24948e0eaf3db74 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* doc: fatal error when snippet conversion failsCristian Maureira-Fredes2021-04-263-7/+1553
| | | | | | | | | | | | | | | | | | | | | | When the snippets_translate tool fails, the build process continues normally, falling back to use the original C++ snippets. This problem can be dangerous, since we will not notice if something is wrong without checking the full log. This patch make the build process to fail when the tool doesn't exit normally. For builds where the documentation generation is skipped, this change will have no effect. Complementary to this, the patch includes a new Python file to determine if the C++ include have an import counterpart in Python. Fixes: PYSIDE-1527 Pick-to: 6.0.4 Change-Id: I725b623f60dbc540a6e7834502300c39cd22b5a3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* snippets_translate: Do not crash on multi-line emit statementsFriedemann Kleint2021-04-161-1/+8
| | | | | | | | | | | qtbase/0e69349f6f8e9445877ea5b2105973115ad79cf7 introduced a multi-line emit statement, causing snippets_translate to fail. Add a warning message which then shows: snippets_translate: Warning "emit renderedImage(result, resultSize," does not match function call Change-Id: Id27770eab1e60d7828e7d742e63d1de2d530ad02 Reviewed-by: Christian Tismer <tismer@stackless.com>
* doc: snippet translate add missing quiet caseCristian Maureira-Fredes2021-03-261-1/+2
| | | | | | Pick-to: 6.0 Change-Id: I6d3520e9544d7d169a9c933a8aa904747bc7c6c4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* doc: enable snippets translate toolCristian Maureira-Fredes2021-03-251-26/+53
| | | | | | | | | | | | | | | | Create snippets directories in case they don't exist. Add "-q" option as the examples directory to keep the "--quiet" option from the build. Something to consider with this patch: Removing all the previous old snippets, which include not only 'cpp' files, but also '.h', '.qdoc', '.qrc', '.png', and '.qml', which might be used in the snippets, but will need to be updated in the generation tool, to not translate, and copy them over. Pick-to: 6.0 Change-Id: Icbef9e1c93a12b90dbcfa990ef055ca6f8868407 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Long live snippets_translate!Cristian Maureira-Fredes2021-03-188-0/+2031
This is not a C++ -> Python translator, but a line-by-line conversion tool. This scripts requires two arguments to identify a Qt and PySide directory including the sources. There is a set of file extensions that are currently omitted from the process, and for the ones that will be copied, there will be messages related if the file already exists or if it's new. If you use the '-v' option, you will see the C++ code and the converted Python code, so it's easy to check for issues and missing features. Also, two command line options were added to have a different behavior '--filter' to include a word to filter the full paths of all the snippets found (for example the name of a directory), and '-s/--single' to translate only a specific C++ file to be translated. Including test cases for transformations related to the C++ snippets. Fixes: PYSIDE-691 Pick-to: 6.0 Change-Id: I208e3a9139c7e84fe369a7c2ea93af240d83fa83 Reviewed-by: Christian Tismer <tismer@stackless.com>