%bcond_with gcc

Name:           kdevelop-python
Summary:        Python language and documentation plugins for KDevelop
Version: 24.12.1
Release: 1%{?dist}

# Most files LGPLv2+/GPLv2+
License:        GPL-2.0-or-later
URL:            https://kdevelop.org/
Source0:        https://download.kde.org/stable/release-service/%{version}/src/kdev-python-%{version}.tar.xz

Patch0:         fix-for-python3.6.patch

# kdevelop depends on qt6-qtwebengine, which is only available on some arches
ExclusiveArch:  %{qt6_qtwebengine_arches}

BuildRequires:  extra-cmake-modules
%if %{with gcc}
BuildRequires:  gcc-toolset-14-gcc-c++
%else
BuildRequires:  clang
%endif
BuildRequires:  kf6-rpm-macros

BuildRequires:  cmake(Qt6Core)
BuildRequires:  cmake(Qt6Widgets)
BuildRequires:  cmake(Qt6Test)

BuildRequires:  cmake(KF6ThreadWeaver)
BuildRequires:  cmake(KF6TextEditor)
BuildRequires:  cmake(KF6I18n)
BuildRequires:  cmake(KF6KCMUtils)

BuildRequires:  cmake(KDevPlatform) >= 6.0
BuildRequires:  cmake(KDevelop-PG-Qt) >= 2.3.0
BuildRequires:  kdevelop-devel = 9:%{version}
BuildRequires:  python3-devel

%{?kdevelop_requires}

%description
%{summary}.


%prep
%autosetup -p1 -n kdev-python-%{version}

%build
%if %{with gcc}
%enable_devtoolset14
export CC=gcc
export CXX=c++
%else
%global optflags %(echo %{optflags}) -Qunused-arguments
%endif

%cmake_kf6
%cmake_build


%install
%cmake_install

# TODO Enable translations in stable build
%find_lang %{name} --all-name


%files -f %{name}.lang
%doc README
%license LICENSES/*
%{_datadir}/kdevappwizard/
%{_datadir}/kdevpythonsupport/
%{_libdir}/libkdevpython*.so
%{_kf6_qtplugindir}/kdevplatform/
%{_datadir}/qlogging-categories6/kdevpythonsupport.categories
%{_kf6_metainfodir}/org.kde.kdev-python.metainfo.xml