From 2ef2110e0e17f827273a00f32c579e133ae3b9c2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 22 Jun 2018 13:30:59 +0200 Subject: shiboken/doc generator: Search snippets with to suffix "py" first Replace .cpp by .py and try to find the snippet. Fall back to .cpp. Task-number: PYSIDE-363 Change-Id: I82b23df9894e626c97b44dc5a841f5fa70ae1d57 Reviewed-by: Alexandru Croitor Reviewed-by: Cristian Maureira-Fredes --- sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp index 489d498f9..3ed278871 100644 --- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp +++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp @@ -521,7 +521,13 @@ QString QtXmlToSphinx::readFromLocations(const QStringList &locations, const QSt const QString &identifier, QString *errorMessage) { QString result; - const QString resolvedPath = resolveFile(locations, path); + QString resolvedPath; + if (path.endsWith(QLatin1String(".cpp"))) { + const QString pySnippet = path.left(path.size() - 3) + QLatin1String("py"); + resolvedPath = resolveFile(locations, pySnippet); + } + if (resolvedPath.isEmpty()) + resolvedPath = resolveFile(locations, path); if (resolvedPath.isEmpty()) { QTextStream(errorMessage) << "Could not resolve \"" << path << "\" in \"" << locations.join(QLatin1String("\", \"")); -- cgit v1.2.3