From 41ab2d6d795f1b972f5434427e5fa0ae2d7a2bd9 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 3 Nov 2019 19:36:10 +0100 Subject: [PATCH] Enhanced #387 fix with pseudo-features To restrict the requirements to a specific Python, Ruby or Qt major version it's now possible to use "python2", "python3", "ruby1", "ruby2", "qt4" and "qt5" features. Like this: python2 2.7 will require python >=2.7.0, but Python 3 is not allowed. --- src/lay/lay/laySaltManagerDialog.cc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/lay/lay/laySaltManagerDialog.cc b/src/lay/lay/laySaltManagerDialog.cc index 97b1fe750..c17367c6a 100644 --- a/src/lay/lay/laySaltManagerDialog.cc +++ b/src/lay/lay/laySaltManagerDialog.cc @@ -246,16 +246,35 @@ SaltAPIVersionCheck::populate_features () m_features.push_back (APIFeature (std::string (), lay::Version::version (), "KLayout API")); if (rba::RubyInterpreter::instance () && rba::RubyInterpreter::instance ()->available ()) { - m_features.push_back (APIFeature ("ruby", rba::RubyInterpreter::instance ()->version (), "Ruby")); + std::string v = rba::RubyInterpreter::instance ()->version (); + m_features.push_back (APIFeature ("ruby", v, "Ruby")); + if (SaltGrain::compare_versions (v, "2") < 0) { + m_features.push_back (APIFeature ("ruby1", v, "Ruby 1")); + } else if (SaltGrain::compare_versions (v, "3") < 0) { + m_features.push_back (APIFeature ("ruby2", v, "Ruby 2")); + } } if (pya::PythonInterpreter::instance () && pya::PythonInterpreter::instance ()->available ()) { - m_features.push_back (APIFeature ("python", pya::PythonInterpreter::instance ()->version (), "Python")); + std::string v = pya::PythonInterpreter::instance ()->version (); + m_features.push_back (APIFeature ("python", v, "Python")); + if (SaltGrain::compare_versions (v, "3") < 0) { + m_features.push_back (APIFeature ("python2", v, "Python 2")); + } else if (SaltGrain::compare_versions (v, "4") < 0) { + m_features.push_back (APIFeature ("python3", v, "Python 3")); + } } #if defined(HAVE_QTBINDINGS) m_features.push_back (APIFeature ("qt_binding", std::string (), "Qt Binding for RBA or PYA")); #endif +#if defined(HAVE_QT) +# if QT_VERSION >= 0x040000 && QT_VERSION < 0x050000 + m_features.push_back (APIFeature ("qt4", std::string (), "Qt 4")); +# elif QT_VERSION >= 0x050000 && QT_VERSION < 0x060000 + m_features.push_back (APIFeature ("qt5", std::string (), "Qt 5")); +# endif +#endif #if defined(HAVE_64BIT_COORD) m_features.push_back (APIFeature ("wide-coords", std::string (), "64 bit coordinates"));