summaryrefslogtreecommitdiff
path: root/dev-util/kdevelop-python
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-06-14 00:09:04 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-06-14 00:09:04 +0100
commit5e41a38157bb40e8513e8e34426e85faba672fe7 (patch)
tree38e9365afd56c161d0e970ddf5420b2585130587 /dev-util/kdevelop-python
parent0ebcd2cbf178600b5eb36b2f24cdbb3d2f4a9000 (diff)
gentoo auto-resync : 14:06:2024 - 00:09:04
Diffstat (limited to 'dev-util/kdevelop-python')
-rw-r--r--dev-util/kdevelop-python/Manifest5
-rw-r--r--dev-util/kdevelop-python/files/kdevelop-python-24.05.1-python3.12.patch190
-rw-r--r--dev-util/kdevelop-python/kdevelop-python-24.05.1.ebuild (renamed from dev-util/kdevelop-python/kdevelop-python-24.05.0.ebuild)4
3 files changed, 196 insertions, 3 deletions
diff --git a/dev-util/kdevelop-python/Manifest b/dev-util/kdevelop-python/Manifest
index 92d5edf7435c..837ec5e7a5b5 100644
--- a/dev-util/kdevelop-python/Manifest
+++ b/dev-util/kdevelop-python/Manifest
@@ -1,5 +1,6 @@
+AUX kdevelop-python-24.05.1-python3.12.patch 6101 BLAKE2B decbd9f26f3c44bb2f6b81ff511f737a217fa7946cd3b72b2c13c6c5b06fee3e7a9ad14edc9dff858f04eed17de57d8297172c55ffee5fc826189c3e0b320051 SHA512 311966d24e3d5a73c79372abd30a261ba8a78dedec3cb4c9990264bdd6cce7bb8737f2ec687e683534317315137f5a1fe0df29fcf9f75c38a5d86971295d56ae
DIST kdev-python-24.02.2.tar.xz 1098808 BLAKE2B 3019ef98788699eb9c5b3168656f73cfcd29c54134ca6d23831d70dd318e4b0dee89e7f0e6d4e81b9f446ee5ff92a84f660e117724a7a8b7f1ee3190f4674cfb SHA512 d5b86ce08f7a8ca79bd7f0b65ac1832677b4f0dbb8f2abe3ec7fbcca5a73334a5119c66ab94a22747802312cf717dd99b622243c1c18c55dcbafadba2e33e420
-DIST kdev-python-24.05.0.tar.xz 1098444 BLAKE2B 9941154df5cd5222a3a56d00f249f9fb0c233a5ef10dc280860670e315d4456246bf63e00bb1238c897c8db4a482caffbaabe4b421cd0572691dee635869f911 SHA512 9cf131c0c385882db9177dc3ed4800f3332e8071276cc18c057a4ff0f03128f112765a824bac19b4ca74ccdb40a84676c7c12924096cfd1dab16e0e80ce949ad
+DIST kdev-python-24.05.1.tar.xz 1098416 BLAKE2B c43c92f0606661d2fe2bd05a43f155a90ce40bb42d494cfd3c9ae3a0ff5a4d636440645f88fd5798b7b96454089ef9611dfa22851bd43ad1d85986ce46f077fd SHA512 e35ee5618e746fabe14e62185eb3d19fa7cb54e9cbe8fc8ec9fb1fa0fd938c984a9573408e0bc9993bd04b66ba5bd3274ddbb722835dff760d4626e42c30612e
EBUILD kdevelop-python-24.02.2.ebuild 1234 BLAKE2B e43185c4c349afde189d93ebd7214e4fd0b4e7fcfa30060f117e081d74e9d682b599e72ae347ac489a9c3673aff5eeaa121fc1ba59d281f70751c9935b35f188 SHA512 4e304b7a8fd00ffd9e714cd27707427a3ca3ceaf605ac649104c725da17dc686e22aaf55663bafca20be9b9d917d0600d41ba7e6216ab583127213cc09606de5
-EBUILD kdevelop-python-24.05.0.ebuild 1236 BLAKE2B 62b7504b3219861f88df8c198d670d001ecc15cae0c01b09ea9c3f0cf42920b53b5e32730d2877e097cfec17c44f0431e65d19bd9748ab38e6cb452070101635 SHA512 b242a40c2fa3401b4eed0bde3c099e650f25f6f7aec85dbb16f892449a58b2ca95a5c5b95513b74896e9ca5de72be851657fa69435ee203a45190d128fdfdb9b
+EBUILD kdevelop-python-24.05.1.ebuild 1298 BLAKE2B 5224fa364cb67d9fa752a9b2786d46ddbfb6e8cbb8300ad9b6616d3a22ec2d3674c00c0ede95e1de2eec772ecbad495d9575a91cb889e206aa202509553da5a0 SHA512 1e092e9d377aca2989b6a1e96ef3d81bfd501a288eda02eb08d578529b6826434f3119e74cc15a795ea1138e8f946412b91f577bc94df7192d6221da3282a500
MISC metadata.xml 318 BLAKE2B 922a5e32e706b2976c5f359a14194d268d3f499398576c80ce5fad8c0fcea0fbf048de4480a80a6a1889c88b8b6c14147654a3ab4d5ffbcc258c2290da63f6d1 SHA512 614cb8dda7ad2088e5d6ef39b449bb4be0ac72cd0231c320188d76d1816dce6490c5114bb4798112c4b11d99d30a9e82ff8fcf08ffa8c049589682a5e38208f6
diff --git a/dev-util/kdevelop-python/files/kdevelop-python-24.05.1-python3.12.patch b/dev-util/kdevelop-python/files/kdevelop-python-24.05.1-python3.12.patch
new file mode 100644
index 000000000000..00507fc0de7e
--- /dev/null
+++ b/dev-util/kdevelop-python/files/kdevelop-python-24.05.1-python3.12.patch
@@ -0,0 +1,190 @@
+From 26ee370982e7cd7795921e9533b61a5a89d11b6a Mon Sep 17 00:00:00 2001
+From: Bernd Buschinski <b.buschinski@googlemail.com>
+Date: Sat, 8 Jun 2024 16:50:47 +0200
+Subject: [PATCH] initial support for python 3.12
+
+---
+ CMakeLists.txt | 2 +-
+ duchain/tests/pyduchaintest.cpp | 5 +++++
+ parser/ast.cpp | 3 +++
+ parser/ast.h | 6 ++++++
+ parser/astbuilder.cpp | 15 +++++++++++++--
+ parser/asttransformer.cpp | 6 ++++++
+ parser/astvisitor.cpp | 1 +
+ parser/python_grammar.h | 15 +++++++++++++++
+ 8 files changed, 50 insertions(+), 3 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9fba20c3..29b83950 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -43,7 +43,7 @@ add_definitions( -DTRANSLATION_DOMAIN=\"kdevpython\" )
+
+ set(Python3_USE_STATIC_LIBS FALSE)
+ set(Python3_FIND_STRATEGY VERSION)
+-find_package(Python3 3.4.3...<3.12 COMPONENTS Interpreter Development REQUIRED)
++find_package(Python3 3.4.3...<3.13 COMPONENTS Interpreter Development REQUIRED)
+
+ configure_file(kdevpythonversion.h.cmake "${CMAKE_CURRENT_BINARY_DIR}/kdevpythonversion.h" @ONLY)
+
+diff --git a/duchain/tests/pyduchaintest.cpp b/duchain/tests/pyduchaintest.cpp
+index b0711fd0..8a4a75e4 100644
+--- a/duchain/tests/pyduchaintest.cpp
++++ b/duchain/tests/pyduchaintest.cpp
+@@ -439,6 +439,11 @@ void PyDUChainTest::testCrashes_data() {
+ #if PYTHON_VERSION >= QT_VERSION_CHECK(3, 11, 0)
+ QTest::newRow("except_star") << "try: pass\nexcept* (IndexError, ValueError): pass";
+ #endif
++#if PYTHON_VERSION >= QT_VERSION_CHECK(3, 12, 0)
++ QTest::newRow("type_alias") << "type Point = tuple[float, float]";
++ QTest::newRow("generic_function") << "def func[T](arg: T): pass";
++ QTest::newRow("generic_class") << "class Bag[T]: pass";
++#endif
+ }
+
+ void PyDUChainTest::testClassVariables()
+diff --git a/parser/ast.cpp b/parser/ast.cpp
+index a63ac231..4a371b10 100644
+--- a/parser/ast.cpp
++++ b/parser/ast.cpp
+@@ -765,6 +765,9 @@ QString TryAst::dump() const
+ return r;
+ }
+
++TypeAliasAst::TypeAliasAst(Ast* parent): StatementAst(parent, Ast::TypeAliasType)
++{
++}
+
+ WhileAst::WhileAst(Ast* parent): StatementAst(parent, Ast::WhileAstType), condition(nullptr)
+ {
+diff --git a/parser/ast.h b/parser/ast.h
+index 430b70d6..acaf79f7 100644
+--- a/parser/ast.h
++++ b/parser/ast.h
+@@ -137,6 +137,7 @@ public:
+ ExceptionHandlerAstType,
+ AliasAstType, // for imports
+ IdentifierAstType,
++ TypeAliasType, // for types
+ LastAstType // the largest one, not valid!
+ };
+
+@@ -437,6 +438,11 @@ public:
+ QList<Ast*> finally;
+ };
+
++class KDEVPYTHONPARSER_EXPORT TypeAliasAst : public StatementAst {
++public:
++ TypeAliasAst(Ast* parent);
++};
++
+ class KDEVPYTHONPARSER_EXPORT ImportAst : public StatementAst {
+ public:
+ ImportAst(Ast* parent);
+diff --git a/parser/astbuilder.cpp b/parser/astbuilder.cpp
+index 9c9ec056..32ab95c7 100644
+--- a/parser/astbuilder.cpp
++++ b/parser/astbuilder.cpp
+@@ -57,7 +57,16 @@ struct PythonParser : private QMutexLocker
+
+ PythonParser(QMutex& lock): QMutexLocker(&lock)
+ {
++#if PYTHON_VERSION < QT_VERSION_CHECK(3, 12, 0)
+ Py_InitializeEx(0);
++#else
++ PyConfig config;
++ PyConfig_InitPythonConfig(&config);
++ config.site_import = 0;
++ config.install_signal_handlers = 0;
++ Py_InitializeFromConfig(&config);
++#endif
++
+ Q_ASSERT(Py_IsInitialized());
+ m_parser_mod = PyImport_ImportModule("ast");
+ Q_ASSERT(m_parser_mod); // parser import error
+@@ -92,9 +101,11 @@ struct PythonParser : private QMutexLocker
+ CodeAst::Ptr AstBuilder::parse(const QUrl& filename, QString &contents)
+ {
+ qCDebug(KDEV_PYTHON_PARSER) << " ====> AST ====> building abstract syntax tree for " << filename.path();
+-
++
++#if PYTHON_VERSION < QT_VERSION_CHECK(3, 12, 0)
+ Py_NoSiteFlag = 1;
+-
++#endif
++
+ contents.append('\n');
+
+ PythonParser py_parser(pyInitLock);
+diff --git a/parser/asttransformer.cpp b/parser/asttransformer.cpp
+index 3884ae13..0c54a498 100644
+--- a/parser/asttransformer.cpp
++++ b/parser/asttransformer.cpp
+@@ -1246,6 +1246,12 @@ Ast* AstTransformer::visitStmtNode(PyObject* node, Ast* parent)
+ }
+ result = v;
+ }
++#endif
++#if PYTHON_VERSION >= QT_VERSION_CHECK(3, 12, 0)
++ else if (PyObject_IsInstance(node, grammar.ast_TypeAlias)) {
++ TypeAliasAst* v = new TypeAliasAst(parent);
++ result = v;
++ }
+ #endif
+ else {
+ qWarning() << "Unsupported _stmt AST type: " << PyUnicodeObjectToQString(PyObject_Str(node));
+diff --git a/parser/astvisitor.cpp b/parser/astvisitor.cpp
+index eda66000..df21cddf 100644
+--- a/parser/astvisitor.cpp
++++ b/parser/astvisitor.cpp
+@@ -104,6 +104,7 @@ void AstVisitor::visitNode(Ast* node)
+ case Ast::LastStatementType: Q_ASSERT(false); break;
+ case Ast::LastExpressionType: Q_ASSERT(false); break;
+ case Ast::LastPatternType: Q_ASSERT(false); break;
++ case Ast::TypeAliasType: break;
+ }
+ }
+
+diff --git a/parser/python_grammar.h b/parser/python_grammar.h
+index 1b30be49..88c68f70 100644
+--- a/parser/python_grammar.h
++++ b/parser/python_grammar.h
+@@ -45,6 +45,10 @@ public:
+ PyObject* ast_Pass;
+ PyObject* ast_Break;
+ PyObject* ast_Continue;
++#if PYTHON_VERSION >= QT_VERSION_CHECK(3, 12, 0)
++ // type
++ PyObject* ast_TypeAlias;
++#endif
+
+ // expr
+ PyObject* ast_expr;
+@@ -330,6 +334,10 @@ public:
+ Py_GRAMMAR_GET(mod, Bytes);
+ #endif
+
++#if PYTHON_VERSION >= QT_VERSION_CHECK(3, 12, 0)
++ Py_GRAMMAR_GET(mod, TypeAlias);
++#endif
++
+ Py_DECREF(mod);
+ }
+
+@@ -472,6 +480,13 @@ public:
+ Py_XDECREF(ast_Str);
+ Py_XDECREF(ast_Bytes);
+ #endif
++
++#if PYTHON_VERSION >= QT_VERSION_CHECK(3, 11, 0)
++ Py_XDECREF(ast_TryStar);
++#endif
++#if PYTHON_VERSION >= QT_VERSION_CHECK(3, 12, 0)
++ Py_XDECREF(ast_TypeAlias);
++#endif
+ }
+ };
+
+--
+GitLab
+
diff --git a/dev-util/kdevelop-python/kdevelop-python-24.05.0.ebuild b/dev-util/kdevelop-python/kdevelop-python-24.05.1.ebuild
index ca3cc3e268ca..5825a13345bf 100644
--- a/dev-util/kdevelop-python/kdevelop-python-24.05.0.ebuild
+++ b/dev-util/kdevelop-python/kdevelop-python-24.05.1.ebuild
@@ -6,7 +6,7 @@ EAPI=8
ECM_TEST="forceoptional"
KDE_ORG_CATEGORY="kdevelop"
KDE_ORG_NAME="kdev-python"
-PYTHON_COMPAT=( python3_{10..11} )
+PYTHON_COMPAT=( python3_{10..12} )
KFMIN=5.115.0
QTMIN=5.15.12
inherit ecm gear.kde.org python-single-r1
@@ -45,6 +45,8 @@ RDEPEND="${DEPEND}
')
"
+PATCHES=( "${FILESDIR}/${P}-python3.12.patch" ) # bug 929546
+
pkg_setup() {
python-single-r1_pkg_setup
ecm_pkg_setup