diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-09-21 11:06:52 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-09-21 10:09:14 +0000 |
commit | 4630f179107a2b2548b68b3e7701c16ed2f8d52b (patch) | |
tree | 0fd353223ccc63ced2ebaefc60a478a843cfdc29 /sources/shiboken2/ApiExtractor/typedatabase.cpp | |
parent | b0754eac872e4859db20df5dd2a5ece8b809a92c (diff) |
shiboken: Flip the default behavior the --api-version option
When no option was passed, all type system entries with a "since"
would be silently excluded. For example, the scriptable application
would only see Qt API that does not have a "since" attribute. This
could be fixed by adding version options for all dependent Qt
libraries it uses to the build steps, but this is tedious and
error-prone.
Flip the behavior such that an empty version list specification means
"latest".
Add helper functionality to clear the versions to the TypeDatabase
and use that in the tests to start out with a clean list.
Change the tests to use a QString for the version.
Add a test for the new behavior.
Task-number: PYSIDE-814
Change-Id: Ie6137ba6095ce562813bacbadbf4028d0e2c061f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/typedatabase.cpp')
-rw-r--r-- | sources/shiboken2/ApiExtractor/typedatabase.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.cpp b/sources/shiboken2/ApiExtractor/typedatabase.cpp index 9639e4f67..04eba87ca 100644 --- a/sources/shiboken2/ApiExtractor/typedatabase.cpp +++ b/sources/shiboken2/ApiExtractor/typedatabase.cpp @@ -693,6 +693,11 @@ int getMaxTypeIndex() return maxTypeIndex; } +void TypeDatabase::clearApiVersions() +{ + apiVersions()->clear(); +} + bool TypeDatabase::setApiVersion(const QString& packageWildcardPattern, const QString &version) { const QString packagePattern = wildcardToRegExp(packageWildcardPattern.trimmed()); @@ -714,9 +719,11 @@ bool TypeDatabase::setApiVersion(const QString& packageWildcardPattern, const QS } bool TypeDatabase::checkApiVersion(const QString &package, - const QVersionNumber &versionNumber) const + const QVersionNumber &versionNumber) { const ApiVersions &versions = *apiVersions(); + if (versions.isEmpty()) // Nothing specified: use latest. + return true; for (int i = 0, size = versions.size(); i < size; ++i) { if (versions.at(i).first.match(package).hasMatch()) return versions.at(i).second >= versionNumber; |